Documentation
¶
Index ¶
- func PrometheusHandler() http.Handler
- type HealthStats
- type Metrics
- func (m *Metrics) DecrementActiveConns()
- func (m *Metrics) GetHealthStats() HealthStats
- func (m *Metrics) HealthHandler() http.HandlerFunc
- func (m *Metrics) HealthWSHandler() http.HandlerFunc
- func (m *Metrics) IncrementActiveConns()
- func (m *Metrics) ObserveDBLatency(seconds float64)
- func (m *Metrics) RecordIngestion(count int)
- func (m *Metrics) SetActiveConnections(n int)
- func (m *Metrics) SetDLQSize(n int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrometheusHandler ¶
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 (*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 ¶
ObserveDBLatency records a database operation latency in seconds.
func (*Metrics) RecordIngestion ¶
RecordIngestion increments the ingestion counter by the given batch size.
func (*Metrics) SetActiveConnections ¶
SetActiveConnections updates the active WebSocket connection gauge.
func (*Metrics) SetDLQSize ¶
SetDLQSize updates the DLQ size gauge.