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

sdk/metric: Fix observable not registered error when the asynchronous instrument has a drop aggregation #4772

Merged

Conversation

scorpionknifes
Copy link
Member

@scorpionknifes scorpionknifes commented Dec 19, 2023

Resolves #4666

When an observable instrument is dropped by view drop aggregation, it prints observable instrument not registered for callback message, as the instrument isn't register due to it being dropped.

if _, registered := r.int64[oImpl.observablID]; !registered {
global.Error(errUnregObserver, "failed to record",
"name", oImpl.name,
"description", oImpl.description,
"unit", oImpl.unit,
"number", fmt.Sprintf("%T", int64(0)),
)
return
}

This PR attempts to ignore the above code by adding a flag to the observable instrument indicating it has been dropped and ignoring registered check

@scorpionknifes scorpionknifes changed the title WIP: Fix observable instrument not registered on drop aggregation sdk/metric: Fix observable not registered error during drop aggregation Dec 20, 2023
@scorpionknifes scorpionknifes marked this pull request as ready for review December 20, 2023 08:39
Copy link

codecov bot commented Dec 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (01472db) 82.3% compared to head (34653d9) 82.3%.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #4772   +/-   ##
=====================================
  Coverage   82.3%   82.3%           
=====================================
  Files        226     226           
  Lines      18406   18410    +4     
=====================================
+ Hits       15153   15157    +4     
  Misses      2969    2969           
  Partials     284     284           
Files Coverage Δ
sdk/metric/instrument.go 100.0% <ø> (ø)
sdk/metric/meter.go 92.6% <100.0%> (+<0.1%) ⬆️

sdk/metric/meter_test.go Outdated Show resolved Hide resolved
sdk/metric/meter_test.go Outdated Show resolved Hide resolved
sdk/metric/meter_test.go Outdated Show resolved Hide resolved
sdk/metric/meter_test.go Outdated Show resolved Hide resolved
sdk/metric/meter_test.go Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@scorpionknifes scorpionknifes changed the title sdk/metric: Fix observable not registered error during drop aggregation sdk/metric: Fix observable not registered error when the asynchronous instrument has a drop aggregation Dec 20, 2023
Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

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

Just nit comments.

@MrAlias @MadVikingGod @dashpole, can you check if the way how it is fixed in meter.go and instrument.go is acceptable?

sdk/metric/meter_test.go Outdated Show resolved Hide resolved
sdk/metric/meter_test.go Outdated Show resolved Hide resolved
sdk/metric/meter_test.go Outdated Show resolved Hide resolved
sdk/metric/meter.go Outdated Show resolved Hide resolved
@pellared pellared requested a review from MrAlias January 10, 2024 12:12
sdk/metric/meter.go Outdated Show resolved Hide resolved
@MrAlias MrAlias added this to the v1.22.0 milestone Jan 11, 2024
@MrAlias MrAlias merged commit 7fa7d1b into open-telemetry:main Jan 11, 2024
25 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.

view: observable instrument not registered for callback
4 participants