ioa-observe-sdk 1.0.19__py3-none-any.whl → 1.0.20__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/decorators/base.py +43 -4
- ioa_observe/sdk/instrumentations/slim.py +10 -1
- {ioa_observe_sdk-1.0.19.dist-info → ioa_observe_sdk-1.0.20.dist-info}/METADATA +1 -1
- {ioa_observe_sdk-1.0.19.dist-info → ioa_observe_sdk-1.0.20.dist-info}/RECORD +7 -7
- {ioa_observe_sdk-1.0.19.dist-info → ioa_observe_sdk-1.0.20.dist-info}/WHEEL +0 -0
- {ioa_observe_sdk-1.0.19.dist-info → ioa_observe_sdk-1.0.20.dist-info}/licenses/LICENSE.md +0 -0
- {ioa_observe_sdk-1.0.19.dist-info → ioa_observe_sdk-1.0.20.dist-info}/top_level.txt +0 -0
|
@@ -16,10 +16,10 @@ from ioa_observe.sdk.decorators.helpers import (
|
|
|
16
16
|
_is_async_generator,
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
-
|
|
20
19
|
from langgraph.graph.state import CompiledStateGraph
|
|
21
20
|
from opentelemetry import trace
|
|
22
21
|
from opentelemetry import context as context_api
|
|
22
|
+
from opentelemetry.context import get_value, attach, set_value
|
|
23
23
|
from pydantic_core import PydanticSerializationError
|
|
24
24
|
from typing_extensions import ParamSpec
|
|
25
25
|
|
|
@@ -113,7 +113,49 @@ def _setup_span(
|
|
|
113
113
|
with get_tracer() as tracer:
|
|
114
114
|
span = tracer.start_span(span_name)
|
|
115
115
|
ctx = trace.set_span_in_context(span)
|
|
116
|
+
|
|
117
|
+
# Preserve existing context values before attaching new context
|
|
118
|
+
session_id = get_value("session.id")
|
|
119
|
+
current_traceparent = get_value("current_traceparent")
|
|
120
|
+
agent_id = get_value("agent_id")
|
|
121
|
+
application_id_ctx = get_value("application_id")
|
|
122
|
+
association_properties = get_value("association_properties")
|
|
123
|
+
managed_prompt = get_value("managed_prompt")
|
|
124
|
+
prompt_key = get_value("prompt_key")
|
|
125
|
+
prompt_version = get_value("prompt_version")
|
|
126
|
+
prompt_version_name = get_value("prompt_version_name")
|
|
127
|
+
prompt_version_hash = get_value("prompt_version_hash")
|
|
128
|
+
prompt_template = get_value("prompt_template")
|
|
129
|
+
prompt_template_variables = get_value("prompt_template_variables")
|
|
130
|
+
|
|
116
131
|
ctx_token = context_api.attach(ctx)
|
|
132
|
+
|
|
133
|
+
# Re-attach preserved context values to the new context
|
|
134
|
+
if session_id is not None:
|
|
135
|
+
attach(set_value("session.id", session_id))
|
|
136
|
+
if current_traceparent is not None:
|
|
137
|
+
attach(set_value("current_traceparent", current_traceparent))
|
|
138
|
+
if agent_id is not None:
|
|
139
|
+
attach(set_value("agent_id", agent_id))
|
|
140
|
+
if application_id_ctx is not None:
|
|
141
|
+
attach(set_value("application_id", application_id_ctx))
|
|
142
|
+
if association_properties is not None:
|
|
143
|
+
attach(set_value("association_properties", association_properties))
|
|
144
|
+
if managed_prompt is not None:
|
|
145
|
+
attach(set_value("managed_prompt", managed_prompt))
|
|
146
|
+
if prompt_key is not None:
|
|
147
|
+
attach(set_value("prompt_key", prompt_key))
|
|
148
|
+
if prompt_version is not None:
|
|
149
|
+
attach(set_value("prompt_version", prompt_version))
|
|
150
|
+
if prompt_version_name is not None:
|
|
151
|
+
attach(set_value("prompt_version_name", prompt_version_name))
|
|
152
|
+
if prompt_version_hash is not None:
|
|
153
|
+
attach(set_value("prompt_version_hash", prompt_version_hash))
|
|
154
|
+
if prompt_template is not None:
|
|
155
|
+
attach(set_value("prompt_template", prompt_template))
|
|
156
|
+
if prompt_template_variables is not None:
|
|
157
|
+
attach(set_value("prompt_template_variables", prompt_template_variables))
|
|
158
|
+
|
|
117
159
|
if tlp_span_kind == ObserveSpanKindValues.AGENT:
|
|
118
160
|
with trace.get_tracer(__name__).start_span(
|
|
119
161
|
"agent_start_event", context=trace.set_span_in_context(span)
|
|
@@ -127,9 +169,6 @@ def _setup_span(
|
|
|
127
169
|
},
|
|
128
170
|
)
|
|
129
171
|
# start_span.end() # end the span immediately
|
|
130
|
-
# session_id = get_value("session.id")
|
|
131
|
-
# if session_id is not None:
|
|
132
|
-
# span.set_attribute("session.id", session_id)
|
|
133
172
|
if tlp_span_kind in [
|
|
134
173
|
ObserveSpanKindValues.TASK,
|
|
135
174
|
ObserveSpanKindValues.TOOL,
|
|
@@ -349,8 +349,17 @@ class SLIMInstrumentor(BaseInstrumentor):
|
|
|
349
349
|
# Store in kv_store with thread safety
|
|
350
350
|
with _kv_lock:
|
|
351
351
|
kv_store.set(f"execution.{traceparent}", session_id)
|
|
352
|
-
|
|
352
|
+
|
|
353
|
+
# DON'T detach the context yet - we need it to persist for the callback
|
|
354
|
+
# The context will be cleaned up later or by the garbage collector
|
|
355
|
+
|
|
356
|
+
except Exception as e:
|
|
357
|
+
# Only detach on error
|
|
353
358
|
context.detach(token)
|
|
359
|
+
raise e
|
|
360
|
+
elif traceparent and session_id and session_id != "None":
|
|
361
|
+
# Even without carrier context, set session ID if we have the data
|
|
362
|
+
set_session_id(session_id, traceparent=traceparent)
|
|
354
363
|
|
|
355
364
|
# Fallback: check stored execution ID if not found in headers
|
|
356
365
|
if traceparent and (not session_id or session_id == "None"):
|
|
@@ -10,13 +10,13 @@ ioa_observe/sdk/config/__init__.py,sha256=8aVNaw0yRNLFPxlf97iOZLlJVcV81ivSDnudH2
|
|
|
10
10
|
ioa_observe/sdk/connectors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
ioa_observe/sdk/connectors/slim.py,sha256=NwbKEV7d5NIOqmG8zKqtgGigSJl7kf3QJ65z2gxpsY8,8498
|
|
12
12
|
ioa_observe/sdk/decorators/__init__.py,sha256=qCpJAv98eLKs3I5EMXJVTV0s49Nc6QDSOHNh5rW5vLg,4268
|
|
13
|
-
ioa_observe/sdk/decorators/base.py,sha256=
|
|
13
|
+
ioa_observe/sdk/decorators/base.py,sha256=pnoj73UrpvaZmOPbcpGRRYCwg7LBAgO8PiBDh5ntn0c,32694
|
|
14
14
|
ioa_observe/sdk/decorators/helpers.py,sha256=I9HXMBivkZpGDtPe9Ad_UU35p_m_wEPate4r_fU0oOA,2705
|
|
15
15
|
ioa_observe/sdk/decorators/util.py,sha256=IebvH9gwZN1en3LblYJUh4bAV2STl6xmp8WpZzBDH2g,30068
|
|
16
16
|
ioa_observe/sdk/instrumentations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
ioa_observe/sdk/instrumentations/a2a.py,sha256=ZpqvPl4u-yheQzSdBfxnZhWFZ8ntbKni_uaW3IDyjqw,6309
|
|
18
18
|
ioa_observe/sdk/instrumentations/mcp.py,sha256=vRM3ofnn7AMmry2RrfyZnZVPEutLWiDMghx2TSnm0Wk,18569
|
|
19
|
-
ioa_observe/sdk/instrumentations/slim.py,sha256=
|
|
19
|
+
ioa_observe/sdk/instrumentations/slim.py,sha256=WIe0E2y6eg5heQ1EA6l9BUDniYpYIjWQ24Pcv_8ZfPk,23147
|
|
20
20
|
ioa_observe/sdk/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
21
|
ioa_observe/sdk/logging/logging.py,sha256=HZxW9s8Due7jgiNkdI38cIjv5rC9D-Flta3RQMOnpow,2891
|
|
22
22
|
ioa_observe/sdk/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -41,8 +41,8 @@ ioa_observe/sdk/utils/const.py,sha256=d67dUTAH9UpWvUV9GLBUqn1Sc2knJ55dy-e6YoLrvS
|
|
|
41
41
|
ioa_observe/sdk/utils/in_memory_span_exporter.py,sha256=H_4TRaThMO1H6vUQ0OpQvzJk_fZH0OOsRAM1iZQXsR8,2112
|
|
42
42
|
ioa_observe/sdk/utils/json_encoder.py,sha256=g4NQ0tTqgWssY6I1D7r4zo0G6PiUo61jhofTAw5-jno,639
|
|
43
43
|
ioa_observe/sdk/utils/package_check.py,sha256=1d1MjxhwoEZIx9dumirT2pRsEWgn-m-SI4npDeEalew,576
|
|
44
|
-
ioa_observe_sdk-1.0.
|
|
45
|
-
ioa_observe_sdk-1.0.
|
|
46
|
-
ioa_observe_sdk-1.0.
|
|
47
|
-
ioa_observe_sdk-1.0.
|
|
48
|
-
ioa_observe_sdk-1.0.
|
|
44
|
+
ioa_observe_sdk-1.0.20.dist-info/licenses/LICENSE.md,sha256=55VjUfgjWOS4vv3Cf55gfq-RxjPgRIO2vlgYPUuC5lA,11362
|
|
45
|
+
ioa_observe_sdk-1.0.20.dist-info/METADATA,sha256=rq00vlT-d5xj5wwvTp0j8LeERhmSX1vC90mDkOi9tKI,7027
|
|
46
|
+
ioa_observe_sdk-1.0.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
47
|
+
ioa_observe_sdk-1.0.20.dist-info/top_level.txt,sha256=Yt-6Y1olZEDqCs2REeqI30WjYx0pLGQSVqzYmDd67N8,12
|
|
48
|
+
ioa_observe_sdk-1.0.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|