Documentation ¶
Index ¶
Constants ¶
const EPSILON float64 = 0.01
EPSILON is the precision of the rank returned by our quantile queries
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Skiplist ¶
type Skiplist struct {
// contains filtered or unexported fields
}
Skiplist is a pseudo-random data structure used to store nodes and find quickly what we want
func (*Skiplist) Insert ¶
func (s *Skiplist) Insert(e Entry) *SkiplistNode
Insert adds a new Entry to the Skiplist and yields a pointer to the node where the data was inserted
func (*Skiplist) Remove ¶
func (s *Skiplist) Remove(node *SkiplistNode)
Remove removes a node from the Skiplist
type SkiplistNode ¶
type SkiplistNode struct {
// contains filtered or unexported fields
}
SkiplistNode is holding the actual value and pointers to the neighbor nodes
type SliceSummary ¶
SliceSummary is a GK-summary with a slice backend
func NewSliceSummary ¶
func NewSliceSummary() *SliceSummary
NewSliceSummary allocates a new GK summary backed by a DLL
func WeighSummary ¶
func WeighSummary(s *SliceSummary, weight float64) *SliceSummary
WeighSummary applies a weight factor to a slice summary and return it as a new slice.
func (*SliceSummary) BySlices ¶
func (s *SliceSummary) BySlices() []SummarySlice
BySlices returns a slice of Summary slices that represents weighted ranges of values e.g. [0, 1] : 3
[1, 23] : 12 ...
The number of intervals is related to the precision kept in the internal data structure to ensure epsilon*s.N precision on quantiles, but it's bounded. When the bounds of the interval are equal, the weight is the number of times that exact value was inserted in the summary.
func (*SliceSummary) Copy ¶
func (s *SliceSummary) Copy() *SliceSummary
Copy allocates a new summary with the same data
func (*SliceSummary) Insert ¶
func (s *SliceSummary) Insert(v float64, t uint64)
Insert inserts a new value v in the summary paired with t (the ID of the span it was reported from)
func (*SliceSummary) Merge ¶
func (s *SliceSummary) Merge(s2 *SliceSummary)
Merge two summaries entries together
func (*SliceSummary) Quantile ¶
func (s *SliceSummary) Quantile(q float64) float64
Quantile returns an EPSILON estimate of the element at quantile 'q' (0 <= q <= 1)
func (SliceSummary) String ¶
func (s SliceSummary) String() string
type SummarySlice ¶
SummarySlice reprensents how many values are in a [Start, End] range
func BySlicesWeighted ¶
func BySlicesWeighted(summaries ...WeightedSliceSummary) []SummarySlice
BySlicesWeighted BySlices() is the BySlices version but combines multiple weighted slice summaries before returning the histogram
type WeightedSliceSummary ¶
type WeightedSliceSummary struct { Weight float64 *SliceSummary }
WeightedSliceSummary associates a weight to a slice summary.