diff --git a/metrics/prometheus/config.go b/metrics/prometheus/config.go index f022823..0f121f0 100644 --- a/metrics/prometheus/config.go +++ b/metrics/prometheus/config.go @@ -3,8 +3,8 @@ package prometheus import "github.com/prometheus/client_golang/prometheus" type Config struct { - // Prefix is the prefix that will be set on the metrics, by default it will be empty. - Prefix string + // Namespace is the prefix that will be set on the metrics, by default it will be empty. + Namespace string // DurationBuckets are the buckets used by Prometheus for the HTTP request duration metrics, // by default uses Prometheus default buckets (from 5ms to 10s). DurationBuckets []float64 diff --git a/metrics/prometheus/recorder.go b/metrics/prometheus/recorder.go index 33268c5..12fe52d 100644 --- a/metrics/prometheus/recorder.go +++ b/metrics/prometheus/recorder.go @@ -45,21 +45,21 @@ func NewRecorder(config Config) *Recorder { return &Recorder{ httpRequestDurHistogram: prometheus.NewHistogramVec(prometheus.HistogramOpts{ - Namespace: config.Prefix, + Namespace: config.Namespace, Subsystem: "http", Name: "request_duration_seconds", Help: "The latency of the HTTP requests (in seconds).", Buckets: config.DurationBuckets, }, []string{config.IdentifierLabel, config.MethodLabel, config.StatusCodeLabel}), httpResponseSizeHistogram: prometheus.NewHistogramVec(prometheus.HistogramOpts{ - Namespace: config.Prefix, + Namespace: config.Namespace, Subsystem: "http", Name: "response_size_bytes", Help: "The size of the HTTP responses (in bytes).", Buckets: config.SizeBuckets, }, []string{config.IdentifierLabel, config.MethodLabel, config.StatusCodeLabel}), httpRequestsInflight: prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: config.Prefix, + Namespace: config.Namespace, Subsystem: "http", Name: "requests_inflight", Help: "The number of inflight requests being handled at the same time.",