ioa-observe-sdk 1.0.17__py3-none-any.whl → 1.0.19__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/__init__.py +19 -1
- ioa_observe/sdk/decorators/base.py +15 -4
- ioa_observe/sdk/instrumentations/slim.py +9 -3
- ioa_observe/sdk/tracing/tracing.py +8 -0
- {ioa_observe_sdk-1.0.17.dist-info → ioa_observe_sdk-1.0.19.dist-info}/METADATA +1 -1
- {ioa_observe_sdk-1.0.17.dist-info → ioa_observe_sdk-1.0.19.dist-info}/RECORD +9 -9
- {ioa_observe_sdk-1.0.17.dist-info → ioa_observe_sdk-1.0.19.dist-info}/WHEEL +0 -0
- {ioa_observe_sdk-1.0.17.dist-info → ioa_observe_sdk-1.0.19.dist-info}/licenses/LICENSE.md +0 -0
- {ioa_observe_sdk-1.0.17.dist-info → ioa_observe_sdk-1.0.19.dist-info}/top_level.txt +0 -0
|
@@ -22,6 +22,7 @@ def task(
|
|
|
22
22
|
description: Optional[str] = None,
|
|
23
23
|
version: Optional[int] = None,
|
|
24
24
|
protocol: Optional[str] = None,
|
|
25
|
+
application_id: Optional[str] = None,
|
|
25
26
|
method_name: Optional[str] = None,
|
|
26
27
|
tlp_span_kind: Optional[ObserveSpanKindValues] = ObserveSpanKindValues.TASK,
|
|
27
28
|
) -> Callable[[F], F]:
|
|
@@ -31,6 +32,7 @@ def task(
|
|
|
31
32
|
description=description,
|
|
32
33
|
version=version,
|
|
33
34
|
protocol=protocol,
|
|
35
|
+
application_id=application_id,
|
|
34
36
|
tlp_span_kind=tlp_span_kind,
|
|
35
37
|
)
|
|
36
38
|
else:
|
|
@@ -39,6 +41,7 @@ def task(
|
|
|
39
41
|
description=description,
|
|
40
42
|
version=version,
|
|
41
43
|
protocol=protocol,
|
|
44
|
+
application_id=application_id,
|
|
42
45
|
method_name=method_name,
|
|
43
46
|
tlp_span_kind=tlp_span_kind,
|
|
44
47
|
)
|
|
@@ -49,6 +52,7 @@ def workflow(
|
|
|
49
52
|
description: Optional[str] = None,
|
|
50
53
|
version: Optional[int] = None,
|
|
51
54
|
protocol: Optional[str] = None,
|
|
55
|
+
application_id: Optional[str] = None,
|
|
52
56
|
method_name: Optional[str] = None,
|
|
53
57
|
tlp_span_kind: Optional[
|
|
54
58
|
Union[ObserveSpanKindValues, str]
|
|
@@ -62,6 +66,7 @@ def workflow(
|
|
|
62
66
|
description=description,
|
|
63
67
|
version=version,
|
|
64
68
|
protocol=protocol,
|
|
69
|
+
application_id=application_id,
|
|
65
70
|
method_name=method_name,
|
|
66
71
|
tlp_span_kind=tlp_span_kind,
|
|
67
72
|
)(target)
|
|
@@ -72,6 +77,7 @@ def workflow(
|
|
|
72
77
|
description=description,
|
|
73
78
|
version=version,
|
|
74
79
|
protocol=protocol,
|
|
80
|
+
application_id=application_id,
|
|
75
81
|
tlp_span_kind=tlp_span_kind,
|
|
76
82
|
)(target)
|
|
77
83
|
|
|
@@ -82,19 +88,27 @@ def graph(
|
|
|
82
88
|
name: Optional[str] = None,
|
|
83
89
|
description: Optional[str] = None,
|
|
84
90
|
version: Optional[int] = None,
|
|
91
|
+
application_id: Optional[str] = None,
|
|
85
92
|
method_name: Optional[str] = None,
|
|
86
93
|
protocol: Optional[str] = None,
|
|
87
94
|
) -> Callable[[F], F]:
|
|
88
95
|
if method_name is None:
|
|
89
96
|
return entity_method(
|
|
90
|
-
name=name,
|
|
97
|
+
name=name,
|
|
98
|
+
description=description,
|
|
99
|
+
version=version,
|
|
100
|
+
protocol=protocol,
|
|
101
|
+
application_id=application_id,
|
|
102
|
+
tlp_span_kind="graph",
|
|
91
103
|
)
|
|
92
104
|
else:
|
|
93
105
|
return entity_class(
|
|
94
106
|
name=name,
|
|
107
|
+
description=description,
|
|
95
108
|
version=version,
|
|
96
109
|
method_name=method_name,
|
|
97
110
|
protocol=protocol,
|
|
111
|
+
application_id=application_id,
|
|
98
112
|
tlp_span_kind="graph",
|
|
99
113
|
)
|
|
100
114
|
|
|
@@ -104,6 +118,7 @@ def agent(
|
|
|
104
118
|
description: Optional[str] = None,
|
|
105
119
|
version: Optional[int] = None,
|
|
106
120
|
protocol: Optional[str] = None,
|
|
121
|
+
application_id: Optional[str] = None,
|
|
107
122
|
method_name: Optional[str] = None,
|
|
108
123
|
) -> Callable[[F], F]:
|
|
109
124
|
return workflow(
|
|
@@ -111,6 +126,7 @@ def agent(
|
|
|
111
126
|
description=description,
|
|
112
127
|
version=version,
|
|
113
128
|
protocol=protocol,
|
|
129
|
+
application_id=application_id,
|
|
114
130
|
method_name=method_name,
|
|
115
131
|
tlp_span_kind=ObserveSpanKindValues.AGENT,
|
|
116
132
|
)
|
|
@@ -120,12 +136,14 @@ def tool(
|
|
|
120
136
|
name: Optional[str] = None,
|
|
121
137
|
description: Optional[str] = None,
|
|
122
138
|
version: Optional[int] = None,
|
|
139
|
+
application_id: Optional[str] = None,
|
|
123
140
|
method_name: Optional[str] = None,
|
|
124
141
|
) -> Callable[[F], F]:
|
|
125
142
|
return task(
|
|
126
143
|
name=name,
|
|
127
144
|
description=description,
|
|
128
145
|
version=version,
|
|
146
|
+
application_id=application_id,
|
|
129
147
|
method_name=method_name,
|
|
130
148
|
tlp_span_kind=ObserveSpanKindValues.TOOL,
|
|
131
149
|
)
|
|
@@ -36,6 +36,7 @@ from ioa_observe.sdk.tracing.tracing import (
|
|
|
36
36
|
set_entity_path,
|
|
37
37
|
get_chained_entity_path,
|
|
38
38
|
set_agent_id_event,
|
|
39
|
+
set_application_id,
|
|
39
40
|
)
|
|
40
41
|
from ioa_observe.sdk.metrics.agents.agent_connections import connection_reliability
|
|
41
42
|
from ioa_observe.sdk.utils import camel_to_snake
|
|
@@ -91,6 +92,7 @@ def _setup_span(
|
|
|
91
92
|
tlp_span_kind: Optional[ObserveSpanKindValues] = None,
|
|
92
93
|
version: Optional[int] = None,
|
|
93
94
|
description: Optional[str] = None,
|
|
95
|
+
application_id: Optional[str] = None,
|
|
94
96
|
):
|
|
95
97
|
"""Sets up the OpenTelemetry span and context"""
|
|
96
98
|
if tlp_span_kind in [
|
|
@@ -104,6 +106,7 @@ def _setup_span(
|
|
|
104
106
|
# set_session_id(session_id)
|
|
105
107
|
if tlp_span_kind == "graph":
|
|
106
108
|
span_name = f"{entity_name}.{tlp_span_kind}"
|
|
109
|
+
|
|
107
110
|
else:
|
|
108
111
|
span_name = f"{entity_name}.{tlp_span_kind.value}"
|
|
109
112
|
|
|
@@ -111,9 +114,6 @@ def _setup_span(
|
|
|
111
114
|
span = tracer.start_span(span_name)
|
|
112
115
|
ctx = trace.set_span_in_context(span)
|
|
113
116
|
ctx_token = context_api.attach(ctx)
|
|
114
|
-
span.set_attribute(
|
|
115
|
-
"agent_id", entity_name
|
|
116
|
-
) if tlp_span_kind == ObserveSpanKindValues.AGENT else None
|
|
117
117
|
if tlp_span_kind == ObserveSpanKindValues.AGENT:
|
|
118
118
|
with trace.get_tracer(__name__).start_span(
|
|
119
119
|
"agent_start_event", context=trace.set_span_in_context(span)
|
|
@@ -148,7 +148,11 @@ def _setup_span(
|
|
|
148
148
|
|
|
149
149
|
if tlp_span_kind == ObserveSpanKindValues.AGENT:
|
|
150
150
|
span.set_attribute("agent_chain_start_time", time.time())
|
|
151
|
-
|
|
151
|
+
if application_id:
|
|
152
|
+
set_application_id(application_id)
|
|
153
|
+
span.set_attribute(
|
|
154
|
+
"application_id", application_id
|
|
155
|
+
) # set application id attribute
|
|
152
156
|
return span, ctx, ctx_token
|
|
153
157
|
|
|
154
158
|
|
|
@@ -297,6 +301,7 @@ def entity_method(
|
|
|
297
301
|
description: Optional[str] = None,
|
|
298
302
|
version: Optional[int] = None,
|
|
299
303
|
protocol: Optional[str] = None,
|
|
304
|
+
application_id: Optional[str] = None,
|
|
300
305
|
tlp_span_kind: Optional[ObserveSpanKindValues] = ObserveSpanKindValues.TASK,
|
|
301
306
|
) -> Callable[[F], F]:
|
|
302
307
|
def decorate(fn: F) -> F:
|
|
@@ -319,6 +324,7 @@ def entity_method(
|
|
|
319
324
|
tlp_span_kind,
|
|
320
325
|
version,
|
|
321
326
|
description,
|
|
327
|
+
application_id,
|
|
322
328
|
)
|
|
323
329
|
_handle_span_input(span, args, kwargs, cls=JSONEncoder)
|
|
324
330
|
|
|
@@ -340,6 +346,7 @@ def entity_method(
|
|
|
340
346
|
tlp_span_kind,
|
|
341
347
|
version,
|
|
342
348
|
description,
|
|
349
|
+
application_id,
|
|
343
350
|
)
|
|
344
351
|
|
|
345
352
|
# Handle case where span setup failed
|
|
@@ -436,6 +443,7 @@ def entity_method(
|
|
|
436
443
|
tlp_span_kind,
|
|
437
444
|
version,
|
|
438
445
|
description,
|
|
446
|
+
application_id,
|
|
439
447
|
)
|
|
440
448
|
|
|
441
449
|
# Handle case where span setup failed
|
|
@@ -549,6 +557,7 @@ def entity_class(
|
|
|
549
557
|
description: Optional[str],
|
|
550
558
|
version: Optional[int],
|
|
551
559
|
protocol: Optional[str],
|
|
560
|
+
application_id: Optional[str],
|
|
552
561
|
method_name: Optional[str],
|
|
553
562
|
tlp_span_kind: Optional[ObserveSpanKindValues] = ObserveSpanKindValues.TASK,
|
|
554
563
|
):
|
|
@@ -603,6 +612,7 @@ def entity_class(
|
|
|
603
612
|
description=description,
|
|
604
613
|
version=version,
|
|
605
614
|
protocol=protocol,
|
|
615
|
+
application_id=application_id,
|
|
606
616
|
tlp_span_kind=tlp_span_kind,
|
|
607
617
|
)(unwrapped_method)
|
|
608
618
|
# Set the wrapped method on the class
|
|
@@ -619,6 +629,7 @@ def entity_class(
|
|
|
619
629
|
def _handle_agent_span(span, entity_name, description, tlp_span_kind):
|
|
620
630
|
if tlp_span_kind == ObserveSpanKindValues.AGENT:
|
|
621
631
|
try:
|
|
632
|
+
span.set_attribute("agent_id", entity_name) # set the agent id attribute
|
|
622
633
|
set_agent_id_event(entity_name)
|
|
623
634
|
span.add_event(
|
|
624
635
|
"agent_start_event",
|
|
@@ -94,7 +94,9 @@ class SLIMInstrumentor(BaseInstrumentor):
|
|
|
94
94
|
if len(args) > message_arg_index:
|
|
95
95
|
original_args = list(args)
|
|
96
96
|
message = original_args[message_arg_index]
|
|
97
|
-
wrapped_message =
|
|
97
|
+
wrapped_message = SLIMInstrumentor._wrap_message_with_headers(
|
|
98
|
+
self, message, headers
|
|
99
|
+
)
|
|
98
100
|
|
|
99
101
|
# Convert wrapped message back to bytes if needed
|
|
100
102
|
if isinstance(wrapped_message, dict):
|
|
@@ -149,7 +151,9 @@ class SLIMInstrumentor(BaseInstrumentor):
|
|
|
149
151
|
if traceparent and session_id:
|
|
150
152
|
baggage.set_baggage(f"execution.{traceparent}", session_id)
|
|
151
153
|
|
|
152
|
-
wrapped_message =
|
|
154
|
+
wrapped_message = SLIMInstrumentor._wrap_message_with_headers(
|
|
155
|
+
self, message, headers
|
|
156
|
+
)
|
|
153
157
|
message_to_send = (
|
|
154
158
|
json.dumps(wrapped_message).encode("utf-8")
|
|
155
159
|
if isinstance(wrapped_message, dict)
|
|
@@ -210,7 +214,9 @@ class SLIMInstrumentor(BaseInstrumentor):
|
|
|
210
214
|
if traceparent and session_id:
|
|
211
215
|
baggage.set_baggage(f"execution.{traceparent}", session_id)
|
|
212
216
|
|
|
213
|
-
wrapped_message =
|
|
217
|
+
wrapped_message = SLIMInstrumentor._wrap_message_with_headers(
|
|
218
|
+
self, message, headers
|
|
219
|
+
)
|
|
214
220
|
message_to_send = (
|
|
215
221
|
json.dumps(wrapped_message).encode("utf-8")
|
|
216
222
|
if isinstance(wrapped_message, dict)
|
|
@@ -291,6 +291,10 @@ class TracerWrapper(object):
|
|
|
291
291
|
if agent_id is not None:
|
|
292
292
|
span.set_attribute("agent_id", agent_id)
|
|
293
293
|
|
|
294
|
+
application_id = get_value("application_id")
|
|
295
|
+
if application_id is not None:
|
|
296
|
+
span.set_attribute("application_id", application_id)
|
|
297
|
+
|
|
294
298
|
if is_llm_span(span):
|
|
295
299
|
self.llm_call_counter.add(1, attributes=span.attributes)
|
|
296
300
|
|
|
@@ -736,6 +740,10 @@ def set_agent_id_event(agent_id: str) -> None:
|
|
|
736
740
|
attach(set_value("agent_id", agent_id))
|
|
737
741
|
|
|
738
742
|
|
|
743
|
+
def set_application_id(app_id: str) -> None:
|
|
744
|
+
attach(set_value("application_id", app_id))
|
|
745
|
+
|
|
746
|
+
|
|
739
747
|
def set_entity_path(entity_path: str) -> None:
|
|
740
748
|
attach(set_value("entity_path", entity_path))
|
|
741
749
|
|
|
@@ -9,14 +9,14 @@ ioa_observe/sdk/client/http.py,sha256=LdLYSQPFIhKN5BTB-N78jLO7ITl7jGjA0-qpewEIvO
|
|
|
9
9
|
ioa_observe/sdk/config/__init__.py,sha256=8aVNaw0yRNLFPxlf97iOZLlJVcV81ivSDnudH2m1OIo,572
|
|
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
|
-
ioa_observe/sdk/decorators/__init__.py,sha256=
|
|
13
|
-
ioa_observe/sdk/decorators/base.py,sha256=
|
|
12
|
+
ioa_observe/sdk/decorators/__init__.py,sha256=qCpJAv98eLKs3I5EMXJVTV0s49Nc6QDSOHNh5rW5vLg,4268
|
|
13
|
+
ioa_observe/sdk/decorators/base.py,sha256=eYep1xHXscdxIGisXgXwSGbkCrdpqqT_2s5BMP07ldg,30646
|
|
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=UM_XCuzetOzeDFQ-bFY0Q93OLffH7OsvbgNaS58E0RA,22632
|
|
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
|
|
@@ -34,15 +34,15 @@ ioa_observe/sdk/tracing/content_allow_list.py,sha256=1fAkpIwUQ7vDwCTkIVrqeltWQtr
|
|
|
34
34
|
ioa_observe/sdk/tracing/context_manager.py,sha256=O0JEXYa9h8anhW78R8KKBuqS0j4by1E1KXxNIMPnLr8,400
|
|
35
35
|
ioa_observe/sdk/tracing/context_utils.py,sha256=-sYS9vPLI87davV9ubneq5xqbV583CC_c0SmOQS1TAs,2933
|
|
36
36
|
ioa_observe/sdk/tracing/manual.py,sha256=KS6WN-zw9vAACzXYmnMoJm9d1fenYMfvzeK1GrGDPDE,1937
|
|
37
|
-
ioa_observe/sdk/tracing/tracing.py,sha256=
|
|
37
|
+
ioa_observe/sdk/tracing/tracing.py,sha256=MgKclJe_IRBh_EKTKwVJkrgrsBX1NUU05eRNcfYnTzE,47380
|
|
38
38
|
ioa_observe/sdk/tracing/transform_span.py,sha256=XTApi_gJxum7ynvhtcoCfDyK8VVOj91Q1DT6hAeLHA8,8419
|
|
39
39
|
ioa_observe/sdk/utils/__init__.py,sha256=UPn182U-UblF_XwXaFpx8F-TmQTbm1LYf9y89uSp5Hw,704
|
|
40
40
|
ioa_observe/sdk/utils/const.py,sha256=d67dUTAH9UpWvUV9GLBUqn1Sc2knJ55dy-e6YoLrvSo,1318
|
|
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.19.dist-info/licenses/LICENSE.md,sha256=55VjUfgjWOS4vv3Cf55gfq-RxjPgRIO2vlgYPUuC5lA,11362
|
|
45
|
+
ioa_observe_sdk-1.0.19.dist-info/METADATA,sha256=ynlTiy3cP00dX-e_PjBgTP3wB8FoT20ztUbOLeSKQEg,7027
|
|
46
|
+
ioa_observe_sdk-1.0.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
47
|
+
ioa_observe_sdk-1.0.19.dist-info/top_level.txt,sha256=Yt-6Y1olZEDqCs2REeqI30WjYx0pLGQSVqzYmDd67N8,12
|
|
48
|
+
ioa_observe_sdk-1.0.19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|