export

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlowPrinterProvider added in v1.4.0

func FlowPrinterProvider(enabled bool) (pipe.FinalFunc[[]*ebpf.Record], error)

Types

type Attribute added in v1.5.0

type Attribute struct {
	Name string
	Get  func(r *ebpf.Record) string
}

Attribute stores how to expose a metric attribute: its exposed name and how to get its value from the ebpf.Record.

func BuildOTELAttributeGetters added in v1.5.0

func BuildOTELAttributeGetters(names []string) []Attribute

BuildOTELAttributeGetters builds a list of Attribute getters for the names provided by the user configuration, ready to be passed to an OpenTelemetry exporter. Whatever is the format of the user-provided attribute names (dot-based or underscore-based), it converts underscores to dots to make sure that the correct attribute name is exposed.

func BuildPromAttributeGetters added in v1.5.0

func BuildPromAttributeGetters(names []string) []Attribute

BuildPromAttributeGetters builds a list of Attribute getters for the names provided by the user configuration, ready to be passed to a Prometheus exporter. It differentiates two name formats: the exposed name for the attribute (uses _ for word separation, as required by Prometheus); and the internal name of the attribute (uses . for word separation, as internally Beyla stores the metadata). Whatever is the format provided by the user (dot-based or underscore-based), it converts dots to underscores and vice-versa to make sure that the correct format is used either internally or externally.

type ExpiryMap added in v1.5.0

type ExpiryMap[T any] struct {
	// contains filtered or unexported fields
}

ExpiryMap stores elements in a synchronized map, and removes them if they haven't been accessed/updated for a given time period

func NewExpiryMap added in v1.5.0

func NewExpiryMap[T any](expireTime time.Duration, opts ...ExpiryOption[T]) *ExpiryMap[T]

NewExpiryMap creates an expiry map. Its labeled instances are dropped if they haven't been updated during the last timeout period

func (*ExpiryMap[T]) All added in v1.5.0

func (ex *ExpiryMap[T]) All() []T

All returns an array with all the stored entries. It might contain expired entries if DeleteExpired is not invoked before it. TODO: use https://tip.golang.org/wiki/RangefuncExperiment when available

func (*ExpiryMap[T]) DeleteExpired added in v1.5.0

func (ex *ExpiryMap[T]) DeleteExpired() [][]string

DeleteExpired entries and return their label set

func (*ExpiryMap[T]) GetOrCreate added in v1.5.0

func (ex *ExpiryMap[T]) GetOrCreate(lbls []string, instancer func() T) T

GetOrCreate returns the stored object for the given slice of label values. If that combination of label values is accessed for the first time, a new instance is created. If not, a cached copy is returned and the "last access" cache time is updated.

func (*ExpiryMap[T]) UpdateTime added in v1.5.0

func (ex *ExpiryMap[T]) UpdateTime()

UpdateTime updates the last access time to be annotated to any new or existing metric. It is a required operation before processing a given batch of metrics (e.g. before invoking GetOrCreate).

type ExpiryOption added in v1.5.0

type ExpiryOption[T any] func(ex *ExpiryMap[T])

func WithClock added in v1.5.0

func WithClock[T any](clk func() time.Time) ExpiryOption[T]

WithClock is only required for unit tests

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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