|
39 | 39 | _default_client = None |
40 | 40 | _client_lock = threading.Lock() |
41 | 41 |
|
| 42 | + |
42 | 43 | class APIBasePath: |
43 | 44 | def __init__( |
44 | 45 | self, |
@@ -73,7 +74,7 @@ def new_client( |
73 | 74 | api_base_path: Optional[APIBasePath] = None, |
74 | 75 | trace_queue_conf: Optional[QueueConf] = None, |
75 | 76 | ) -> Client: |
76 | | - cache_key = _generate_cache_key( # all args are used to generate cache key |
| 77 | + cache_key = _generate_cache_key( # all args are used to generate cache key |
77 | 78 | api_base_url, |
78 | 79 | workspace_id, |
79 | 80 | api_token, |
@@ -191,6 +192,7 @@ def __init__( |
191 | 192 | def combined_processor(event_info: FinishEventInfo): |
192 | 193 | default_finish_event_processor(event_info) |
193 | 194 | trace_finish_event_processor(event_info) |
| 195 | + |
194 | 196 | finish_pro = combined_processor |
195 | 197 | span_upload_path = None |
196 | 198 | file_upload_path = None |
@@ -283,9 +285,14 @@ def start_span( |
283 | 285 | return self._trace_provider.start_span(name=name, span_type=span_type, start_time=start_time, |
284 | 286 | start_new_trace=start_new_trace) |
285 | 287 | else: |
| 288 | + baggage = {} |
| 289 | + if isinstance(child_of.baggage, dict): # SpanContext |
| 290 | + baggage = child_of.baggage |
| 291 | + else: |
| 292 | + baggage = child_of.baggage() # Span |
286 | 293 | return self._trace_provider.start_span(name=name, span_type=span_type, start_time=start_time, |
287 | 294 | parent_span_id=child_of.span_id, trace_id=child_of.trace_id, |
288 | | - baggage=child_of.baggage(), start_new_trace=start_new_trace) |
| 295 | + baggage=baggage, start_new_trace=start_new_trace) |
289 | 296 | except Exception as e: |
290 | 297 | logger.warning(f"Start span failed, returning noop span. Error: {e}") |
291 | 298 | return NOOP_SPAN |
|
0 commit comments