prometheus / prometheus/client_java
Escaping API inconsistencies
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.3k
- Forks
- 833
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 86
Description
If I understand correctly, this is approximately how I should produce an output:
expositionFormats.findWriter(accept)
.write(System.out, registry.scrape(), EscapingScheme.fromAcceptHeader(accept));
The problem with this is that the API forces me to pass the accept header twice, so theoretically I can do this:
expositionFormats.findWriter(acceptHeaderOne)
.write(System.out, registry.scrape(), EscapingScheme.fromAcceptHeader(acceptHeaderTwo));
Which can lead to inconsistencies, it is easy to misuse the API.
I'm wondering if something like this would make sense:
expositionFormats.findWriter(accept).write(System.out, registry.scrape());
and the writer would have the EscapingScheme.
The writer still can be cached but it would be a little more than today.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the expositionFormats.findWriter API, the writer's write method, and EscapingScheme.fromAcceptHeader usages in the Java client. Compare how cached writers are handled and determine how the API can avoid accepting two potentially different headers; done means the proposed usage is consistent without losing writer caching.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100