prometheus / prometheus/client_ruby

Decision needed: Should we allow deleting a labelset from an existing metric?

Open
#140 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
558
Forks
154
PR merge metrics
No merged PRs in 30d

Description

This issue comes from this recently closed PR.

I'll try to summarize the situation here, but I encourage to read the discussion on that PR.

Basically, the question is whether we should allow deletion of a labelset for a metric that's observed values on that labelset.

Reasons for doing it:

  • Removing stale metrics
  • Example use case: Exporting metrics about containers running on a host, with container identifier as a guid that is part of the label set. Containers disappear after being terminated by our cluster manager and we'd like the related metrics to disappear as well.
  • The best practices actually say this should be a feature: Metrics with labels SHOULD support a remove() method with the same signature as labels() that will remove a Child from the metric no longer exporting it

Reasons against:

  • This should be done using const metrics, as supported by the Go/Python/Java do. See https://www.robustperception.io/setting-a-prometheus-counter/. Maybe we need to add this instead to the client
  • That bit of the best practices quoted above likely needs some reconsidering. There are use cases for this, but they're very very rare. Mostly the people looking for this actually want const metrics.
  • This is actually quite involved to implement with our new file-based Data Store. This is not really a reason not to do this, but it's a cost that is good to keep in mind. The new implementation is considerably harder than the code change in the PR linked above.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the discussion in the recently closed PR #80 and compare its arguments with the use cases and file-based Data Store concerns summarized here. Done means reaching and recording a decision on whether observed labelsets may be deleted, or whether const metrics should be preferred instead.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.