prometheus / prometheus/client_js

Reimplement 'labels' as a derivative of the Metric instead of a closure

Open
#812 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3.5k
Forks
429
Avg merge
3d 3h
Merged PRs (30d)
22

Description

With the existence of LabelMap, there are simpler mechanisms available to give multiple callers a set of labels to apply to all metrics calls.

Problem areas:

  • copy constructor
  • reset - I already have a TODO in the code about how reset is poorly implemented, and this will need to be fixed.
  • metrics gathering - a derived metric has already had its stats reported and should return empty set

In the bargain however, this one feature addresses #777, #407, and #598 all without introducing performance regressions.

Additional Concerns

Based on conversation in #813, it would be useful for consistency with the other client implementations if, when all of the labels have been captured (full coverage versus #407's currying suggestion) that the derived gauge be initialized to 0 if it is not already in the store.

Contributor guide

No contributing guide indexed for this repository

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

No files or tests are named. Start by locating the labels implementation and LabelMap, then trace its copy constructor, reset behavior, and metrics-gathering path. Done means labels use a derived Metric without performance regressions, already-reported derived metrics return an empty set, and fully labeled gauges initialize to 0 when absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
observability-sre
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.