-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 options to measurement methods #3971
Merged
Merged
Conversation
This file contains 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
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3971 +/- ##
=======================================
+ Coverage 82.0% 82.2% +0.1%
=======================================
Files 175 175
Lines 12977 13067 +90
=======================================
+ Hits 10653 10742 +89
Misses 2104 2104
- Partials 220 221 +1
|
I like this proposal more than #3947 as it addressed two more "issues":
Also the design feel familiar with the rest of the API |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This was referenced Apr 7, 2023
MrAlias
added
pkg:API
Related to an API package
area:metrics
Part of OpenTelemetry Metrics
labels
Apr 10, 2023
MrAlias
requested review from
jmacd,
Aneurysm9,
evantorrie and
XSAM
as code owners
April 10, 2023 20:52
This comment was marked as resolved.
This comment was marked as resolved.
pellared
approved these changes
Apr 14, 2023
MadVikingGod
approved these changes
Apr 18, 2023
jmacd
reviewed
Apr 19, 2023
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.
👍
Kaushal28
pushed a commit
to infracloudio/opentelemetry-go
that referenced
this pull request
Apr 21, 2023
* Add options to measurement methods * Update noop * Update global impl * Update SDK impl * Fix metric API example * Update prometheus exporter tests * Update examples * WithAttributes and WithAttributeSet * Add changes to changelog * Accept slice instead of variadic to new conf funcs * Clarify WithAttributes performance in docs * Address feedback about WithAttributes comment * Add changelog entry for WithAttribute{s,Set} * Remove number scope from measure opts * Update changelog * Remove left-over test cases --------- Co-authored-by: Robert Pająk <[email protected]>
1 task
reenjii
added a commit
to reenjii/opentelemetry-go-extra
that referenced
this pull request
May 2, 2023
The latest opentelemetry-go release v1.15.0/v0.38.0 introduces a breaking change that breaks otelsql. We need to use new metric.WithAttributes helper to build an ObserveOption list from a KeyValue list. > The measurement methods for all instruments in go.opentelemetry.io/otel/metric/instrument accept an option instead of the variadic "go.opentelemetry.io/otel/attribute".KeyValue Latest opentelemetry-go release: open-telemetry/opentelemetry-go#4035 Breaking change: open-telemetry/opentelemetry-go#3971
This was referenced May 2, 2023
reenjii
added a commit
to reenjii/opentelemetry-go-extra
that referenced
this pull request
May 2, 2023
The latest opentelemetry-go release v1.15.0/v0.38.0 introduces a breaking change. > The measurement methods for all instruments in go.opentelemetry.io/otel/metric/instrument > accept an option instead of the variadic "go.opentelemetry.io/otel/attribute".KeyValue It breaks otelsql: we need to use new metric.WithAttributes helper to build an ObserveOption list from a KeyValue list. Latest opentelemetry-go release: open-telemetry/opentelemetry-go#4035 Breaking change: open-telemetry/opentelemetry-go#3971
reenjii
added a commit
to reenjii/opentelemetry-go-extra
that referenced
this pull request
May 3, 2023
The latest opentelemetry-go release v1.15.0/v0.38.0 introduces a breaking change. > The measurement methods for all instruments in go.opentelemetry.io/otel/metric/instrument > accept an option instead of the variadic "go.opentelemetry.io/otel/attribute".KeyValue It breaks otelsql: we need to use new metric.WithAttributes helper to build an ObserveOption list from a KeyValue list. Latest opentelemetry-go release: open-telemetry/opentelemetry-go#4035 Breaking change: open-telemetry/opentelemetry-go#3971
pmint93
added a commit
to pmint93/gofiber-contrib
that referenced
this pull request
May 9, 2023
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.
Resolves #3943
Instead of accepting only attribute slices for the measurement methods (
Add
,Record
,Observe
), accept options so these methods can be extended in the future1.WithAttributeSet(attribute.Set)
measurement option that can be passed to allAdd
,Record
, orObserve
methodsattribute.Set
for all measurement methods instead of having each method create its ownattribute.Set
for the same data.WithAttributes(...attribute.KeyValue)
for users to create an attribute set inline with the option creation.Benchmarks
Against
main
sdk/metric
These aren't really apples-to-apples comparisons given the new benchmark is for attributes wrapped in an option and the old benchmarks included allocations for reused slices. The allocation reduction should still be the same though if main were updated to wrap an option (adding an allocation) and the attribute slices were reused (removing an allocation).
Footnotes
https://github.com/open-telemetry/opentelemetry-specification/issues/3369 ↩
https://github.com/open-telemetry/opentelemetry-specification/blob/9352c2524ac03b31f4b845323b351d32ab3adb43/specification/metrics/api.md#concurrency-requirements ↩