measurements

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AttrStatusSuccess       = attribute.String("status", "success")
	AttrStatusError         = attribute.String("status", "error-other")
	AttrStatusPanic         = attribute.String("status", "error-panic")
	AttrStatusCanceled      = attribute.String("status", "error-canceled")
	AttrStatusTimeout       = attribute.String("status", "error-timeout")
	AttrStatusInternalError = attribute.String("status", "error-internal")
	AttrStatusNotFound      = attribute.String("status", "error-not-found")

	AttrDialSucceeded = attribute.Key("dial-succeeded")
)

Functions

func Must

func Must[V any](v V, err error) V

Must panics if err is non-nil, otherwise returns v.

func NewMeteredDatastore

func NewMeteredDatastore(meter metric.Meter, metricsPrefix string, delegate datastore.Datastore) datastore.Datastore

NewMeteredDatastore wraps the delegate with metrics, measuring latency and bytes exchanged depending on the operation.

func Status

func Status(ctx context.Context, err error) attribute.KeyValue

Types

type SampleSet

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

SampleSet stores a bounded set of samples and exposes the ability to check whether it contains a given sample. See SampleSet.contains.

Internally, SampleSet uses two maps to store samples, each of which can grow up to the specified max size. When one map fills up, the SampleSet switches to the other, effectively flipping between them. This allows the set to check for sample existence across a range of approximately max size to twice the max size, offering a larger sample set compared to implementations that track insertion order with similar memory footprint.

The worst case memory footprint of SampleSet is around 2 * maxSize * 96 bytes.

func NewSampleSet

func NewSampleSet(maxSize int) *SampleSet

NewSampleSet creates a new SampleSet with a specified max size per sample subset.

func (*SampleSet) Contains

func (ss *SampleSet) Contains(v []byte) bool

Contains checks if the given sample v is contained within sample set, and if not adds it.

Jump to

Keyboard shortcuts

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