prometheus / prometheus/OpenMetrics

OM 2.0: Should stateset be represented in a Complex/Composite format?

Open
#310 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

OM 2.0
Dominant language
Go
Stars
2.5k
Forks
175
PR merge metrics
No merged PRs in 30d

Description

See https://github.com/prometheus/docs/pull/2679/changes#r2627250204

We are debating if stateset, represented in OM 1.0 as:

# TYPE foo stateset
foo{entity="controller",foo="a"} 1.0
foo{entity="controller",foo="bb"} 0.0
foo{entity="controller",foo="ccc"} 0.0
foo{entity="replica",foo="a"} 1.0
foo{entity="replica",foo="bb"} 0.0
foo{entity="replica",foo="ccc"} 1.0

Should be composite as histograms and summaries in 2.0 e.g.

# TYPE foo stateset
foo{entity="controller"} {states:["a":1, "bb":0, "ccc":0]}
foo{entity="replica"} {states:["a":1, "bb":0, "ccc":1]}

or

# TYPE foo stateset
foo{entity="controller"} {true:["a"], false:["bb", "ccc"]}
foo{entity="replica"} {true:["a", "ccc"], false:["bb"]}
Discussion notes
  • Otel does not have it, but some prev discussions happened to add statesets
  • ENUM is subcase
  • We don't know much about UX and usage to make clear decisions
  • Ensure integer not float for composite
  • for stateset ST not relevant/useful here as those are gauges
Pros & Cons for making it composite
Pros
  • We make it efficiency/reliable to parse (label matching to realize if it's same "sample"). Efficiency of stateset is actually a blocker for using them instead of gauges. There's a potential to reduce cardinality for large number of states.
  • Consistency with summaries and histograms
  • We don't need to have an extra rule around interleaving.
Cons
  • Readability maybe impaired (long lines) - but it's the same as histograms/summaries.
  • What you see what you query is violated unless we plan to implement composite/native stateset eventually (and change PromQL). Even if we plan, we don't know how it will look like, so it's unlikely we will figure out the right format, unless we do UX research on potential PromQL functions like state(metric, stateName) or true_states(metric)`

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 with the linked Prometheus documentation pull-request discussion and compare the OM 1.0 stateset examples with both proposed composite forms. Review the notes on cardinality, parsing, interleaving, UX, PromQL, and integer-versus-float representation; done requires a resolved format decision and documented rationale.

Written by the indexing model from the issue text.

Assessment

Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.