-
Notifications
You must be signed in to change notification settings - Fork 2.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
[internal/filter] Add bridge from filterspan to filterottl #21054
[internal/filter] Add bridge from filterspan to filterottl #21054
Conversation
3bed2de
to
8b46134
Compare
8b46134
to
ae8a1c5
Compare
@dmitryax here is a quick benchmark comparison between The tests against
❯ go test -bench=. -run=notests --tags="" -benchmem github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter/filterspan
goos: darwin
goarch: arm64
pkg: github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter/filterspan
BenchmarkFilterspan_NewSkipExpr/service_name_match_regexp-10 4606274 247.7 ns/op 0 B/op 0 allocs/op
BenchmarkFilterspan_NewSkipExpr/service_name_match_static-10 6298548 189.9 ns/op 0 B/op 0 allocs/op
❯ go test -bench=. -run=notests --tags="" -benchmem github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter/filterspan
goos: darwin
goarch: arm64
pkg: github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter/filterspan
BenchmarkFilterspan_NewSkipExpr/service_name_match_regexp-10 3404667 336.1 ns/op 32 B/op 2 allocs/op
BenchmarkFilterspan_NewSkipExpr/service_name_match_static-10 4759767 252.1 ns/op 16 B/op 1 allocs/op Comparison using benchstat
The results show we do take a performance hit using OTTL. Both cases gain an allocation when grabbing a value from the resource attributes and the regex case gets an extra allocation since it uses StringLikeGetter to try and convert the value to a string. Personally I think the hit to performance is worth the flexibility and maintainability we gain by centralizing filtering around OTTL. @open-telemetry/collector-contrib-approvers what do you think? |
238e6f5
to
ab76ac7
Compare
With the new feature allowing converters to be used as constant booleans (#20911), we have narrowed the performance gap slightly.
The current implementation doesn't check if it needs to use |
Continued increase from removing unneeded parentheses:
|
3246557
to
7a03261
Compare
5af6615
to
79b2f84
Compare
79b2f84
to
e3ec25e
Compare
Description:
This PR adds a bridge between
filterspan.NewSkipExpr
andfilterottl.NewBoolExprForSpan
behind a feature gate. With the feature gate enabled, any component usingfilterspan.NewSkipExpr
will start using OTTL behind the scenes.Link to tracking Issue:
Related to #18643
Related to #18642
Testing:
Before adding the feature gate, all unit tests from any component using filterspan are were testing this bridge.