You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suspect some clients expect the help and type metadata even though they are officially optional. I think we could add a setting so users can choose to turn them off but I don't want to make it the default.
Are you able to put together a PR to add a setting that removes them? Thanks!
@reimda thanks for looking into it. I opened a PR with such an option, disabled by default. I'm not 100% sure that's the best way of implementing it, any suggestions are welcome.
Currently, the Prometheus serializer always adds HELP and TYPE metadata:
The issue is HELP and TYPE info just adds useless paylod and increases traffic costs, especially, when operating with massive scale. According to the Prometheus exposition format, these fields are completely optional:
https://github.com/prometheus/docs/blob/main/content/docs/instrumenting/exposition_formats.md#text-format-example
Test
I generated ~1kk metrics of node-exporter in a file and tried to do some calculations:
So the "no metadata" file was roughly 45% smaller in plain text format and 35% smaller in gzip. It'd be great to have the metadata disabled.
HELP metadata
It's always a kind of "dummy" string so probably it's worth removing. It's quite easy to do since
expfmt
can skip it if it'snil
:https://github.com/prometheus/common/blob/main/expfmt/text_create.go#L96
I've tried it and it worked fine for me locally.
TYPE metadata
As I see, it's harder to have it disabled as
expfmt
doesn't support it out-of-the-box:https://github.com/prometheus/common/blob/main/expfmt/text_create.go#L123-L151
Not sure what would be the best option here.
The text was updated successfully, but these errors were encountered: