labelstore

package
v1.12.0-rc.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ServiceName = "labelstore"

Variables

This section is empty.

Functions

This section is empty.

Types

type Arguments

type Arguments struct{}

type LabelStore

type LabelStore interface {
	// AddLocalLink adds a mapping from local to global id for the given component.
	AddLocalLink(componentID string, globalRefID uint64, localRefID uint64)

	// GetOrAddGlobalRefID finds or adds a global id for the given label map.
	GetOrAddGlobalRefID(l labels.Labels) uint64

	// GetLocalRefID gets the mapping from global to local id specific to a component. Returns 0 if nothing found.
	GetLocalRefID(componentID string, globalRefID uint64) uint64

	// TrackStaleness adds a stale marker if NaN, then that reference will be removed on the next check. If not a NaN
	// then if tracked will remove it.
	TrackStaleness(ids []StalenessTracker)

	// CheckAndRemoveStaleMarkers identifies any series with a stale marker and removes those entries from the LabelStore.
	CheckAndRemoveStaleMarkers()

	// ReplaceLocalLink updates an existing local to global mapping for a component.
	ReplaceLocalLink(componentID string, globalRefID uint64, cachedLocalRef uint64, newLocalRef uint64)
}

type Service added in v1.9.0

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

func New

func (s *Service) AddLocalLink(componentID string, globalRefID uint64, localRefID uint64)

AddLocalLink is called by a remote_write endpoint component to add mapping from local ref and global ref

func (*Service) CheckAndRemoveStaleMarkers added in v1.9.0

func (s *Service) CheckAndRemoveStaleMarkers()

CheckAndRemoveStaleMarkers is called to garbage collect and items that have grown stale over stale duration (10m)

func (*Service) Collect added in v1.9.0

func (s *Service) Collect(m chan<- prometheus.Metric)

func (*Service) Data added in v1.9.0

func (s *Service) Data() any

Data returns the Data associated with a Service. Data must always return the same value across multiple calls, as callers are expected to be able to cache the result.

Data may be invoked before Run.

func (*Service) Definition added in v1.9.0

func (s *Service) Definition() alloy_service.Definition

Definition returns the Definition of the Service. Definition must always return the same value across all calls.

func (*Service) Describe added in v1.9.0

func (s *Service) Describe(m chan<- *prometheus.Desc)

func (*Service) GetLocalRefID added in v1.9.0

func (s *Service) GetLocalRefID(componentID string, globalRefID uint64) uint64

GetLocalRefID returns the local refid for a component global combo, or 0 if not found

func (*Service) GetOrAddGlobalRefID added in v1.9.0

func (s *Service) GetOrAddGlobalRefID(l labels.Labels) uint64

GetOrAddGlobalRefID is used to create a global refid for a labelset

func (s *Service) ReplaceLocalLink(componentID string, globalRefID uint64, cachedLocalRef uint64, newLocalRef uint64)

ReplaceLocalLink updates an existing local to global mapping for a component.

func (*Service) Run added in v1.9.0

func (s *Service) Run(ctx context.Context, host alloy_service.Host) error

Run starts a Service. Run must block until the provided context is canceled. Returning an error should be treated as a fatal error for the Service.

func (*Service) TrackStaleness added in v1.9.0

func (s *Service) TrackStaleness(ids []StalenessTracker)

func (*Service) Update added in v1.9.0

func (s *Service) Update(_ any) error

Update updates a Service at runtime. Update is never called if [Definition.ConfigType] is nil. newConfig will be the same type as ConfigType; if ConfigType is a pointer to a type, newConfig will be a pointer to the same type.

Update will be called once before Run, and may be called while Run is active.

type StalenessTracker

type StalenessTracker struct {
	GlobalRefID uint64
	Value       float64
	Labels      labels.Labels
}

Jump to

Keyboard shortcuts

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