Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change config prefix to namespace #10

Merged
merged 1 commit into from
Sep 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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