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

Use the correct instrument type while creating aysnchronous instruments #475

Conversation

hunguyenaxon
Copy link
Contributor

@hunguyenaxon hunguyenaxon commented Oct 9, 2023

The fix is for #471

While creating asynchronous instrument from synchronous one, we need to pass the correct InstrumentType instead of using the value of synchronous instance.

registerDoubleAsynchronousInstrument(type: .counter, updater: callback)
public func buildWithCallback(_ callback: @escaping (OpenTelemetryApi.ObservableDoubleMeasurement) -> Void)
-> OpenTelemetryApi.ObservableDoubleCounter {
registerDoubleAsynchronousInstrument(type: .observableCounter, updater: callback)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Main change: .counter -> .observableCounter

registerDoubleAsynchronousInstrument(type: type, updater: callback)
public func buildWithCallback(_ callback: @escaping (OpenTelemetryApi.ObservableDoubleMeasurement) -> Void)
-> OpenTelemetryApi.ObservableDoubleUpDownCounter {
registerDoubleAsynchronousInstrument(type: .observableUpDownCounter, updater: callback)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Main change: type -> . observableUpDownCounter

registerLongAsynchronousInstrument(type: type, updater: callback)
public func buildWithCallback(_ callback: @escaping (OpenTelemetryApi.ObservableLongMeasurement) -> Void)
-> OpenTelemetryApi.ObservableLongCounter {
registerLongAsynchronousInstrument(type: .observableCounter, updater: callback)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Main change: type -> . observableCounter

registerLongAsynchronousInstrument(type: type, updater: callback)
public func buildWithCallback(_ callback: @escaping (OpenTelemetryApi.ObservableLongMeasurement) -> Void)
-> OpenTelemetryApi.ObservableLongUpDownCounter {
registerLongAsynchronousInstrument(type: .observableUpDownCounter, updater: callback)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Main change: type -> . observableUpDownCounter

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Files Coverage Δ
...dk/Metrics/Stable/LongCounterMeterBuilderSdk.swift 62.50% <60.00%> (-2.21%) ⬇️
...k/Metrics/Stable/LongUpDownCounterBuilderSdk.swift 62.50% <33.33%> (ø)
.../Metrics/Stable/DoubleCounterMeterBuilderSdk.swift 0.00% <0.00%> (ø)
...Metrics/Stable/DoubleUpDownCounterBuilderSdk.swift 0.00% <0.00%> (ø)

📢 Thoughts on this report? Let us know!.

@bryce-b bryce-b merged commit dea8ace into open-telemetry:main Oct 19, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants