Skip to content

Commit

Permalink
change config prefix to namespace (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
instabledesign authored Sep 6, 2019
1 parent 2baf857 commit 3dd738e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions metrics/prometheus/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions metrics/prometheus/recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

0 comments on commit 3dd738e

Please sign in to comment.