-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: use attribute if present for json query #4458
Conversation
WalkthroughThe changes involve enhancing the log query service by adding support for dynamic field replacements in log queries and improving the parsing of string values with error handling. A new test function ensures these features work as intended, focusing on JSON field replacements within logs. These updates aim to optimize log searches, particularly when materialized columns are available, aligning with the objective to utilize such columns for JSON searches. Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- pkg/query-service/app/logs/v3/enrich_query.go (2 hunks)
- pkg/query-service/app/logs/v3/enrich_query_test.go (1 hunks)
Additional comments: 2
pkg/query-service/app/logs/v3/enrich_query.go (1)
- 185-196: The
jsonReplaceField
function is introduced to replace fields in JSON objects with their corresponding attributes. This change aligns with the PR's objective to leverage materialized columns for query optimization. However, ensure that thefields
map passed to this function is correctly populated with all possible replacements to avoid missing any optimizations.pkg/query-service/app/logs/v3/enrich_query_test.go (1)
- 459-553: The
TestJsonReplaceFieldData
struct and theTestJsonReplaceField
function are well-structured and cover a variety of scenarios, including nested JSON keys and top-level attributes. This thorough testing ensures that the new JSON replacement functionality behaves as expected across different cases. However, it's important to verify that all edge cases and potential data types are covered in these tests to ensure comprehensive validation.
I missed this. I will take a look soon. |
bumping this for review |
Summary
When a query contains a JSON filter, the PR adds the capability that if a corresponding attribute is present then it is used.
Related Issues / PR's
Fixes #3553
Affected Areas and Manually Tested Areas
Json filter in the logs explorer page is affected.
Summary by CodeRabbit