ioa-observe-sdk 1.0.5__py3-none-any.whl → 1.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ioa_observe/sdk/tracing/context_utils.py +16 -15
- ioa_observe/sdk/tracing/tracing.py +3 -2
- {ioa_observe_sdk-1.0.5.dist-info → ioa_observe_sdk-1.0.6.dist-info}/METADATA +1 -1
- {ioa_observe_sdk-1.0.5.dist-info → ioa_observe_sdk-1.0.6.dist-info}/RECORD +7 -7
- {ioa_observe_sdk-1.0.5.dist-info → ioa_observe_sdk-1.0.6.dist-info}/WHEEL +0 -0
- {ioa_observe_sdk-1.0.5.dist-info → ioa_observe_sdk-1.0.6.dist-info}/licenses/LICENSE.md +0 -0
- {ioa_observe_sdk-1.0.5.dist-info → ioa_observe_sdk-1.0.6.dist-info}/top_level.txt +0 -0
|
@@ -6,6 +6,7 @@ from ioa_observe.sdk import TracerWrapper
|
|
|
6
6
|
from ioa_observe.sdk.client import kv_store
|
|
7
7
|
from ioa_observe.sdk.tracing import set_execution_id, get_current_traceparent
|
|
8
8
|
from opentelemetry import context as otel_context
|
|
9
|
+
from opentelemetry.context import attach
|
|
9
10
|
|
|
10
11
|
"""
|
|
11
12
|
Usage Example:
|
|
@@ -42,21 +43,21 @@ def set_context_from_headers(headers):
|
|
|
42
43
|
"""
|
|
43
44
|
Restores the trace context, baggage, and execution_id from headers.
|
|
44
45
|
"""
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
carrierHeaders = {}
|
|
47
|
+
if "traceparentID" in headers:
|
|
48
|
+
carrierHeaders["traceparent"] = headers["traceparentID"]
|
|
49
|
+
if "executionID" in headers:
|
|
50
|
+
carrierHeaders["execution_id"] = headers["executionID"]
|
|
51
|
+
ctx = TraceContextTextMapPropagator().extract(carrier=carrierHeaders)
|
|
52
|
+
ctx = W3CBaggagePropagator().extract(carrier=carrierHeaders, context=ctx)
|
|
53
|
+
attach(ctx)
|
|
54
|
+
# Restore execution_id if present
|
|
55
|
+
traceparent = headers.get("traceparentID")
|
|
56
|
+
execution_id = headers.get("executionID")
|
|
57
|
+
if traceparent and execution_id and execution_id != "None":
|
|
58
|
+
set_execution_id(execution_id, traceparent=traceparent)
|
|
59
|
+
kv_store.set(f"execution.{traceparent}", execution_id)
|
|
60
|
+
return ctx
|
|
60
61
|
|
|
61
62
|
|
|
62
63
|
def set_baggage_item(key, value):
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import atexit
|
|
5
|
+
import contextlib
|
|
5
6
|
import json
|
|
6
7
|
import logging
|
|
7
8
|
import os
|
|
@@ -412,7 +413,7 @@ def session_start():
|
|
|
412
413
|
set_execution_id(execution_id)
|
|
413
414
|
metadata = {
|
|
414
415
|
"executionID": get_value("execution.id") or execution_id,
|
|
415
|
-
"
|
|
416
|
+
"traceparentID": get_current_traceparent(),
|
|
416
417
|
}
|
|
417
418
|
import inspect
|
|
418
419
|
|
|
@@ -427,7 +428,7 @@ def session_start():
|
|
|
427
428
|
|
|
428
429
|
return _cm()
|
|
429
430
|
# Used as a normal function
|
|
430
|
-
return
|
|
431
|
+
return contextlib.nullcontext(metadata)
|
|
431
432
|
|
|
432
433
|
|
|
433
434
|
def set_execution_id(execution_id: str, traceparent: str = None) -> None:
|
|
@@ -29,16 +29,16 @@ ioa_observe/sdk/metrics/agents/tracker.py,sha256=KN3VFPXrgB1f5VF87ppqS4zG2vxn-9o
|
|
|
29
29
|
ioa_observe/sdk/tracing/__init__.py,sha256=RBc_lmUEdCDy1ICW6TtRor_0Tew1SyzYFjT4Sn1pkdo,437
|
|
30
30
|
ioa_observe/sdk/tracing/content_allow_list.py,sha256=1fAkpIwUQ7vDwCTkIVrqeltWQtrIbYvj8gz6_7P6NrE,945
|
|
31
31
|
ioa_observe/sdk/tracing/context_manager.py,sha256=O0JEXYa9h8anhW78R8KKBuqS0j4by1E1KXxNIMPnLr8,400
|
|
32
|
-
ioa_observe/sdk/tracing/context_utils.py,sha256=
|
|
32
|
+
ioa_observe/sdk/tracing/context_utils.py,sha256=vlLJEq0cqLCScqg1IGaKWQV19tKkHdHQzAt4-pOBbCg,2981
|
|
33
33
|
ioa_observe/sdk/tracing/manual.py,sha256=KS6WN-zw9vAACzXYmnMoJm9d1fenYMfvzeK1GrGDPDE,1937
|
|
34
|
-
ioa_observe/sdk/tracing/tracing.py,sha256=
|
|
34
|
+
ioa_observe/sdk/tracing/tracing.py,sha256=ZvWAsKEG-iGuef5EeLiHtSgLoYUCrQPA5RdaQXF1DC0,37927
|
|
35
35
|
ioa_observe/sdk/utils/__init__.py,sha256=UPn182U-UblF_XwXaFpx8F-TmQTbm1LYf9y89uSp5Hw,704
|
|
36
36
|
ioa_observe/sdk/utils/const.py,sha256=GwbHakKPjBL4wLqAVkDrSoKB-8p18EUrbaqPuRuV_xg,1099
|
|
37
37
|
ioa_observe/sdk/utils/in_memory_span_exporter.py,sha256=H_4TRaThMO1H6vUQ0OpQvzJk_fZH0OOsRAM1iZQXsR8,2112
|
|
38
38
|
ioa_observe/sdk/utils/json_encoder.py,sha256=g4NQ0tTqgWssY6I1D7r4zo0G6PiUo61jhofTAw5-jno,639
|
|
39
39
|
ioa_observe/sdk/utils/package_check.py,sha256=1d1MjxhwoEZIx9dumirT2pRsEWgn-m-SI4npDeEalew,576
|
|
40
|
-
ioa_observe_sdk-1.0.
|
|
41
|
-
ioa_observe_sdk-1.0.
|
|
42
|
-
ioa_observe_sdk-1.0.
|
|
43
|
-
ioa_observe_sdk-1.0.
|
|
44
|
-
ioa_observe_sdk-1.0.
|
|
40
|
+
ioa_observe_sdk-1.0.6.dist-info/licenses/LICENSE.md,sha256=55VjUfgjWOS4vv3Cf55gfq-RxjPgRIO2vlgYPUuC5lA,11362
|
|
41
|
+
ioa_observe_sdk-1.0.6.dist-info/METADATA,sha256=uRkW5gpM6gtLbDCCvs5---NfvLYUYbC32IR4Dv6a33o,5428
|
|
42
|
+
ioa_observe_sdk-1.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
43
|
+
ioa_observe_sdk-1.0.6.dist-info/top_level.txt,sha256=Yt-6Y1olZEDqCs2REeqI30WjYx0pLGQSVqzYmDd67N8,12
|
|
44
|
+
ioa_observe_sdk-1.0.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|