Skip to content

Can we infer the legend metricTag for a single timeSeries as well as multiple?

Can we infer the legend metricTag for a single timeSeries as well as multiple?

Further details

We currently deploy 6 services with a primary service using helm charts. The 6 services are specified in requirements.yaml, but we use the same app label for all of the services so we can see prometheus metrics from all services for that environment in a single location without having to use something like Grafana.

We use semver for all of our services and auto deploy, so it is useful to show the service name and the service version in the legend and the tooltip for our custom metrics.

Currently, if there is more than one timeSeries returned in the response for a query, the legend label uses the first metric label as seen in (https://gitlab.com/gitlab-org/gitlab-ee/blob/master/app/assets/javascripts/monitoring/utils/multiple_time_series.js#L88).

Proposal

It would be extremely useful to use that same logic when there is only a single timeSeries returned. The other option I've seen is to actually specify the legend title in the metric configuration. That doesn't work for this situation since it appears to be just static text.

Maybe we could infer the metricTag for a single series just like it is done for multiple series if the legend title is not specified when configuring custom metrics?

I would be happy to give implementation a shot if this is something ya'll might be interested in.

What does success look like, and how can we measure that?

Being able to use dynamic labels for the legend of a graph on an environment's metrics page.

Links / references

Thanks! <3