dk

package module
v0.0.0-...-c0b0e9c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2015 License: MIT Imports: 5 Imported by: 1

README

       ._____
     __| _/  | __
    / __ ||  |/ /
   / /_/ ||    <
   \____ ||__|_ \
        \/     \/

        v 0,3

a decaying 2-dimensional hashtable of counters

  + a dk table tracks trends/cardinality on ephemeral data

  + dk is optimized for fast writes and slower reads.

  + dk was inspired by @bitly's https://github.com/bitly/forgettable

Used in several trend monitoring dashboards for high speed/throughput logs.

DOCS LICENSE

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cardinality

type Cardinality struct {
	Percent  float64 `json:"percent"`
	Duration string  `json:"duration"`
	Uniques  uint64  `json:"uniques"`
	Total    uint64  `json:"total"`
}

type Column

type Column struct {
	// contains filtered or unexported fields
}

type Entries

type Entries []*Entry

func (Entries) Len

func (e Entries) Len() int

func (Entries) Less

func (e Entries) Less(i, j int) bool

func (Entries) Swap

func (e Entries) Swap(i, j int)

type Entry

type Entry struct {
	Name  string  `json:"name"`
	Score float64 `json:"score"`
}

type Report

type Report struct {
	Running    bool              `json:"running"`
	Timestamp  string            `json:"timestamp"`
	RenderTime string            `json:"render_time"`
	DecayRate  float64           `json:"decay_rate"`
	DecayFloor float64           `json:"decay_floor"`
	ResultSet  map[string]Result `json:"result_set"`
}

type Result

type Result struct {
	TableSize   int         `json:"table_size"`
	Cardinality Cardinality `json:"cardinality"`
	ResultCount int         `json:"result_count"`
	Results     Entries     `json:"results"`
}

type Table

type Table struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewTable

func NewTable(rate, floor float64, interval time.Duration) *Table

func (*Table) Add

func (d *Table) Add(column, key string, inc float64)

func (*Table) ColumnCount

func (d *Table) ColumnCount() (n int)

func (*Table) Columns

func (d *Table) Columns() (columns []string)

func (*Table) KeyCount

func (d *Table) KeyCount() (n int)

func (*Table) Report

func (d *Table) Report(columns []string, n int) *Report

func (*Table) Reset

func (d *Table) Reset()

func (*Table) Start

func (d *Table) Start()

func (*Table) Stop

func (d *Table) Stop()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL