You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello OpenTelemetry friends, we've recently adopted OpenTelemetry metrics at eBay but we're experiencing an access race in HistogramMetricSdk.boundInstruments.
HistogramMetric.record is not thread-safe. Or, from an implementation perspective, HistogramMetricSdk.bind(labelSet:) is not thread safe.
MeterSdk reads boundInstruments of histograms during its collect implementation but it's possible for other threads to simultaneously write to boundInstruments while recording histogram values. This write occurs in HistogramMetricSdk.bind(labelSet:) when a new boundInstrument is added to the boundInstruments dictionary. MeterSdk uses collectLock to synchronize access to doubleHistograms but does not synchronize writes to the boundInstruments dictionary of histograms.
I've read that there is a new stable metrics implementation but the legacy implementation is fully functional so I'm wondering:
Are you open to accepting a PR to fix the synchronization issue in the legacy implementation although its replacement is in active development? I've noticed other instruments like as CounterMetricSdkBase have locks to synchronize access to boundInstruments
Is my better course of action to migrate to the new stable metrics implementation instead?
The text was updated successfully, but these errors were encountered:
Migrating to the new metric implementation would be the best course of action, but we will accept any PR fixing existing functionality.
It mainly depends in the maturity of your current implementation; if you are starting with it, I would change to the new one, if you have it already working or almost working fix the issue and plan your transition.
Hello OpenTelemetry friends, we've recently adopted OpenTelemetry metrics at eBay but we're experiencing an access race in
HistogramMetricSdk.boundInstruments
.HistogramMetric.record
is not thread-safe. Or, from an implementation perspective,HistogramMetricSdk.bind(labelSet:)
is not thread safe.MeterSdk
readsboundInstruments
of histograms during itscollect
implementation but it's possible for other threads to simultaneously write toboundInstruments
while recording histogram values. This write occurs inHistogramMetricSdk.bind(labelSet:)
when a newboundInstrument
is added to theboundInstruments
dictionary.MeterSdk
usescollectLock
to synchronize access todoubleHistograms
but does not synchronize writes to theboundInstruments
dictionary of histograms.I've read that there is a new stable metrics implementation but the legacy implementation is fully functional so I'm wondering:
CounterMetricSdkBase
have locks to synchronize access toboundInstruments
The text was updated successfully, but these errors were encountered: