Skip to content

Conversation

alex
Copy link

@alex alex commented Aug 19, 2025

this is a pre-req for #601, because native histograms are only supported with protobufs

in addition to the unit tests, I also ran the server example with a local prometheus configured to only talk protobuf and confirmed that metrics flowed.

unfortunately, this format is not well documented so I made some reasonable inferences, but wasn't positive about many things, so a close eye is appreciated!

@alex
Copy link
Author

alex commented Aug 26, 2025

Looks like there's some clippy issues, will fix those this evening!

@alex alex force-pushed the prometheus-protobuf-format branch 3 times, most recently from 01db2f9 to 69a470b Compare August 26, 2025 22:15
@alex
Copy link
Author

alex commented Aug 26, 2025

Ok, clippy issues should be resolved!

@alex
Copy link
Author

alex commented Aug 30, 2025

Is a maintainer able to set the option on the repo so that new contributor's CI runs don't need to be explicitly approved?


// Process counters
for (name, by_labels) in &snapshot.counters {
let sanitized_name = sanitize_metric_name(name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a general note: we might need to/want to evaluate, as part of a future PR, relaxing this sanitization since I think full UTF-8 metric names/tags are allowed for the Protobuf payloads? (and the text format, if you use a recent enough version and escape properly, yadda yadda)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably none of that escaping is required for the protobuf format. I'm happy to drop if you'd like? These lines were not added with a ton of thought :-/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine for now since it matches the existing behavior and it can always be removed later. More just noting it out loud in case people stumble through and say "hey, why it is it sanitizing my metrics like this with protobuf?"

@tobz
Copy link
Member

tobz commented Sep 2, 2025

Is a maintainer able to set the option on the repo so that new contributor's CI runs don't need to be explicitly approved?

It's explicitly set this way due to the potential for exploits to be invoked through automatically running CI against untrusted changes in PRs. I can appreciate that it makes it harder to iterate on CI-related fixes, but I don't want to want to have to think any harder than absolutely necessary about repo security, so this is how it stays. 😅

@alex
Copy link
Author

alex commented Sep 2, 2025

(Will look at any review feedback after work, Thanks!)

this is a pre-req for metrics-rs#601, because native histograms are only supported with protobufs
@alex alex force-pushed the prometheus-protobuf-format branch from 69a470b to ed7ac98 Compare September 2, 2025 21:48
@alex
Copy link
Author

alex commented Sep 2, 2025

FWIW, based on my experience maintaining other OSS projects, I think the best way to handle that is to ensure that all jobs that run on pull_request envs don't require any secrets or do anything destructive, so that the worst thing anyone can do is waste resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants