sdk/metric: Refactor pipeline and observable measures #5946
Labels
area:metrics
Part of OpenTelemetry Metrics
enhancement
New feature or request
help wanted
Extra attention is needed
pkg:SDK
Related to an SDK package
Do we need to lock around this? It would be good to ensure our parallel tests Invoke a callback in parallel with RegisterCallbacks
Originally posted by @dashpole in #5900 (comment)
I spend literally more than half an hour to figure out the same thing. I think we could refactor the code to make it cleaner or more readable. Maybe we should have a
[]aggregate.Measure[N]
field intype observable[N int64 | float64] struct
? Yet, I find it is out of the scope for this PR as I do not think it would be an easy task and having a fix is critical. Making a refactoring with the tests and working functionality would also be an easier task.However, can we at least add comments that there is no race condition when accessing
p.float64Measures
andp.int64Measures
as the pipeline is already locked bypipeline.Produce
? Should we create a follow-up refactoring issue? @pree-dew what are your thoughts here? I do not want to block you.Side note: I guess it is possible to achieve race conditions, but these would be in cases of bad usage of the Metrics API.
Originally posted by @pellared in #5900 (comment)
The text was updated successfully, but these errors were encountered: