2222# include < unordered_set>
2323# include < vector>
2424
25- # include " opentelemetry/common/spin_lock_mutex.h"
2625# include " opentelemetry/sdk/common/global_log_handler.h"
2726# include " opentelemetry/sdk/metrics/aggregation/aggregation.h"
2827# include " opentelemetry/sdk/metrics/data/exemplar_data.h"
@@ -47,7 +46,7 @@ bool SyncMetricStorage::Collect(CollectorHandle *collector,
4746 std::shared_ptr<AttributesHashMap> delta_metrics = nullptr ;
4847#ifdef OPENTELEMETRY_HAVE_METRICS_BOUND_INSTRUMENTS_PREVIEW
4948 // Snapshot of bound entries (under map lock) that we will rotate without
50- // holding the map lock. Each entry has its own spinlock for the swap.
49+ // holding the map lock. Each entry has its own mutex for the swap.
5150 std::vector<std::shared_ptr<BoundEntry>> entry_snapshot;
5251#endif
5352 {
@@ -66,7 +65,7 @@ bool SyncMetricStorage::Collect(CollectorHandle *collector,
6665 bool can_erase = false ;
6766 if (it->second .use_count () == 1 )
6867 {
69- std::lock_guard<opentelemetry::common::SpinLockMutex > g (it->second ->lock_ );
68+ std::lock_guard<std::mutex > g (it->second ->lock_ );
7069 can_erase = !it->second ->dirty_ ;
7170 }
7271 if (can_erase)
@@ -95,15 +94,15 @@ bool SyncMetricStorage::Collect(CollectorHandle *collector,
9594 }
9695
9796#ifdef OPENTELEMETRY_HAVE_METRICS_BOUND_INSTRUMENTS_PREVIEW
98- // Rotate dirty bound entries: under each entry's own spinlock , swap out the
97+ // Rotate dirty bound entries: under each entry's own mutex , swap out the
9998 // current aggregation and merge it into delta_metrics so bound + unbound
10099 // writes for the same post-filter attribute set produce one datapoint.
101100 for (auto &entry : entry_snapshot)
102101 {
103102 std::unique_ptr<Aggregation> rotated;
104103 MetricAttributes attrs_copy;
105104 {
106- std::lock_guard<opentelemetry::common::SpinLockMutex > g (entry->lock_ );
105+ std::lock_guard<std::mutex > g (entry->lock_ );
107106 if (!entry->dirty_ )
108107 {
109108 continue ;
@@ -160,7 +159,7 @@ bool SyncMetricStorage::Collect(CollectorHandle *collector,
160159 // satisfy the documented invariant on dirty_.
161160 bool entry_dirty = false ;
162161 {
163- std::lock_guard<opentelemetry::common::SpinLockMutex > g (it->second ->lock_ );
162+ std::lock_guard<std::mutex > g (it->second ->lock_ );
164163 entry_dirty = it->second ->dirty_ ;
165164 }
166165 if (entry_dirty)
@@ -228,7 +227,7 @@ void SyncMetricStorage::BoundEntry::RecordLong(int64_t value) noexcept
228227 " is not long" );
229228 return ;
230229 }
231- std::lock_guard<opentelemetry::common::SpinLockMutex > guard (lock_);
230+ std::lock_guard<std::mutex > guard (lock_);
232231 current_->Aggregate (value);
233232 dirty_ = true ;
234233}
@@ -242,7 +241,7 @@ void SyncMetricStorage::BoundEntry::RecordDouble(double value) noexcept
242241 " is not double" );
243242 return ;
244243 }
245- std::lock_guard<opentelemetry::common::SpinLockMutex > guard (lock_);
244+ std::lock_guard<std::mutex > guard (lock_);
246245 current_->Aggregate (value);
247246 dirty_ = true ;
248247}
0 commit comments