Right now most prometheus metrics are declared like this:
var requestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "src",
Subsystem: "zoekt",
Name: "request_duration_seconds",
Help: "Time (in seconds) spent on request.",
Buckets: prometheus.DefBuckets,
}, []string{"category", "code"})
However, this makes it very hard to find the metric unless you know where it is declared.
I propose we instead stop using the Namespace and Subsystem fields, and just use the Name field. I have seen other projects do this, and it makes it very easy to grep. So the above would become.
var requestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Name: "src_zoekt_request_duration_seconds",
Help: "Time (in seconds) spent on request.",
Buckets: prometheus.DefBuckets,
}, []string{"category", "code"})
Right now most prometheus metrics are declared like this:
However, this makes it very hard to find the metric unless you know where it is declared.
I propose we instead stop using the
Namespace
andSubsystem
fields, and just use theName
field. I have seen other projects do this, and it makes it very easy to grep. So the above would become.See https://github.com/sourcegraph/sourcegraph/issues/9941