-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat: update log level discovery from json to detect nested fields #16026
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
Conversation
I like the idea! You're going depth first in your implementation, I think it would make sense to go by level to reduce the memory usage? eg: I think many log formatters do keep log_level shallow, except for a few customised ones. |
💻 Deploy preview deleted. |
i think breath first search is going to incur memory-overhead, currently the parser is presenting data as it apprears - we'd encounter children first in the json line before the next sibling
👍 we could default the maxDepth to 1 to avoid any overhead |
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:
Log level discovery for json lines currently only looks at the top level fields, this helps detect
level
fields that are nested.It only does a single pass through the log line for detecting the levels using
jsonparser.ObjectEach
unlike the existing approach that calls Get for each allowed label.Note: This approach branches away from
getValueUsingJSONParser
which was common for both level and generic field detection previously and additionally supported jsonpath expressions.Which issue(s) this PR fixes:
Fixes #15822
Special notes for your reviewer:
Checklist
CONTRIBUTING.md
guide (required)feat
PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.docs/sources/setup/upgrade/_index.md
deprecated-config.yaml
anddeleted-config.yaml
files respectively in thetools/deprecated-config-checker
directory. Example PR