client_rust icon indicating copy to clipboard operation
client_rust copied to clipboard

Escaping?

Open blckngm opened this issue 2 years ago • 3 comments

Shouldn't help strings and label values be escaped?

https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#escaping

blckngm avatar Jun 07 '23 05:06 blckngm

Good point @blckngm. Thanks for reporting. Yes.

I wonder whether we should actively escape them or simply panic (in debug mode!) when they are not escaped. Preference for the latter.

Do you want to provide a patch @blckngm?

mxinden avatar Jun 09 '23 03:06 mxinden

Escaping them on encoding, writing one character at a time, shouldn't have much performance penalty as long as the writer is buffered.

blckngm avatar Jun 10 '23 05:06 blckngm

Fine with escaping one character at a time as long as we have an accompanying benchmark that proves that this is not a performance bottleneck.

mxinden avatar Jul 10 '23 08:07 mxinden