The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/services/auth/idimpl/metrics.go

56 lines
1.7 KiB

package idimpl
import (
"github.com/prometheus/client_golang/prometheus"
)
const (
metricsNamespace = "grafana"
metricsSubSystem = "idforwarding"
)
func newMetrics(reg prometheus.Registerer) *metrics {
m := &metrics{
tokenSigningCounter: prometheus.NewCounter(prometheus.CounterOpts{
Namespace: metricsNamespace,
Subsystem: metricsSubSystem,
Name: "idforwarding_token_signing_total",
Help: "Number of token signings",
}),
tokenSigningFromCacheCounter: prometheus.NewCounter(prometheus.CounterOpts{
Namespace: metricsNamespace,
Subsystem: metricsSubSystem,
Name: "idforwarding_token_signing_from_cache_total",
Help: "Number of signed tokens retrieved from cache",
}),
failedTokenSigningCounter: prometheus.NewCounter(prometheus.CounterOpts{
Namespace: metricsNamespace,
Subsystem: metricsSubSystem,
Name: "idforwarding_failed_token_signing_total",
Help: "Number of failed token signings",
}),
tokenSigningDurationHistogram: prometheus.NewHistogram(prometheus.HistogramOpts{
Namespace: metricsNamespace,
Subsystem: metricsSubSystem,
Name: "idforwarding_token_signing_duration_seconds",
Help: "Histogram of token signing duration",
Buckets: []float64{0.1, 0.25, 0.5, 1, 2, 5, 10},
}),
}
if reg != nil {
reg.MustRegister(m.tokenSigningCounter)
reg.MustRegister(m.tokenSigningFromCacheCounter)
reg.MustRegister(m.failedTokenSigningCounter)
reg.MustRegister(m.tokenSigningDurationHistogram)
}
return m
}
type metrics struct {
tokenSigningCounter prometheus.Counter
tokenSigningFromCacheCounter prometheus.Counter
failedTokenSigningCounter prometheus.Counter
tokenSigningDurationHistogram prometheus.Histogram
}