chore(metrics): add benchmark for metrics#2106
Open
xuan-cao-swi wants to merge 3 commits intoopen-telemetry:mainfrom
Open
chore(metrics): add benchmark for metrics#2106xuan-cao-swi wants to merge 3 commits intoopen-telemetry:mainfrom
xuan-cao-swi wants to merge 3 commits intoopen-telemetry:mainfrom
Conversation
| spec.add_dependency 'opentelemetry-api', '~> 1.0' | ||
|
|
||
| spec.add_development_dependency 'benchmark-ipsa', '~> 0.2.0' | ||
| spec.add_development_dependency 'benchmark-ips', '~> 2.14.0' |
Contributor
There was a problem hiding this comment.
Should this not be added to the gemfile instead?
Contributor
Author
There was a problem hiding this comment.
I am ok with either put here or in gemfile
Member
There was a problem hiding this comment.
Why would it move to the Gemfile?
robbkidd
reviewed
Apr 24, 2026
| Ex = OpenTelemetry::SDK::Metrics::Exemplar | ||
| Export = OpenTelemetry::SDK::Metrics::Export | ||
|
|
||
| ATTRS_MEDIUM = { 'http.method' => 'GET', 'http.status_code' => 200, 'http.route' => '/api/users' }.freeze |
Member
There was a problem hiding this comment.
This is only used in attributes_bench.rb (where ATTRS_NONE, ATTRS_SMALL, and ATTRS_LARGE are defined). Should this move there, too?
Contributor
Author
There was a problem hiding this comment.
moved to helper
robbkidd
reviewed
Apr 24, 2026
Comment on lines
+9
to
+17
| def counter_with(exemplar_filter:, exemplar_reservoir: nil) | ||
| meter = build_sdk_meter(exemplar_filter: exemplar_filter) | ||
| meter.create_counter('bench.exemplar.counter', exemplar_reservoir: exemplar_reservoir) | ||
| end | ||
|
|
||
| def histogram_with(exemplar_filter:, exemplar_reservoir: nil) | ||
| meter = build_sdk_meter(exemplar_filter: exemplar_filter) | ||
| meter.create_histogram('bench.exemplar.histogram', exemplar_reservoir: exemplar_reservoir) | ||
| end |
Member
There was a problem hiding this comment.
It looks like counter_with and histogram_with are identical here in exemplar_filter_bench.rb and in exemplar_reservoir_bench.rb. Could these move to the bench_helper?
(I also notice that histogram_with isn't used in this benchmark.)
robbkidd
reviewed
Apr 24, 2026
robbkidd
reviewed
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Inspired by api/benchmarks, and use native
benchmark-ipsinstead ofbenchmark-ipsa