prometheus

package
v0.0.0-...-92af63e Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue interface {
	Start(ctx context.Context) error
	Stop()
	Appender(ctx context.Context) storage.Appender
}

Queue is the interface for a prometheus compatible queue. The queue is an append only interface.

Start will start the queue.

Stop will stop the queue.

Appender returns an Appender that writes to the queue.

func NewQueue

func NewQueue(name string, cc types.ConnectionConfig, directory string, maxSignalsToBatch uint32, flushInterval time.Duration, ttl time.Duration, registerer prometheus.Registerer, namespace string, logger log.Logger) (Queue, error)

NewQueue creates and returns a new Queue instance, initializing its components such as network client, file storage queue, and serializer. It configures the queue with the given connection settings, directory for file storage, batching parameters, and logging. The function also sets up the statistics callback functions for network and serialization metrics.

Parameters: - name: identifier for the endpoint, this will add a label to the prometheus metrics named endpoint:<NAME> - cc: ConnectionConfig for setting up the network client. - directory: Directory path for storing queue files. - maxSignalsToBatch: Maximum number of signals to batch before flushing to file storage. - flushInterval: Duration for how often to flush the data to file storage. - ttl: Time-to-live for data in the queue, this is checked in both writing to file storage and sending to the network. - registry: Prometheus registry to apply metrics to. - namespace: Namespace to use to add to the metric family names. IE `alloy` would make `alloy_queue_series_total_sent` - logger: Logger for logging internal operations and errors.

Returns: - Queue: An initialized Queue instance. - error: An error if any of the components fail to initialize.

type Stats

type Stats struct {

	// Parallelism
	ParallelismMin     prometheus.Gauge
	ParallelismMax     prometheus.Gauge
	ParallelismDesired prometheus.Gauge

	// Network Stats
	NetworkSeriesSent                prometheus.Counter
	NetworkFailures                  prometheus.Counter
	NetworkRetries                   prometheus.Counter
	NetworkRetries429                prometheus.Counter
	NetworkRetries5XX                prometheus.Counter
	NetworkSentDuration              prometheus.Histogram
	NetworkErrors                    prometheus.Counter
	NetworkNewestOutTimeStampSeconds prometheus.Gauge
	NetworkTTLDrops                  prometheus.Counter

	// Drift between serializer input and network output
	TimestampDriftSeconds prometheus.Gauge

	// Serializer Stats
	SerializerInSeries                 prometheus.Counter
	SerializerInExemplars              prometheus.Counter
	SerializerNewestInTimeStampSeconds prometheus.Gauge
	SerializerErrors                   prometheus.Counter

	FileIDWritten            prometheus.Gauge
	CompressedBytesWritten   prometheus.Counter
	UncompressedBytesWritten prometheus.Counter

	FileIDRead            prometheus.Gauge
	CompressedBytesRead   prometheus.Counter
	UncompressedBytesRead prometheus.Counter

	// Backwards compatibility metrics
	SamplesTotal    prometheus.Counter
	HistogramsTotal prometheus.Counter
	MetadataTotal   prometheus.Counter

	FailedSamplesTotal    prometheus.Counter
	FailedHistogramsTotal prometheus.Counter
	FailedMetadataTotal   prometheus.Counter

	RetriedSamplesTotal    prometheus.Counter
	RetriedHistogramsTotal prometheus.Counter
	RetriedMetadataTotal   prometheus.Counter

	// TODO - add these and other missing backwards compatibility metrics
	// EnqueueRetriesTotal  prometheus.Counter
	SentBatchDuration prometheus.Histogram

	SentBytesTotal              prometheus.Counter
	MetadataBytesTotal          prometheus.Counter
	RemoteStorageSentBytesTotal prometheus.Counter
	RemoteStorageInTimestamp    prometheus.Gauge
	RemoteStorageOutTimestamp   prometheus.Gauge

	RemoteShardsDesired prometheus.Gauge
	RemoteShardsMin     prometheus.Gauge
	RemoteShardsMax     prometheus.Gauge
	// contains filtered or unexported fields
}

func NewStats

func NewStats(namespace, subsystem string, isMeta bool, registry prometheus.Registerer, sh types.StatsHub) *Stats

func (*Stats) MetaBackwardsCompatibility

func (s *Stats) MetaBackwardsCompatibility(registry prometheus.Registerer)

func (*Stats) SeriesBackwardsCompatibility

func (s *Stats) SeriesBackwardsCompatibility(registry prometheus.Registerer)

func (*Stats) Unregister

func (s *Stats) Unregister()

func (*Stats) UpdateNetwork

func (s *Stats) UpdateNetwork(stats types.NetworkStats)

func (*Stats) UpdateParralelism

func (s *Stats) UpdateParralelism(stats types.ParralelismStats)

func (*Stats) UpdateSerializer

func (s *Stats) UpdateSerializer(stats types.SerializerStats)

Jump to

Keyboard shortcuts

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