merger

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	Interval       time.Duration
	ProcessingTime time.Time

	// Metadata holds an ordered list of arbitrary keys and associated
	// string values to associate with the interval and processing time.
	Metadata []KeyValues
}

func (*Key) AppendBinary added in v0.4.0

func (k *Key) AppendBinary(b []byte) ([]byte, error)

AppendBinary marshals the key into its binary representation, appending it to b.

func (*Key) Unmarshal

func (k *Key) Unmarshal(d []byte) error

Unmarshal unmarshals the binary representation of the Key.

type KeyValues added in v0.4.0

type KeyValues struct {
	Key    string
	Values []string
}

type Merger

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

func New

func New(v *Value) *Merger

func (*Merger) Finish

func (m *Merger) Finish(includesBase bool) ([]byte, io.Closer, error)

func (*Merger) MergeNewer

func (m *Merger) MergeNewer(value []byte) error

func (*Merger) MergeOlder

func (m *Merger) MergeOlder(value []byte) error

type Value

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

Value defines the data structure used to perform merges and other operations for the underlying LSM database. The basic representation of the Value is based on pmetric datastructure. To aid in merging and operations, the pmetric datastructure is expanded into multiple lookup maps as required.

Value also tracks overflows based on defined limits. Once the overflow limit is breached, the new metrics are handled as per the defined overflow behaviour. The Value can be in two states:

1) Unexpanded state, in this state the lookup maps are not created. The limit trackers, if present, are encoded into a separate field. This state is immutable i.e. the pmetric structure and the metrics cannot be modified in this state.

2) Expanded state, in this state lookup maps are created and the limit trackers are decoded and put together with their corresponding pmetric datastructure. The value is automatically upgraded to expanded state when a merge operation is performed.

Value is not safe for concurrent use.

func NewValue added in v0.4.0

func NewValue(
	resLimit, scopeLimit, metricLimit, datapointLimit config.LimitConfig,
	maxExponentialHistogramBuckets int,
) *Value

NewValue creates a new instance of the value with the configured limiters.

func (*Value) AppendBinary added in v0.5.0

func (s *Value) AppendBinary(b []byte) ([]byte, error)

AppendBinary marshals the value into its binary representation, and appends it to b.

Limit trackers and pmetric are marshaled into the same binary representation.

func (*Value) Finalize added in v0.4.0

func (s *Value) Finalize() (pmetric.Metrics, error)

Finalize finalizes all overflows in the metrics to prepare it for harvest. This method must be called only once for harvest.

func (*Value) Merge

func (v *Value) Merge(op *Value) error

Merge merges the provided value to the current value instance.

func (*Value) MergeMetric

func (v *Value) MergeMetric(
	otherRm pmetric.ResourceMetrics,
	otherSm pmetric.ScopeMetrics,
	otherM pmetric.Metric,
) error

MergeMetric adds a metric with a provided resource metric and scope metric. Note that overflows during addition will be applied as per the specifications for overflow handling.

func (*Value) Unmarshal added in v0.4.0

func (s *Value) Unmarshal(data []byte) error

Unmarshal unmarshals the binary into the value struct. The value consists of the pmetric data structure and a set of limits tracking the overflows for each of the pmetric children (resource, scope, and datapoints). The limits are marshaled and encoded separately from the pmetric datastructure.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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