-
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
Open
cstyan
wants to merge
5
commits into
main
Choose a base branch
from
callum-pipeline-sanitize-sm-values
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Callum Styan <[email protected]>
cstyan
changed the title
sanitize structured metadata values during query time in pipeline code
fix: sanitize structured metadata values during query time in pipeline code
Nov 26, 2024
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]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.