-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
fix: sanitize structured metadata values during query time in pipeline code #15113
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Callum Styan <[email protected]>
Signed-off-by: Callum Styan <[email protected]>
@ashwanthgoli thanks for pointing out The benchmark results don't look much different, but we should at least be consistent.
|
Co-authored-by: Ashwanth <[email protected]>
Signed-off-by: Callum Styan <[email protected]>
Signed-off-by: Callum Styan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
In an earlier PR (here) we made a change to sanitize structured metadata names of disallowed characters, since when SM is added to pipeline stages in a users query the SM is turned into labels and in turned passed to Prometheus' label parser. That then results in an error if there's disallowed characters.
What we missed at the time was the same sanitization of structured metadata values. This PR sanitizes the value in the same way, replacing the invalid character with a space
. While this likely requires users to query their structured metadata with a regex filter, it's at least a workaround. Perhaps we can find a way to return a warning to the user that their query hit SM that had invalid characters, and therefore they should consider changing their
MatchEqual
toMatchRegex
if they're not seeing results.The queries in question are in the form of
{some_label="x"} | app="app_name" | line_format {{.thing}} {{.message}} |= "look for something in the content"
. I don't fully understand all the cases we have that result in SM being treated as labels, but if we do stream processing we add the SM as labels (which in turn causes them to go through prometheus label parsing) and then by adding them to the line withline_format
the contents of the SM value is then available to filter with|=
.This might also be a good time to revisit the topic of sanitizing or rejecting SM at ingestion time.