metadata

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamicLabeler

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

DynamicLabeler is a labeler that adds dynamic labels from a collection of metadata sources.

func FromConfig

func FromConfig(kubeNode *KubeNode, cfg *DynamicLabelerConfig) *DynamicLabeler

FromConfig creates a DynamicLabeler from the provided configuration and metadata sources. The provided configuration may be nil.

func (*DynamicLabeler) AppendLabelNamesBytes

func (d *DynamicLabeler) AppendLabelNamesBytes(names [][]byte) [][]byte

AppendLabelNamesBytes appends the dynamic label names this labeler sets to the provided slice of labels.

func (*DynamicLabeler) AppendPromLabels

func (d *DynamicLabeler) AppendPromLabels(ts *prompb.TimeSeries)

func (*DynamicLabeler) SetResourceValues

func (d *DynamicLabeler) SetResourceValues(log *types.Log)

func (*DynamicLabeler) WalkLabels

func (d *DynamicLabeler) WalkLabels(callback func(key, value []byte))

WalkLabels calls the provided function for each dynamic label this labeler would add. If the label source does not have a value for the label, the value will be an empty string.

type DynamicLabelerConfig

type DynamicLabelerConfig struct {
	KubernetesNodeLabels      map[string]string
	KubernetesNodeAnnotations map[string]string
}

DynamicLabelerConfig contains the label mapping configuration used to build a DynamicLabeler.

type KubeNode

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

KubeNode watches metadata for the local Kubernetes node and exposes its labels and annotations in a concurrency-safe manner. The watcher implements the service.Component interface via the Open and Close methods so it can be managed alongside other long-lived components in the collector.

func NewKubeNode

func NewKubeNode(client kubernetes.Interface, nodeName string) *KubeNode

NewKubeNode creates a new KubeNode watcher for the provided node name.

func (*KubeNode) Annotation

func (k *KubeNode) Annotation(key string) (string, bool)

Annotation returns the value of an annotation on the current node along with a boolean indicating whether the key was present.

func (*KubeNode) Close

func (k *KubeNode) Close() error

Close shuts down the informer and clears the cancellation function.

func (*KubeNode) Label

func (k *KubeNode) Label(key string) (string, bool)

Label returns the value of a label on the current node along with a boolean indicating whether the key was present.

func (*KubeNode) Open

func (k *KubeNode) Open(ctx context.Context) error

Open initializes the node informer and blocks until the initial metadata for the local node has been observed or the timeout is reached. Subsequent calls are no-ops. If the initial sync fails or times out, no error is returned to allow the collector to continue starting up; metadata will be populated asynchronously once events arrive.

func (*KubeNode) WalkAnnotations

func (k *KubeNode) WalkAnnotations(fn func(key, value string))

WalkAnnotations calls the provided function for each annotation on the node.

func (*KubeNode) WalkLabels

func (k *KubeNode) WalkLabels(fn func(key, value string))

WalkLabels calls the provided function for each label on the node.

type LogLabeler

type LogLabeler interface {
	SetResourceValues(*types.Log)
}

type MetricLabeler

type MetricLabeler interface {
	// AppendLabelNamesBytes appends the dynamic label names this labeler sets to the provided slice of labels.
	AppendLabelNamesBytes(names [][]byte) [][]byte
	// WalkLabels calls the provided function for each dynamic label this labeler would add.
	// If the label source does not have a value for the label, the value will be an empty slice.
	WalkLabels(callback func(key, value []byte))
	// AppendPromLabels appends the dynamic labels this labeler sets to the provided TimeSeries.
	AppendPromLabels(ts *prompb.TimeSeries)
}

MetricLabeler is a labeler that adds dynamic labels from a collection of metadata sources. Intended for usage with the metrics path of the collector.

Jump to

Keyboard shortcuts

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