PHASE-8: Instrumenting #9
33
internal/metrics/metrics.go
Normal file
33
internal/metrics/metrics.go
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
package metrics
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ActiveConnections = promauto.NewGauge(prometheus.GaugeOpts{
|
||||||
|
Name: "wisdom_active_connections",
|
||||||
|
Help: "Number of currently active TCP connections",
|
||||||
|
})
|
||||||
|
|
||||||
|
RequestsTotal = promauto.NewCounter(prometheus.CounterOpts{
|
||||||
|
Name: "wisdom_requests_total",
|
||||||
|
Help: "Total number of requests processed",
|
||||||
|
})
|
||||||
|
|
||||||
|
RequestErrors = promauto.NewCounterVec(prometheus.CounterOpts{
|
||||||
|
Name: "wisdom_request_errors_total",
|
||||||
|
Help: "Total number of request errors by type",
|
||||||
|
}, []string{"error_type"})
|
||||||
|
|
||||||
|
RequestDuration = promauto.NewHistogram(prometheus.HistogramOpts{
|
||||||
|
Name: "wisdom_request_duration_seconds",
|
||||||
|
Help: "Time taken to process requests",
|
||||||
|
})
|
||||||
|
|
||||||
|
QuotesServed = promauto.NewCounter(prometheus.CounterOpts{
|
||||||
|
Name: "wisdom_quotes_served_total",
|
||||||
|
Help: "Total number of quotes successfully served to clients",
|
||||||
|
})
|
||||||
|
)
|
||||||
Loading…
Reference in a new issue