limits

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracker

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

Tracker tracks the configured limits while merging. It records the observed count as well as the unique overflow counts.

func (*Tracker) AppendBinary added in v0.5.0

func (t *Tracker) AppendBinary(b []byte) ([]byte, error)

AppendBinary marshals the tracker and appends the result to b.

func (*Tracker) CheckOverflow

func (t *Tracker) CheckOverflow(f func() hash.Hash64) bool

CheckOverflow checks if overflow will happen on addition of a new entry with the provided hash denoting the entries ID. It assumes that any entry passed to this method is a NEW entry and the check for this is left to the caller.

func (*Tracker) Equal

func (t *Tracker) Equal(other *Tracker) bool

func (*Tracker) EstimateOverflow

func (t *Tracker) EstimateOverflow() uint64

func (*Tracker) HasOverflow

func (t *Tracker) HasOverflow() bool

func (*Tracker) MergeEstimators

func (t *Tracker) MergeEstimators(other *Tracker) error

MergeEstimators merges the overflow estimators for the two trackers. Note that other required maintenance of the tracker for merge needs to done by the caller.

func (*Tracker) Unmarshal

func (t *Tracker) Unmarshal(d []byte) (int, error)

Unmarshal unmarshals the encoded limits into t, and returns the number of bytes consumed.

Example usage:

var t Tracker
n, err := t.Unmarshal(data)
if err != nil {
    panic(err)
}
data = data[n:]

type Trackers

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

Trackers represent multiple tracker in an ordered structure. It takes advantage of the fact that pmetric DS is ordered and thus allows trackers to be created for each resource, scope, and datapoint independent of the pmetric datastructure. Note that this means that the order for pmetric and trackers are implicitly related and removing/adding new objects to pmetric should be accompanied by adding a corresponding tracker.

func NewTrackers

func NewTrackers(resourceLimit, scopeLimit, metricLimit, datapointLimit uint64) *Trackers

func (*Trackers) AppendBinary added in v0.5.0

func (t *Trackers) AppendBinary(b []byte) ([]byte, error)

func (*Trackers) GetDatapointTracker

func (t *Trackers) GetDatapointTracker(i int) *Tracker

func (*Trackers) GetMetricTracker

func (t *Trackers) GetMetricTracker(i int) *Tracker

func (*Trackers) GetResourceTracker

func (t *Trackers) GetResourceTracker() *Tracker

func (*Trackers) GetScopeTracker

func (t *Trackers) GetScopeTracker(i int) *Tracker

func (*Trackers) NewDatapointTracker

func (t *Trackers) NewDatapointTracker() *Tracker

func (*Trackers) NewMetricTracker

func (t *Trackers) NewMetricTracker() *Tracker

func (*Trackers) NewScopeTracker

func (t *Trackers) NewScopeTracker() *Tracker

func (*Trackers) Unmarshal

func (t *Trackers) Unmarshal(d []byte) error

Jump to

Keyboard shortcuts

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