-
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
perf: Gather aggregate per-line and per-tenant metrics for Drain patterns #13368
Conversation
pkg/pattern/drain/metrics.go
Outdated
return FormatUnknown | ||
} else if line[0] == '{' && line[len(line)-1] == '}' { | ||
return FormatJson | ||
} else if strings.Count(line, "=") > strings.Count(line, " ")-5 { |
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.
why -5 ?
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.
Honestly, that number is what worked against our testdata! I think this is slightly better than only checking if the string contains an =
.
If you feel strongly about making this more robust, I can rewrite it as a regex. Its only used once per stream so that shouldn't be a problem, performance wise.
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.
I think we need something a bit more robust. There could be a lot of spaces in multiple fields ?
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:
This PR adds metrics to help us understand what Drain is doing & to understand the shape of our log lines. These should better direct our efforts at improving pattern detection.