File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 44import opentracing
55import instana .options as o
66import instana .sensor as s
7+ import instana .log as ilog
78
89from basictracer .context import SpanContext
910from basictracer .span import BasicSpan
1011from instana .util import generate_id
1112
13+ # In case a user or app creates multiple tracers, we limit to just
14+ # one sensor per process otherwise metrics collection is duplicated,
15+ # triplicated etc.
16+ gSensor = None
17+
1218
1319class InstanaTracer (BasicTracer ):
1420 sensor = None
1521
1622 def __init__ (self , options = o .Options ()):
17- self .sensor = s .Sensor (options )
23+ global gSensor
24+ if gSensor is None :
25+ self .sensor = s .Sensor (options )
26+ gSensor = self .sensor
27+ else :
28+ self .sensor = gSensor
1829 super (InstanaTracer , self ).__init__ (
1930 r .InstanaRecorder (self .sensor ), r .InstanaSampler ())
2031
You can’t perform that action at this time.
0 commit comments