-
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
JSON label extraction field validation expression overly strict #6372
JSON label extraction field validation expression overly strict #6372
Conversation
65caa24
to
711a372
Compare
./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell. + ingester 0%
+ distributor 0%
+ querier 0%
+ querier/queryrange 0%
+ iter 0%
+ storage 0%
+ chunkenc 0%
+ logql 0%
+ loki 0% |
772a5dc
to
3cff1d0
Compare
./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell. + ingester 0%
+ distributor 0%
+ querier 0%
+ querier/queryrange 0%
+ iter 0%
+ storage 0%
+ chunkenc 0%
+ logql 0%
+ loki 0% |
…ot at the start) Also simplified logic
I'm not certain why the tests I added don't fail (without the fix). None the less they extend the test suite. I've found what I beleive to be the issue and have gone about fixing it. |
./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell. + ingester 0%
+ distributor 0%
+ querier 0%
+ querier/queryrange 0%
+ iter 0%
+ storage 0%
+ chunkenc 0%
+ logql 0%
+ loki 0% |
Confirmed fix of discovered issue with 6cdbaec |
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.
Thanks for the contribution. Looks good to me! I think this change deserves a changelog entry :)
We should investigate this before we merge :) |
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.
Thanks for the contribution @splitice - this looks great.
The reason why you can't replicate the issue in pkg/logql/syntax/parser_test.go
is that it doesn't actually invoke the JSONExpressionParser
I believe, it merely parses the expression.
You'll need a test in pkg/logql/log/jsonexpr/jsonexpr_test.go
which will expose the issue:
I added
{
"identifier with number",
`utf8`,
[]interface{}{"utf8"},
nil,
},
under TestJSONExpressionParser
and was able to replicate the issue and confirm your fix.
@dannykopping I figured it was something like that. Unfortunately had production to fix and it was easier to just test the known failing query against a build. I'll integrate feedback and that test case. |
@dannykopping @chaudum review feedback integrated & resosolved merge conflicts |
./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell. + ingester 0%
- distributor -0.3%
+ querier 0%
+ querier/queryrange 0%
+ iter 0%
+ storage 0%
+ chunkenc 0%
+ logql 0%
+ loki 0% |
./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell. + ingester 0%
+ distributor 0%
+ querier 0%
+ querier/queryrange 0%
+ iter 0%
+ storage 0%
+ chunkenc 0%
+ logql 0%
+ loki 0.7% |
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
What this PR does / why we need it:
A valid query started to fail. I can't share the exact query as it was from production, but the error message (slightly adjusted) is as follows).
Afer some experimentation the problem was found to be the number in the fields. Strangely it only affects some queries that use json fields.
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
.docs/sources/upgrading/_index.md