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

Allow multi-instrument callbacks to be unregistered #3522

Merged
merged 18 commits into from
Dec 16, 2022

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Dec 7, 2022

Resolves #3452

  • Add a new Registration type to the metric API and have the Meter's RegisterCallback method return one.
  • Update implementations to support Registrations.

@MrAlias MrAlias added pkg:API Related to an API package pkg:SDK Related to an SDK package area:metrics Part of OpenTelemetry Metrics labels Dec 7, 2022
@MrAlias MrAlias added this to the Metric v0.35.0 milestone Dec 7, 2022
@MrAlias MrAlias changed the title All multi-instrument callbacks to be unregistered Allow multi-instrument callbacks to be unregistered Dec 7, 2022
@codecov
Copy link

codecov bot commented Dec 7, 2022

Codecov Report

Merging #3522 (5069a4f) into main (ca4cdfe) will increase coverage by 0.0%.
The diff coverage is 92.5%.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #3522   +/-   ##
=====================================
  Coverage   78.0%   78.0%           
=====================================
  Files        164     164           
  Lines      11759   11799   +40     
=====================================
+ Hits        9177    9214   +37     
- Misses      2387    2389    +2     
- Partials     195     196    +1     
Impacted Files Coverage Δ
metric/noop.go 98.0% <66.6%> (-2.0%) ⬇️
metric/internal/global/meter.go 94.8% <89.1%> (-1.6%) ⬇️
sdk/metric/meter.go 87.2% <100.0%> (+0.2%) ⬆️
sdk/metric/pipeline.go 93.9% <100.0%> (+0.2%) ⬆️
exporters/jaeger/jaeger.go 91.1% <0.0%> (+0.8%) ⬆️

Copy link
Contributor

@MadVikingGod MadVikingGod left a comment

Choose a reason for hiding this comment

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

Is there a test showing that the callback isn't called in collects after Unregister()?

sdk/metric/pipeline.go Outdated Show resolved Hide resolved
@MrAlias
Copy link
Contributor Author

MrAlias commented Dec 8, 2022

Is there a test showing that the callback isn't called in collects after Unregister()?

There is one for the global implementation. I'll add one for the SDK implementation.

MrAlias and others added 2 commits December 8, 2022 15:07
Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
@MrAlias
Copy link
Contributor Author

MrAlias commented Dec 8, 2022

Is there a test showing that the callback isn't called in collects after Unregister()?

There is one for the global implementation. I'll add one for the SDK implementation.

Added in c56c140

Copy link
Contributor

@jmacd jmacd left a comment

Choose a reason for hiding this comment

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

Cool!

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 pkg:SDK Related to an SDK package
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

Asynchronous Instrument API non-compliant with OTel Specification: callbacks cannot be unregistered
4 participants