Skip to content

Commit 6888028

Browse files
committed
Update InstrumentationManager.kt
1 parent dcc82b4 commit 6888028

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sdk/@launchdarkly/observability-android/lib/src/main/kotlin/com/launchdarkly/observability/client/InstrumentationManager.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import kotlinx.coroutines.CoroutineScope
4747
import kotlinx.coroutines.Dispatchers
4848
import kotlinx.coroutines.SupervisorJob
4949
import kotlinx.coroutines.launch
50+
import java.util.concurrent.ConcurrentHashMap
5051
import java.util.concurrent.TimeUnit
5152

5253
/**
@@ -94,10 +95,10 @@ class InstrumentationManager(
9495
private var spanProcessor: BatchSpanProcessor? = null
9596
private var logProcessor: BatchLogRecordProcessor? = null
9697
private var metricsReader: PeriodicMetricReader? = null
97-
private val gaugeCache = mutableMapOf<String, DoubleGauge>()
98-
private val counterCache = mutableMapOf<String, LongCounter>()
99-
private val histogramCache = mutableMapOf<String, DoubleHistogram>()
100-
private val upDownCounterCache = mutableMapOf<String, LongUpDownCounter>()
98+
private val gaugeCache = ConcurrentHashMap<String, DoubleGauge>()
99+
private val counterCache = ConcurrentHashMap<String, LongCounter>()
100+
private val histogramCache = ConcurrentHashMap<String, DoubleHistogram>()
101+
private val upDownCounterCache = ConcurrentHashMap<String, LongUpDownCounter>()
101102

102103
//TODO: Evaluate if this class should have a close/shutdown method to close this scope
103104
private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())

0 commit comments

Comments
 (0)