prometheus / prometheus/client_rust

implementations of encode_family on text & protobuf are not symmetric

Open
#272 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
606
Forks
113
Avg merge
9h 7m
Merged PRs (30d)
8

Description

For text (https://github.com/prometheus/client_rust/blob/master/src/encoding/text.rs#L387), family inheritance is prohibited by debug_assert.
But for protobuf (https://github.com/prometheus/client_rust/blob/master/src/encoding/protobuf.rs#L236), the iniheritantce is allowed.

Is there any special consideration? I found these when i was implementing a custom metric which would extend its own families under another prometheus_client::metrics::family::Family context.

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

Compare the encode_family implementations at src/encoding/text.rs:387 and src/encoding/protobuf.rs:236, focusing on their different handling of family inheritance. Determine the intended behavior for custom metrics extending families under another Family context, then verify the chosen behavior with relevant repository tests. Done means the two encoders have consistent, justified behavior and the discrepancy is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.