Skip to content
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

Add benchmarks to otelslog #5330

Merged
merged 4 commits into from
Mar 29, 2024
Merged

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Mar 28, 2024

Part of #5195

Benchmarks

goos: linux
goarch: amd64
pkg: go.opentelemetry.io/contrib/bridges/otelslog
cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
                                          │   out.txt   │
                                          │   sec/op    │
Handler/Handle-8                            67.78n ± 5%
Handler/WithAttrs/5-8                       331.8n ± 2%
Handler/WithAttrs/10-8                      570.6n ± 3%
Handler/WithGroup-8                         108.8n ± 6%
Handler/WithGroup.WithAttrs/5-8             443.3n ± 1%
Handler/WithGroup.WithAttrs/10-8            677.4n ± 2%
Handler/(WithGroup.WithAttrs).Handle/5-8    119.2n ± 8%
Handler/(WithGroup.WithAttrs).Handle/10-8   127.1n ± 4%
geomean                                     224.1n

                                          │   out.txt    │
                                          │     B/op     │
Handler/Handle-8                            0.000 ± 0%
Handler/WithAttrs/5-8                       264.0 ± 0%
Handler/WithAttrs/10-8                      472.0 ± 0%
Handler/WithGroup-8                         64.00 ± 0%
Handler/WithGroup.WithAttrs/5-8             328.0 ± 0%
Handler/WithGroup.WithAttrs/10-8            536.0 ± 0%
Handler/(WithGroup.WithAttrs).Handle/5-8    0.000 ± 0%
Handler/(WithGroup.WithAttrs).Handle/10-8   0.000 ± 0%
geomean                                                ¹
¹ summaries must be >0 to compute geomean

                                          │   out.txt    │
                                          │  allocs/op   │
Handler/Handle-8                            0.000 ± 0%
Handler/WithAttrs/5-8                       3.000 ± 0%
Handler/WithAttrs/10-8                      3.000 ± 0%
Handler/WithGroup-8                         2.000 ± 0%
Handler/WithGroup.WithAttrs/5-8             5.000 ± 0%
Handler/WithGroup.WithAttrs/10-8            5.000 ± 0%
Handler/(WithGroup.WithAttrs).Handle/5-8    0.000 ± 0%
Handler/(WithGroup.WithAttrs).Handle/10-8   0.000 ± 0%
geomean                                                ¹
¹ summaries must be >0 to compute geomean

JSONHandler Benchmarks

For a rough "ballpark" reference, here are the same tests against the slog.JSONHandler:

goos: linux
goarch: amd64
pkg: go.opentelemetry.io/contrib/bridges/otelslog
cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
                                              │   json.txt   │
                                              │    sec/op    │
JSONHandler/Handle-8                            359.2n ± 23%
JSONHandler/WithAttrs/5-8                       1.044µ ± 16%
JSONHandler/WithAttrs/10-8                      1.837µ ±  3%
JSONHandler/WithGroup-8                         252.7n ± 10%
JSONHandler/WithGroup.WithAttrs/5-8             1.355µ ±  1%
JSONHandler/WithGroup.WithAttrs/10-8            2.074µ ±  3%
JSONHandler/(WithGroup.WithAttrs).Handle/5-8    402.2n ±  6%
JSONHandler/(WithGroup.WithAttrs).Handle/10-8   379.6n ± 10%
geomean                                         722.9n

                                              │   json.txt   │
                                              │     B/op     │
JSONHandler/Handle-8                            0.000 ± 0%
JSONHandler/WithAttrs/5-8                       328.0 ± 0%
JSONHandler/WithAttrs/10-8                      520.0 ± 0%
JSONHandler/WithGroup-8                         168.0 ± 0%
JSONHandler/WithGroup.WithAttrs/5-8             552.0 ± 0%
JSONHandler/WithGroup.WithAttrs/10-8            680.0 ± 0%
JSONHandler/(WithGroup.WithAttrs).Handle/5-8    0.000 ± 0%
JSONHandler/(WithGroup.WithAttrs).Handle/10-8   0.000 ± 0%
geomean                                                    ¹
¹ summaries must be >0 to compute geomean

                                              │   json.txt   │
                                              │  allocs/op   │
JSONHandler/Handle-8                            0.000 ± 0%
JSONHandler/WithAttrs/5-8                       8.000 ± 0%
JSONHandler/WithAttrs/10-8                      10.00 ± 0%
JSONHandler/WithGroup-8                         3.000 ± 0%
JSONHandler/WithGroup.WithAttrs/5-8             11.00 ± 0%
JSONHandler/WithGroup.WithAttrs/10-8            12.00 ± 0%
JSONHandler/(WithGroup.WithAttrs).Handle/5-8    0.000 ± 0%
JSONHandler/(WithGroup.WithAttrs).Handle/10-8   0.000 ± 0%
geomean                                                    ¹
¹ summaries must be >0 to compute geomean

@MrAlias MrAlias added Skip Changelog Allow PR to succeed without requiring an addition to the CHANGELOG bridge: slog Related to the slog bridge labels Mar 28, 2024
@MrAlias MrAlias mentioned this pull request Mar 28, 2024
8 tasks
@MrAlias MrAlias marked this pull request as ready for review March 28, 2024 19:09
@MrAlias MrAlias requested a review from a team March 28, 2024 19:09
Copy link

codecov bot commented Mar 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.9%. Comparing base (59ebbee) to head (2ba8d28).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #5330   +/-   ##
=====================================
  Coverage   61.8%   61.9%           
=====================================
  Files        186     186           
  Lines      11388   11388           
=====================================
+ Hits        7049    7051    +2     
+ Misses      4137    4136    -1     
+ Partials     202     201    -1     

see 1 file with indirect coverage changes

@MrAlias MrAlias merged commit 3361285 into open-telemetry:main Mar 29, 2024
22 checks passed
@MrAlias MrAlias deleted the bench-otelslog branch March 29, 2024 19:58
@MrAlias MrAlias added this to the v1.25.0 milestone Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bridge: slog Related to the slog bridge Skip Changelog Allow PR to succeed without requiring an addition to the CHANGELOG
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants