metrics

package
v0.16.2 Latest Latest
Warning

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

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

Documentation

Overview

Package metrics holds configuration and middleware for prometheus style metrics

Index

Constants

This section is empty.

Variables

View Source
var (
	WorkerExecutions = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "worker_executions_count",
		Help: "The number of worker executions completed",
	}, []string{"name"})
	WorkerExecutionErrors = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "worker_execution_errors_count",
		Help: "The number of worker execution errors",
	}, []string{"name"})
	Logins = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "logins_count",
		Help: "The number of logins",
	}, []string{"success"})

	Registrations = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "registrations_count",
		Help: "The number of registrations",
	})
	QueueTasksPushed = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "queue_tasks_pushed_total",
		Help: "The number of tasks pushed to queue",
	}, []string{"queue", "task"})
	QueueTasksPushFailures = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "queue_tasks_pushed_failures_total",
		Help: "The number of errors pushing a task to the queue",
	}, []string{"queue", "task"})

	QueueTasksProcessed = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "queue_tasks_processed_total",
		Help: "The number of tasks processed by the consumer",
	}, []string{"task"})
	QueueTasksProcessedErrors = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "queue_tasks_processed_errors_total",
		Help: "The number of errors encountered by the consumer",
	}, []string{"task"})
	QueueTasksProcessedDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Name: "queue_tasks_processed_duration_seconds",
		Help: "The length of time taken for a task to be processed in seconds",
	}, []string{"task"})

	APIMetrics = []prometheus.Collector{
		WorkerExecutions,
		WorkerExecutionErrors,
		Logins,
		Registrations,
		QueueTasksPushed,
		QueueTasksPushFailures,
	}

	QueueConsumerMetrics = []prometheus.Collector{
		QueueTasksProcessedDuration,
		QueueTasksProcessed,
		QueueTasksProcessedErrors,
	}
)

These variables are stubs for now ad will be added throughout the codebase

Functions

This section is empty.

Types

type Metrics

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

Metrics struct holds a distinct echo instance to report system metrics

func New

func New(port string) *Metrics

New creates a new Metrics instance

func (*Metrics) Register

func (m *Metrics) Register(metrics []prometheus.Collector) error

Register registers metrics to the default registry

func (*Metrics) Start

func (m *Metrics) Start(ctx context.Context) error

Start starts the metrics server

func (*Metrics) Stop

func (m *Metrics) Stop(ctx context.Context) error

Stop stops the metrics server

Jump to

Keyboard shortcuts

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