Documentation ¶
Index ¶
- func Register(scheme string, op Opener)
- type Counter
- type CounterSlice
- type Counters
- type DB
- type DataPoint
- type DataPoints
- func (s DataPoints) AppendJSON(data []byte) []byte
- func (s DataPoints) Avg() float64
- func (s DataPoints) Copy() DataPoints
- func (s DataPoints) First() *DataPoint
- func (s DataPoints) Get(i int) *DataPoint
- func (s DataPoints) IndexOf(ts int64) int
- func (s DataPoints) Last() *DataPoint
- func (s DataPoints) Len() int
- func (s DataPoints) Less(i, j int) bool
- func (s DataPoints) MarshalJSON() ([]byte, error)
- func (s DataPoints) Merge(m Merger, data ...DataPoint) DataPoints
- func (s DataPoints) MergeConsecutiveDuplicates(m Merger) DataPoints
- func (s DataPoints) MergePoint(m Merger, t int64, v float64) DataPoints
- func (s DataPoints) MergeScalar(m Merger, v float64) DataPoints
- func (s DataPoints) Sum() (sum float64)
- func (s DataPoints) Swap(i, j int)
- func (s DataPoints) ValueAt(ts int64) float64
- type Eval
- type Evaler
- type Event
- type EventSummaries
- type EventSummary
- type Field
- type FieldCache
- func (c *FieldCache) BlobID(blob []byte) (id uint64, ok bool)
- func (c *FieldCache) Fields(id uint64) (fields Fields)
- func (c *FieldCache) ID(fields Fields) (uint64, bool)
- func (c *FieldCache) Labels() (labels []string)
- func (c *FieldCache) Set(id uint64, fields Fields) Fields
- func (c *FieldCache) SetBlob(id uint64, blob []byte) Fields
- type FieldSummaries
- type FieldSummary
- type Fields
- func (fields Fields) Add(field Field) Fields
- func (fields Fields) AppendBlob(b []byte) ([]byte, error)
- func (fields Fields) AppendValues(dst []string, empty string, labels ...string) []string
- func (fields Fields) Copy() Fields
- func (fields Fields) Equal(other Fields) bool
- func (fields Fields) FromBlob(b []byte) (Fields, []byte)
- func (fields Fields) Get(label string) (string, bool)
- func (fields Fields) GroupBy(empty string, groups []string) Fields
- func (fields Fields) Len() int
- func (fields Fields) Less(i, j int) bool
- func (fields Fields) Map() map[string][]string
- func (fields Fields) MarshalJSON() ([]byte, error)
- func (fields Fields) MatchSorted(match Fields) bool
- func (fields Fields) Merge(other ...Field) Fields
- func (fields Fields) Reset() Fields
- func (fields *Fields) ShiftBlob(b []byte) ([]byte, error)
- func (fields Fields) Sorted() Fields
- func (fields Fields) Swap(i, j int)
- func (fields *Fields) UnmarshalBinary(b []byte) error
- func (fields *Fields) UnmarshalJSON(data []byte) error
- type MemoryStore
- type MergeAvg
- type MergeDiff
- type MergeDiv
- type MergeFunc
- type MergeMax
- type MergeMin
- type MergeMul
- type MergeSum
- type Merger
- type Opener
- type Querier
- type Query
- type Result
- type ResultType
- type Results
- func (results Results) Add(event string, fields Fields, ts int64, n float64) Results
- func (results Results) ByEvent() map[string]ScanResult
- func (results Results) EventSummaries(empty string) *EventSummaries
- func (results Results) FieldSummaries() (s FieldSummaries)
- func (results Results) Totals() (totals Totals)
- type ScanResult
- type ScanResults
- type Scanner
- type ScannerIndex
- type Scanners
- type Snapshot
- type Storer
- type Table
- type TimeRange
- type Total
- type Totals
- type UnsafeCounters
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CounterSlice ¶
type CounterSlice []Counter
CounterSlice is a slice of counters
func (CounterSlice) FilterZero ¶
func (s CounterSlice) FilterZero() CounterSlice
FilterZero filters out empty counters in-place
type Counters ¶
type Counters struct {
// contains filtered or unexported fields
}
Counters is an index of counters safe for councurrent use
func NewCounters ¶
NewCounters creates a new counter index of size capacity
func (*Counters) Flush ¶
func (cs *Counters) Flush(s CounterSlice) CounterSlice
Flush appends counters to a CounterSlice and resets all counters to zero
func (*Counters) Merge ¶
func (cs *Counters) Merge(s CounterSlice)
Merge adds all counters from a CounterSlice
type DataPoint ¶
DataPoint is a time/value pair
func (DataPoint) AppendJSON ¶
AppendJSON appends JSON to a buffer
func (DataPoint) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface
func (*DataPoint) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface
type DataPoints ¶
type DataPoints []DataPoint
DataPoints is a collection of DataPoints
func (DataPoints) AppendJSON ¶
func (s DataPoints) AppendJSON(data []byte) []byte
AppendJSON appends points as JSON to a buffer
func (DataPoints) Avg ¶
func (s DataPoints) Avg() float64
Avg returns the average value of all points
func (DataPoints) First ¶
func (s DataPoints) First() *DataPoint
First returns a pointer to the first point
func (DataPoints) Get ¶
func (s DataPoints) Get(i int) *DataPoint
Get returns a pointer to the i-th point
func (DataPoints) IndexOf ¶
func (s DataPoints) IndexOf(ts int64) int
IndexOf returns the index of tm in the collection of data points
func (DataPoints) Last ¶
func (s DataPoints) Last() *DataPoint
Last returns a pointer to the last point
func (DataPoints) MarshalJSON ¶
func (s DataPoints) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshal interface
func (DataPoints) Merge ¶
func (s DataPoints) Merge(m Merger, data ...DataPoint) DataPoints
Merge merges other datapoints using m
func (DataPoints) MergeConsecutiveDuplicates ¶
func (s DataPoints) MergeConsecutiveDuplicates(m Merger) DataPoints
MergeConsecutiveDuplicates merges sequential points with equal timestamps
func (DataPoints) MergePoint ¶
func (s DataPoints) MergePoint(m Merger, t int64, v float64) DataPoints
MergePoint adds a point using Merger
func (DataPoints) MergeScalar ¶
func (s DataPoints) MergeScalar(m Merger, v float64) DataPoints
MergeScalar merges a value to all datapoints using m
func (DataPoints) Sum ¶
func (s DataPoints) Sum() (sum float64)
Sum returns the sum of the values of all points
func (DataPoints) ValueAt ¶
func (s DataPoints) ValueAt(ts int64) float64
ValueAt searches for the value at a specific time
type Eval ¶
type Eval struct {
// contains filtered or unexported fields
}
Eval is a query expression of simple arthmetic between events
type Event ¶
Event stores counters for an event
type EventSummaries ¶
type EventSummaries struct { Labels []string Events []string Data []EventSummary }
EventSummaries is a result summary format
func (*EventSummaries) Table ¶
func (s *EventSummaries) Table() Table
Table returns event summaries as a table
type EventSummary ¶
EventSummary groups values with totals
func (*EventSummary) TableRow ¶
func (r *EventSummary) TableRow(events []string) []interface{}
TableRow is a helper to convert event summary to table
type FieldCache ¶
type FieldCache struct {
// contains filtered or unexported fields
}
FieldCache is an in memory cache of field ids
func (*FieldCache) BlobID ¶
func (c *FieldCache) BlobID(blob []byte) (id uint64, ok bool)
BlobID returns the id of raw fields
func (*FieldCache) Fields ¶
func (c *FieldCache) Fields(id uint64) (fields Fields)
Fields gets fields by id
func (*FieldCache) ID ¶
func (c *FieldCache) ID(fields Fields) (uint64, bool)
ID gets the id of fields
func (*FieldCache) Labels ¶
func (c *FieldCache) Labels() (labels []string)
Labels returns the distinct cached labels
type FieldSummaries ¶
type FieldSummaries []FieldSummary
FieldSummaries is a slice of FieldSummary results
type FieldSummary ¶
type FieldSummary struct { Event string `json:"event"` Label string `json:"label"` Values map[string]float64 `json:"values"` }
FieldSummary is a query result presented as a summary of field values
func (*FieldSummary) Add ¶
func (s *FieldSummary) Add(value string, n float64)
Add ads a value to a field summary
type Fields ¶
type Fields []Field
Fields is a collection of Label/Value pairs
func (Fields) AppendBlob ¶
AppendBlob implements blob.Appender interface
func (Fields) AppendValues ¶
AppendValues appends the values for the labels in order
func (Fields) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface
func (Fields) MatchSorted ¶
MatchSorted matches fields agaist a sorted collection of Fields
func (*Fields) UnmarshalBinary ¶
func (*Fields) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler interface
type MemoryStore ¶
type MemoryStore struct { Event string // contains filtered or unexported fields }
MemoryStore is an in-memory EventStore for debugging
func (*MemoryStore) Last ¶
func (m *MemoryStore) Last() *Snapshot
Last retuns the last posted StoreRequest
func (*MemoryStore) Scan ¶
func (m *MemoryStore) Scan(ctx context.Context, span TimeRange, match Fields) (results ScanResults, err error)
Scan implements the Scanner interface
func (*MemoryStore) Scanner ¶
func (m *MemoryStore) Scanner(event string) Scanner
Scanner implements the EventScanner interface
func (*MemoryStore) Store ¶
func (m *MemoryStore) Store(req *Snapshot) error
Store implements EventStore interface
type MergeAvg ¶
type MergeAvg struct {
// contains filtered or unexported fields
}
MergeAvg merges values to their average
type Query ¶
type Query struct { TimeRange Match Fields `json:"match,omitempty"` Group []string `json:"group,omitempty"` EmptyValue string `json:"empty,omitempty"` }
Query is a query for event results
type Result ¶
type Result struct { ScanResult Event string `json:"event,omitempty"` }
Result is a query result
type ResultType ¶
type ResultType int
ResultType is a type of result
const ( ArrayResult ResultType = iota TotalsResult EventSummaryResult FieldSummaryResult )
Result types
func ResultTypeFromString ¶
func ResultTypeFromString(s string) ResultType
ResultTypeFromString converts a string to ResultType
type Results ¶
type Results []Result
Results is a slice of results
func (Results) ByEvent ¶
func (results Results) ByEvent() map[string]ScanResult
func (Results) EventSummaries ¶
func (results Results) EventSummaries(empty string) *EventSummaries
EventSummaries groups results as EventSummaries
func (Results) FieldSummaries ¶
func (results Results) FieldSummaries() (s FieldSummaries)
FieldSummaries converts a series of results to a slice of FieldSummary results
type ScanResult ¶
type ScanResult struct { Fields Fields `json:"fields,omitempty"` Data DataPoints `json:"data,omitempty"` }
ScanResult is result of a scan
func (*ScanResult) Merge ¶
func (r *ScanResult) Merge(other *ScanResult, m Merger)
type ScanResults ¶
type ScanResults []ScanResult
ScanResults are results from a scan
func (ScanResults) Add ¶
func (results ScanResults) Add(fields Fields, t int64, v float64) ScanResults
Add adds a result
func (ScanResults) GroupBy ¶
func (results ScanResults) GroupBy(labels []string, empty string) (grouped ScanResults)
func (ScanResults) Merge ¶
func (results ScanResults) Merge(fields Fields, data ...DataPoint) ScanResults
type Scanner ¶
type Scanner interface {
Scan(ctx context.Context, span TimeRange, match Fields) (ScanResults, error)
}
Scanner scans stored data according to a query
type ScannerIndex ¶
ScannerIndex is an index of scanners that implements Scanners interface
func (ScannerIndex) Scanner ¶
func (s ScannerIndex) Scanner(event string) Scanner
Scanner implements Scanners interface
type Snapshot ¶
type Snapshot struct { Time time.Time `json:"time,omitempty"` Labels []string `json:"labels"` Counters CounterSlice `json:"counters"` }
Snapshot is a snaphot of event counters
type Table ¶
type Table struct { Columns []interface{} `json:"cols"` Data [][]interface{} `json:"data"` }
Table holds generic tabular data
type TimeRange ¶
type TimeRange struct { Start time.Time `json:"start"` End time.Time `json:"end"` Step time.Duration `json:"step"` }
TimeRange is a range of time with a specific step
type UnsafeCounters ¶
type UnsafeCounters struct {
// contains filtered or unexported fields
}
UnsafeCounters is an index of counters not safe for concurrent use
func (*UnsafeCounters) Add ¶
func (cs *UnsafeCounters) Add(n int64, values ...string) int64
Add increments a counter matching values by n
func (*UnsafeCounters) Flush ¶
func (cs *UnsafeCounters) Flush(s CounterSlice) CounterSlice
Flush appends all counters to a snapshot and resets them to zero
func (*UnsafeCounters) Get ¶
func (cs *UnsafeCounters) Get(i int) *Counter
Get returns the counter at index i
func (*UnsafeCounters) Len ¶
func (cs *UnsafeCounters) Len() int
Len returns the number of counters in an Event
func (*UnsafeCounters) Pack ¶
func (cs *UnsafeCounters) Pack()
Pack packs the counter index dropping zero counters