Skip to content

[SDK] Replace SpinLockMutex with std::mutex in the metrics library - #4416

Merged
marcalff merged 11 commits into
open-telemetry:mainfrom
dbarker:sdk_swap_spinlock_for_mutex_part_2
Aug 29, 2026
Merged

[SDK] Replace SpinLockMutex with std::mutex in the metrics library#4416
marcalff merged 11 commits into
open-telemetry:mainfrom
dbarker:sdk_swap_spinlock_for_mutex_part_2

Conversation

@dbarker

@dbarker dbarker commented Aug 11, 2026

Copy link
Copy Markdown
Member

Fixes #4317

Part 2 of #4317 to replace SpinLockMutex with std::mutex.

This PR replaces most use of the SpinLockMutex in the metrics sdk. The goal is to improve synchronization consistency across platforms and deployments by relying on the standard mutex.

Changes

  • Replaces SpinLockMutex with std::mutex in the metrics storage classes.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.23%. Comparing base (d3b1670) to head (a5e0b88).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4416      +/-   ##
==========================================
+ Coverage   83.22%   83.23%   +0.01%     
==========================================
  Files         520      520              
  Lines       20396    20396              
==========================================
+ Hits        16972    16974       +2     
+ Misses       3424     3422       -2     
Files with missing lines Coverage Δ
...telemetry/sdk/metrics/state/async_metric_storage.h 93.19% <100.00%> (ø)
...ntelemetry/sdk/metrics/state/sync_metric_storage.h 84.94% <ø> (ø)
sdk/src/metrics/state/sync_metric_storage.cc 93.69% <100.00%> (ø)
sdk/src/metrics/state/temporal_metric_storage.cc 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread sdk/include/opentelemetry/sdk/metrics/aggregation/sum_aggregation.h Outdated
@dbarker
dbarker marked this pull request as ready for review August 12, 2026 16:14
@dbarker
dbarker requested a review from a team as a code owner August 12, 2026 16:14
Comment thread sdk/src/metrics/state/sync_metric_storage.cc
@dbarker dbarker added the discuss To discuss in SIG meeting label Aug 24, 2026
@dbarker dbarker added pr:please-review This PR is ready for review and removed discuss To discuss in SIG meeting labels Aug 25, 2026

@marcalff marcalff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@marcalff
marcalff merged commit 162c04e into open-telemetry:main Aug 29, 2026
130 of 131 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:please-review This PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Replace SpinLockMutex with std::mutex where appropriate

4 participants