nexogen-international / Nexogen.Libraries.Metrics

Library for collecting application metrics in .NET and exporting them to Prometheus
MIT License
61 stars 9 forks source link

Label values are not escaped #18

Closed gebolze closed 6 years ago

gebolze commented 6 years ago

Based on the Prometheus documentation: https://prometheus.io/docs/instrumenting/exposition_formats/#text-format-details

metric_name and label_name have the usual Prometheus expression language restrictions. label_value can be any sequence of UTF-8 characters, but the backslash, the double-quote, and the line-feed characters have to be escaped as \, \", and \n, respectively

Actual Output:

tokens_login{username="domain\username"} 1 1510911080610

Expected Output:

tokens_login{username="domain\\username"} 1 1510911080610
ahoka commented 6 years ago

Thanks for reporting this issue. You have right, it should be escaped. Would you like to contribute a fix?