Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape label value #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

moreamazingnick
Copy link

The label values can be like any strange text so this needs to be escaped.

$output[] = $key . '="' . $value . '"';

since prometheus does not know any non numeric metric values, the metric value would not need the escape function, but I don't want to break any compatibility.

$output[] = $labelledValue['name'] . $this->encodeLabels($labelledValue['labels']) . ' ' . $this->escapeValue($labelledValue['value']);

see:
prometheus/prometheus#2227

Best Regards
Nicolas

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.

1 participant