2b254ed623
* Zanzana: Add metrics to server side * Zanzana: Collect check duration * add metrics for other methods
32 lines
830 B
Go
32 lines
830 B
Go
package server
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
)
|
|
|
|
const (
|
|
metricsNamespace = "iam"
|
|
metricsSubSystem = "authz_zanzana_server"
|
|
)
|
|
|
|
type metrics struct {
|
|
// requestDurationSeconds is a summary for zanzana server request duration
|
|
requestDurationSeconds *prometheus.HistogramVec
|
|
}
|
|
|
|
func newZanzanaServerMetrics(reg prometheus.Registerer) *metrics {
|
|
return &metrics{
|
|
requestDurationSeconds: promauto.With(reg).NewHistogramVec(
|
|
prometheus.HistogramOpts{
|
|
Name: "request_duration_seconds",
|
|
Help: "Histogram for zanzana server request duration",
|
|
Namespace: metricsNamespace,
|
|
Subsystem: metricsSubSystem,
|
|
Buckets: prometheus.ExponentialBuckets(0.00001, 4, 10),
|
|
},
|
|
[]string{"method", "namespace"},
|
|
),
|
|
}
|
|
}
|