RubySampler: allow specifying metrics prefix
What does this MR do and why?
This is a follow up to #344629 (closed), with an explanation for why we're doing this in #344629 (comment 814880935)
(copying here)
I noticed a problem with !76553 (merged); the RubySampler
metrics emitted by this change use the same name as the sampler instances running in Sidekiq and Puma; that's OK as long as there is a label that discriminates samples from one another. Typically we use the pid
label for this, however, this label is only rendered by prometheus-client-mmap
's text renderer if:
- the metric is a
gauge
withall
aggregation (i.e. per-process samples should not be merged); this is the default for agauge
, and applies to almost allRubySampler
metrics - a
pid
label is added explicitly to a metric
Since we do not currently do this for the GC durations histogram, its samples are indistinguishable from Puma or Sidekiq samples, since the exporter runs in the same container and is scraped as part of the same Prometheus job
.
I suggest to fix this by renaming the exporter metrics to (exporter)_ruby_*
instead, which is in line with what we did in #348942 (closed).
NOTE: This is not a typebug because self-managed is not affected by this and it is not user facing either. These metrics are currently internal to GitLab team members.
Screenshots or screen recordings
This is what metrics look like now, with an exemplary histogram metric that was affected by this:
How to set up and validate locally
See !76553 (merged)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #344629 (closed)