-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Improve tailer matching by using the index. #3090
Conversation
``` ❯ benchcmp before.txt after benchmark old ns/op new ns/op delta Benchmark_instance_addNewTailer-16 537731 1479 -99.72% benchmark old allocs new allocs delta Benchmark_instance_addNewTailer-16 244 3 -98.77% benchmark old bytes new bytes delta Benchmark_instance_addNewTailer-16 22098 121 -99.45% ``` Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #3090 +/- ##
==========================================
+ Coverage 62.86% 62.91% +0.04%
==========================================
Files 186 186
Lines 15949 15951 +2
==========================================
+ Hits 10026 10035 +9
+ Misses 4996 4986 -10
- Partials 927 930 +3
|
pkg/ingester/tailer.go
Outdated
return false | ||
for _, l := range lbs { | ||
for _, matcher := range t.matchers { | ||
if l.Name == matcher.Name && !matcher.Matches(l.Value) { |
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.
This would work only if matchers
has all the label names from lbs
.
E.g if lbs
is foo=bar, env=prod
and matchers
is app=bazz
, it would return true because the condition here would be false for all the iterations and we return true at the end.
What do you think?
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.
Nice catch.
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.
Yep I'll add a test making sure we don't do this one again.
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 @sandeepsukhani's suggestion needs to be addressed then LGTM
pkg/ingester/tailer.go
Outdated
return false | ||
for _, l := range lbs { | ||
for _, matcher := range t.matchers { | ||
if l.Name == matcher.Name && !matcher.Matches(l.Value) { |
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.
Nice catch.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena cyril.tovena@gmail.com
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Checklist