telemetry

package
v0.0.8-beta Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrometheusHandler

func PrometheusHandler() http.Handler

PrometheusHandler returns the standard Prometheus metrics handler for GET /metrics.

Types

type HealthStats

type HealthStats struct {
	IngestionRate  int64   `json:"ingestion_rate"`
	DLQSize        int64   `json:"dlq_size"`
	ActiveConns    int64   `json:"active_connections"`
	DBLatencyP99Ms float64 `json:"db_latency_p99_ms"`
}

HealthStats is the JSON response for GET /api/health.

type Metrics

type Metrics struct {
	IngestionRate     prometheus.Counter
	ActiveConnections prometheus.Gauge
	DBLatency         prometheus.Histogram
	DLQSize           prometheus.Gauge
	// contains filtered or unexported fields
}

Metrics holds all internal Prometheus metrics for Argus self-monitoring.

func New

func New() *Metrics

New creates and registers all Argus internal metrics.

func (*Metrics) DecrementActiveConns

func (m *Metrics) DecrementActiveConns()

DecrementActiveConns atomically subtracts 1 from the active connection count.

func (*Metrics) GetHealthStats

func (m *Metrics) GetHealthStats() HealthStats

GetHealthStats returns a snapshot of current telemetry values.

func (*Metrics) HealthHandler

func (m *Metrics) HealthHandler() http.HandlerFunc

HealthHandler returns an http.HandlerFunc for GET /api/health.

func (*Metrics) HealthWSHandler

func (m *Metrics) HealthWSHandler() http.HandlerFunc

HealthWSHandler returns an HTTP handler that upgrades to WebSocket and pushes HealthStats snapshots every 3 seconds. An immediate snapshot is sent on connection so the client never has to wait for the first tick.

func (*Metrics) IncrementActiveConns

func (m *Metrics) IncrementActiveConns()

IncrementActiveConns atomically adds 1 to the active connection count.

func (*Metrics) ObserveDBLatency

func (m *Metrics) ObserveDBLatency(seconds float64)

ObserveDBLatency records a database operation latency in seconds.

func (*Metrics) RecordIngestion

func (m *Metrics) RecordIngestion(count int)

RecordIngestion increments the ingestion counter by the given batch size.

func (*Metrics) SetActiveConnections

func (m *Metrics) SetActiveConnections(n int)

SetActiveConnections updates the active WebSocket connection gauge.

func (*Metrics) SetDLQSize

func (m *Metrics) SetDLQSize(n int)

SetDLQSize updates the DLQ size gauge.

Jump to

Keyboard shortcuts

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