opentelemetry-dotnet icon indicating copy to clipboard operation
opentelemetry-dotnet copied to clipboard

[sdk-metrics] Fix a race condition when a metric is deactivated and re-activated in the same collection cycle

Open CodeBlanch opened this issue 1 year ago • 1 comments

Fixes #5907

Changes

  • Use TryUpdate instead of TryRemove when processing a removed metric so that the lookup dictionary is only modified if a new metric hasn't already been enrolled

Merge requirement checklist

  • [X] CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)

CodeBlanch avatar Oct 17 '24 20:10 CodeBlanch