metrics

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MetricQueueEnqueueTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_enqueue_total",
		Help:      "Total number of actual data pushed to queue.",
	}, []string{queueName})

	MetricQueueEnqueueErrorTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_enqueue_error_total",
		Help:      "Total number of actual data pushed to queue failed.",
	}, []string{queueName})

	MetricQueueDequeueTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_dequeue_total",
		Help:      "Total number of actual data poped from queue.",
	}, []string{queueName})

	MetricQueueDequeueErrorTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_dequeue_error_total",
		Help:      "Total number of actual data poped from queue failed.",
	}, []string{queueName})

	MetricQueueHandleErrorTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_handle_error_total",
		Help:      "Total number of actual data for handling error",
	}, []string{queueName})

	MetricQueueHandleSuccessulTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_handle_successful_total",
		Help:      "Total number of actual data for handling successful",
	}, []string{queueName})

	MetricQueueRecoverTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_recover_total",
		Help:      "Total number of actual data for recovering",
	}, []string{queueName})

	MetricQueueRecoverSuccessulTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_recover_successful_total",
		Help:      "Total number of actual data for recovering successful",
	}, []string{queueName})

	MetricQueueRecoverErrorTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_recover_error_total",
		Help:      "Total number of actual data for recovering failed",
	}, []string{queueName})

	MetricQueuePurgeTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_purge_total",
		Help:      "Total number of actual data for purging",
	}, []string{queueName})

	MetricQueuePurgeSuccessulTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_purge_successful_total",
		Help:      "Total number of actual data for purging successful",
	}, []string{queueName})

	MetricQueuePurgeErrorTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_purge_error_total",
		Help:      "Total number of actual data for purging failed",
	}, []string{queueName})

	MetricQueueHandleDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespaceQueue,
		Name:      "queue_handle_duration_seconds",
		Help:      "Duration of handling for a queue.",
		Buckets: []float64{
			0.001,
			0.005,
			0.01,
			0.025,
			0.05,
			0.1,
			0.25,
			0.5,
			1,
			2.5,
			5,
			10,
			20,
			30,
			60,
			300,
		},
	}, []string{queueName})

	// MetricQueueDepth tracks the current number of messages in the queue.
	// Labels: name (queue name), type (main, retry, dlq)
	MetricQueueDepth = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespaceQueue,
		Name:      "queue_depth",
		Help:      "Current number of messages in the queue.",
	}, []string{queueName, queueType})

	// MetricQueueInflight tracks the number of messages currently being processed.
	MetricQueueInflight = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespaceQueue,
		Name:      "queue_inflight",
		Help:      "Number of messages currently being processed (in-flight).",
	}, []string{queueName})

	// MetricQueueConsumersActive tracks the number of active consumers/subscribers.
	MetricQueueConsumersActive = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespaceQueue,
		Name:      "queue_consumers_active",
		Help:      "Number of active consumers (callbacks) registered for the queue.",
	}, []string{queueName})

	// MetricQueueCapacity tracks the maximum capacity of the queue.
	// Value is -1 for unlimited queues.
	MetricQueueCapacity = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespaceQueue,
		Name:      "queue_capacity",
		Help:      "Maximum capacity of the queue (-1 for unlimited).",
	}, []string{queueName, queueType})

	// MetricQueueDLQMessagesTotal tracks the total number of messages sent to DLQ.
	MetricQueueDLQMessagesTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_dlq_messages_total",
		Help:      "Total number of messages sent to Dead Letter Queue.",
	}, []string{queueName})

	// MetricQueueRedriveTotal tracks the total number of DLQ redrive operations.
	MetricQueueRedriveTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_redrive_total",
		Help:      "Total number of DLQ redrive operations.",
	}, []string{queueName})

	// MetricQueueRedriveSuccessfulTotal tracks successful redrive operations.
	MetricQueueRedriveSuccessfulTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_redrive_successful_total",
		Help:      "Total number of successful DLQ redrive operations.",
	}, []string{queueName})

	// MetricQueueRedriveErrorTotal tracks failed redrive operations.
	MetricQueueRedriveErrorTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceQueue,
		Name:      "queue_redrive_error_total",
		Help:      "Total number of failed DLQ redrive operations.",
	}, []string{queueName})

	// MetricQueueMessageAge tracks the age of messages when dequeued (time since creation).
	MetricQueueMessageAge = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespaceQueue,
		Name:      "queue_message_age_seconds",
		Help:      "Age of messages when dequeued (time since creation).",
		Buckets: []float64{
			0.001,
			0.01,
			0.1,
			0.5,
			1,
			5,
			10,
			30,
			60,
			300,
			600,
			1800,
			3600,
			86400,
		},
	}, []string{queueName})

	// MetricQueueEnqueueDuration tracks the duration of enqueue operations.
	MetricQueueEnqueueDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespaceQueue,
		Name:      "queue_enqueue_duration_seconds",
		Help:      "Duration of enqueue operations.",
		Buckets: []float64{
			0.00001,
			0.00005,
			0.0001,
			0.0005,
			0.001,
			0.005,
			0.01,
			0.05,
			0.1,
			0.5,
			1,
		},
	}, []string{queueName})

	// MetricQueueDequeueDuration tracks the duration of dequeue operations.
	MetricQueueDequeueDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespaceQueue,
		Name:      "queue_dequeue_duration_seconds",
		Help:      "Duration of dequeue operations.",
		Buckets: []float64{
			0.00001,
			0.00005,
			0.0001,
			0.0005,
			0.001,
			0.005,
			0.01,
			0.05,
			0.1,
			0.5,
			1,
		},
	}, []string{queueName})

	// MetricQueueConfigInfo exposes queue configuration as labels.
	// Value is always 1, configuration is exposed via labels.
	MetricQueueConfigInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespaceQueue,
		Name:      "queue_config_info",
		Help:      "Queue configuration information (value is always 1).",
	}, []string{queueName, "max_size", "max_handle_failures", "consumer_count", "callback_parallel"})
)
View Source
var (
	MetricStateStorageOperationTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceState,
		Name:      "storage_operation_total",
		Help:      "Total number of state storage operations.",
	}, []string{stateStorageType, stateStorageOperation})

	MetricStateStorageOperationErrorTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceState,
		Name:      "storage_operation_error_total",
		Help:      "Total number of failures of state storage operations.",
	}, []string{stateStorageType, stateStorageOperation})

	MetricStateStorageOperationDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespaceState,
		Name:      "storage_operation_duration_seconds",
		Help:      "Duration of handling for a storage operation.",
		Buckets: []float64{
			0.001,
			0.005,
			0.01,
			0.025,
			0.05,
			0.1,
			0.25,
			0.5,
			1,
			2.5,
			5,
			10,
			20,
			30,
			60,
			300,
		},
	}, []string{stateStorageType, stateStorageOperation})

	MetricStateSnapshotOperationTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceState,
		Name:      "snapshot_operation_total",
		Help:      "Total number of state snapshot operations.",
	}, []string{stateStorageType, stateSnapshotOperation})

	MetricStateSnapshotOperationErrorTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespaceState,
		Name:      "snapshot_operation_error_total",
		Help:      "Total number of failures of state snapshot operations.",
	}, []string{stateStorageType, stateSnapshotOperation})

	MetricStateSnapshotOperationDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespaceState,
		Name:      "snapshot_operation_duration_seconds",
		Help:      "Duration of handling for a snapshot operation.",
		Buckets: []float64{
			0.001,
			0.005,
			0.01,
			0.025,
			0.05,
			0.1,
			0.25,
			0.5,
			1,
			2.5,
			5,
			10,
			20,
			30,
			60,
			300,
		},
	}, []string{stateStorageType, stateSnapshotOperation})
)

Functions

This section is empty.

Types

type StateSnapshotOperation added in v0.2.0

type StateSnapshotOperation string
const (
	StateSnapshotOperationSnapshotStates         StateSnapshotOperation = "SnapshotStates"
	StateSnapshotOperationRevertStatesToSnapshot StateSnapshotOperation = "RevertStatesToSnapshot"
	StateSnapshotOperationGetSnapshot            StateSnapshotOperation = "GetSnapshot"
	StateSnapshotOperationGetSnapshotIDs         StateSnapshotOperation = "GetSnapshotIDs"
	StateSnapshotOperationDeleteSnapshot         StateSnapshotOperation = "DeleteSnapshot"
	StateSnapshotOperationClearSnapshots         StateSnapshotOperation = "ClearSnapshots"
)

type StateStorageOperation added in v0.2.0

type StateStorageOperation string
const (
	StateStorageOperationLoadState      StateStorageOperation = "LoadState"
	StateStorageOperationLoadAllStates  StateStorageOperation = "LoadAllStates"
	StateStorageOperationSaveStates     StateStorageOperation = "SaveStates"
	StateStorageOperationClearStates    StateStorageOperation = "ClearStates"
	StateStorageOperationClearAllStates StateStorageOperation = "ClearAllStates"
	StateStorageOperationGetStateIDs    StateStorageOperation = "GetStateIDs"
	StateStorageOperationGetStateNames  StateStorageOperation = "GetStateNames"
)

Jump to

Keyboard shortcuts

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