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

Restructure RegisterCallback method #3587

Merged
merged 5 commits into from
Jan 13, 2023

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Jan 11, 2023

Part of #3519

The RegisterCallback method is updated for ergonomic reasons to the following.

RegisterCallback(f Callback, instruments ...instrument.Asynchronous) (Registration, error)

The instruments are now passed as variadic arguments. This avoids the boilerplate of having to wrap instruments at call-time with a []instrument.Asynchronous{...} slice.

Instead of accepting instruments to register the callback with as a
slice, accept them as variadic arguments.
@MrAlias MrAlias added pkg:API Related to an API package area:metrics Part of OpenTelemetry Metrics labels Jan 11, 2023
@MrAlias MrAlias added this to the Metric v0.35.0 milestone Jan 11, 2023
@codecov
Copy link

codecov bot commented Jan 11, 2023

Codecov Report

Merging #3587 (2bd6671) into main (4286352) will not change coverage.
The diff coverage is 100.0%.

❗ Current head 2bd6671 differs from pull request most recent head 66bef3c. Consider uploading reports for the commit 66bef3c to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #3587   +/-   ##
=====================================
  Coverage   78.9%   78.9%           
=====================================
  Files        170     170           
  Lines      12460   12460           
=====================================
  Hits        9836    9836           
  Misses      2415    2415           
  Partials     209     209           
Impacted Files Coverage Δ
metric/internal/global/meter.go 95.2% <100.0%> (ø)
metric/noop.go 62.1% <100.0%> (ø)
sdk/metric/meter.go 79.3% <100.0%> (ø)

Copy link
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 This looks really nice.

@MrAlias MrAlias merged commit f941b3a into open-telemetry:main Jan 13, 2023
@MrAlias MrAlias deleted the reg-cback-varidic branch January 13, 2023 16:31
@MrAlias MrAlias mentioned this pull request Jan 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metrics Part of OpenTelemetry Metrics pkg:API Related to an API package
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants