Skip to content

Commit 9b22ab8

Browse files
authored
Merge pull request #21 from instana/multiprocessing_support
Add handle_fork function for eventual pid change detection
2 parents c60b42e + d74a616 commit 9b22ab8

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

instana/meter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def process(self):
134134
ss = None
135135
cm = self.collect_metrics()
136136

137-
if self.snapshot_countdown == 0:
137+
if self.snapshot_countdown < 1:
138138
self.snapshot_countdown = self.SNAPSHOT_PERIOD
139139
ss = self.collect_snapshot()
140140
md = copy.deepcopy(cm).delta_data(None)

instana/sensor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ def configure_service_name(self):
3131

3232
if len(self.service_name) == 0:
3333
self.service_name = os.path.basename(__file__)
34+
35+
def handle_fork(self):
36+
self.agent = a.Agent(self)
37+
self.meter = m.Meter(self)

instana/tracer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ def extract(self, format, carrier):
8585
else:
8686
raise ot.UnsupportedFormatException()
8787

88+
def handle_fork(self):
89+
self.sensor.handle_fork()
90+
self.recorder = r.InstanaRecorder(self.sensor)
91+
8892

8993
def init(options):
9094
ot.tracer = InstanaTracer(options)

0 commit comments

Comments
 (0)