mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
3c616da83f
* Alerting: Refactor metrics/ngalert.go into seperate files
26 lines
615 B
Go
26 lines
615 B
Go
package metrics
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
)
|
|
|
|
type API struct {
|
|
RequestDuration *prometheus.HistogramVec
|
|
}
|
|
|
|
func NewAPIMetrics(r prometheus.Registerer) *API {
|
|
return &API{
|
|
RequestDuration: promauto.With(r).NewHistogramVec(
|
|
prometheus.HistogramOpts{
|
|
Namespace: Namespace,
|
|
Subsystem: Subsystem,
|
|
Name: "request_duration_seconds",
|
|
Help: "Histogram of requests to the Alerting API",
|
|
Buckets: prometheus.DefBuckets,
|
|
},
|
|
[]string{"method", "route", "status_code", "backend"},
|
|
),
|
|
}
|
|
}
|