@@ -4,6 +4,8 @@ import OpenTelemetrySdk
44import  StdoutExporter
55import  OpenTelemetryProtocolExporterHttp
66
7+ import  UIKit. UIWindow
8+ 
79import  API
810import  Interfaces
911import  Common
@@ -26,6 +28,7 @@ public final class InstrumentationManager {
2628    private  var  cachedLongCounters =  AtomicDictionary < String ,  LongCounter > ( ) 
2729    private  var  cachedHistograms =  AtomicDictionary < String ,  DoubleHistogram > ( ) 
2830    private  var  cachedUpDownCounters =  AtomicDictionary < String ,  DoubleUpDownCounter > ( ) 
31+     private  let  lock :  NSLock  =  NSLock ( ) 
2932
3033    public  init ( sdkKey:  String ,  options:  Options ,  sessionManager:  SessionManager )  { 
3134        self . sdkKey =  sdkKey
@@ -143,8 +146,23 @@ public final class InstrumentationManager {
143146        self . otelMeter =  OpenTelemetry . instance. meterProvider. get ( 
144147            name:  options. serviceName
145148        ) 
149+ 
150+ //        Task { @MainActor [weak self] in
151+ //            for await touchEvent in TapHandler.stream() {
152+ //                print("touch event: \(touchEvent)")
153+ //                var attributes = [String: AttributeValue]()
154+ //                attributes["screen.name"] = .string(touchEvent.viewName)
155+ //                attributes["target.id"] = .string(touchEvent.accessibilityIdentifier ?? touchEvent.viewName)
156+ //                // sending location in points (since it is preferred over pixels)
157+ //                attributes["position.x"] = .string(touchEvent.locationInPoints.x.toString())
158+ //                attributes["position.y"] = .string(touchEvent.locationInPoints.y.toString())
159+ //                self?.startSpan(name: "", attributes: attributes)
160+ //            }
161+ //        }
146162    } 
147163
164+     // MARK: - Instrumentation
165+     
148166    func  recordMetric( metric:  Metric )  { 
149167        var  gauge  =  cachedGauges [ metric. name] 
150168        if  gauge ==  nil  { 
0 commit comments