|
1 | 1 | from basictracer import Sampler, SpanRecorder |
2 | 2 | import instana.agent_const as a |
3 | | -import thread |
| 3 | +import threading as t |
4 | 4 |
|
5 | 5 | class InstanaSpan(object): |
6 | 6 | t = 0 |
@@ -29,19 +29,16 @@ def record_span(self, span): |
29 | 29 | if not data.service: |
30 | 30 | data.service = self.sensor.service_name |
31 | 31 |
|
32 | | - thread.start_new_thread(self.sensor.agent.request, |
33 | | - (self.sensor.agent.make_url(a.AGENT_TRACES_URL), "POST", |
34 | | - [InstanaSpan(t=span.context.trace_id, |
35 | | - p=span.parent_id, |
36 | | - s=span.context.span_id, |
37 | | - ts=int( |
38 | | - round(span.start_time * 1000)), |
39 | | - d=int( |
40 | | - round(span.duration * 1000)), |
41 | | - n=self.get_string_span_log_field( |
42 | | - span, "type"), |
43 | | - f=self.sensor.agent.from_, |
44 | | - data=data)])) |
| 32 | + t.Thread(self.sensor.agent.request, |
| 33 | + args=(self.sensor.agent.make_url(a.AGENT_TRACES_URL), "POST", |
| 34 | + [InstanaSpan(t=span.context.trace_id, |
| 35 | + p=span.parent_id, |
| 36 | + s=span.context.span_id, |
| 37 | + ts=int(round(span.start_time * 1000)), |
| 38 | + d=int(round(span.duration * 1000)), |
| 39 | + n=self.get_string_span_log_field(span, "type"), |
| 40 | + f=self.sensor.agent.from_, |
| 41 | + data=data)])).start() |
45 | 42 |
|
46 | 43 | def get_string_span_log_field(self, span, field): |
47 | 44 | ret = self.get_span_log_field(span, field) |
|
0 commit comments