nvidia-nat-opentelemetry 1.2.0a20250813__py3-none-any.whl → 1.2.0rc6__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.
- nat/meta/pypi.md +1 -1
- nat/plugins/opentelemetry/otel_span.py +1 -1
- nat/plugins/opentelemetry/span_converter.py +33 -33
- {nvidia_nat_opentelemetry-1.2.0a20250813.dist-info → nvidia_nat_opentelemetry-1.2.0rc6.dist-info}/METADATA +3 -3
- nvidia_nat_opentelemetry-1.2.0rc6.dist-info/RECORD +14 -0
- nvidia_nat_opentelemetry-1.2.0a20250813.dist-info/RECORD +0 -14
- {nvidia_nat_opentelemetry-1.2.0a20250813.dist-info → nvidia_nat_opentelemetry-1.2.0rc6.dist-info}/WHEEL +0 -0
- {nvidia_nat_opentelemetry-1.2.0a20250813.dist-info → nvidia_nat_opentelemetry-1.2.0rc6.dist-info}/entry_points.txt +0 -0
- {nvidia_nat_opentelemetry-1.2.0a20250813.dist-info → nvidia_nat_opentelemetry-1.2.0rc6.dist-info}/top_level.txt +0 -0
nat/meta/pypi.md
CHANGED
|
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
|
|
15
15
|
limitations under the License.
|
|
16
16
|
-->
|
|
17
17
|
|
|
18
|
-
: # pylint: disable=too-many-public-methods
|
|
|
106
106
|
self._status = status or Status(StatusCode.UNSET)
|
|
107
107
|
self._ended = False
|
|
108
108
|
self._resource = resource or Resource.create()
|
|
109
|
-
self._instrumentation_scope = instrumentation_scope or InstrumentationScope("
|
|
109
|
+
self._instrumentation_scope = instrumentation_scope or InstrumentationScope("nat", "1.0.0")
|
|
110
110
|
self._dropped_attributes = 0
|
|
111
111
|
self._dropped_events = 0
|
|
112
112
|
self._dropped_links = 0
|
|
@@ -83,7 +83,7 @@ def _get_shared_instrumentation_scope():
|
|
|
83
83
|
"""Get shared instrumentation scope to avoid repeated creation."""
|
|
84
84
|
if _shared.instrumentation_scope is None:
|
|
85
85
|
from opentelemetry.sdk.trace import InstrumentationScope
|
|
86
|
-
_shared.instrumentation_scope = InstrumentationScope("
|
|
86
|
+
_shared.instrumentation_scope = InstrumentationScope("nat", "1.0.0") # type: ignore
|
|
87
87
|
return _shared.instrumentation_scope
|
|
88
88
|
|
|
89
89
|
|
|
@@ -99,11 +99,11 @@ def convert_event_type_to_span_kind(event_type: str) -> OpenInferenceSpanKindVal
|
|
|
99
99
|
return SPAN_EVENT_TYPE_TO_SPAN_KIND_MAP.get(event_type, OpenInferenceSpanKindValues.UNKNOWN)
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
def convert_span_status_code(
|
|
103
|
-
"""Convert
|
|
102
|
+
def convert_span_status_code(nat_status_code: SpanStatusCode) -> StatusCode:
|
|
103
|
+
"""Convert NAT SpanStatusCode to OpenTelemetry StatusCode.
|
|
104
104
|
|
|
105
105
|
Args:
|
|
106
|
-
|
|
106
|
+
nat_status_code (SpanStatusCode): The NAT span status code to convert
|
|
107
107
|
|
|
108
108
|
Returns:
|
|
109
109
|
StatusCode: The corresponding OpenTelemetry StatusCode
|
|
@@ -113,31 +113,31 @@ def convert_span_status_code(aiq_status_code: SpanStatusCode) -> StatusCode:
|
|
|
113
113
|
SpanStatusCode.ERROR: StatusCode.ERROR,
|
|
114
114
|
SpanStatusCode.UNSET: StatusCode.UNSET,
|
|
115
115
|
}
|
|
116
|
-
return status_map.get(
|
|
116
|
+
return status_map.get(nat_status_code, StatusCode.UNSET)
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
def convert_span_to_otel(
|
|
120
|
-
"""Convert
|
|
119
|
+
def convert_span_to_otel(nat_span: Span) -> OtelSpan:
|
|
120
|
+
"""Convert a NAT Span to an OtelSpan using ultra-fast conversion.
|
|
121
121
|
|
|
122
122
|
Args:
|
|
123
|
-
|
|
123
|
+
nat_span (Span): The NAT span to convert
|
|
124
124
|
|
|
125
125
|
Returns:
|
|
126
126
|
OtelSpan: The converted OtelSpan with proper parent hierarchy.
|
|
127
127
|
"""
|
|
128
128
|
# Fast path for spans without context
|
|
129
|
-
if not
|
|
129
|
+
if not nat_span.context:
|
|
130
130
|
# Create minimal OtelSpan bypassing expensive constructor
|
|
131
131
|
otel_span = object.__new__(OtelSpan) # Bypass __init__
|
|
132
|
-
otel_span._name =
|
|
132
|
+
otel_span._name = nat_span.name
|
|
133
133
|
otel_span._context = None # type: ignore
|
|
134
134
|
otel_span._parent = None
|
|
135
|
-
otel_span._attributes =
|
|
135
|
+
otel_span._attributes = nat_span.attributes.copy()
|
|
136
136
|
otel_span._events = []
|
|
137
137
|
otel_span._links = []
|
|
138
138
|
otel_span._kind = SpanKind.INTERNAL
|
|
139
|
-
otel_span._start_time =
|
|
140
|
-
otel_span._end_time =
|
|
139
|
+
otel_span._start_time = nat_span.start_time
|
|
140
|
+
otel_span._end_time = nat_span.end_time
|
|
141
141
|
otel_span._status = Status(StatusCode.UNSET)
|
|
142
142
|
otel_span._ended = False
|
|
143
143
|
otel_span._resource = _get_shared_resource() # type: ignore
|
|
@@ -150,36 +150,36 @@ def convert_span_to_otel(aiq_span: Span) -> OtelSpan:
|
|
|
150
150
|
|
|
151
151
|
# Process parent efficiently (if needed)
|
|
152
152
|
parent_otel_span = None
|
|
153
|
-
trace_id =
|
|
153
|
+
trace_id = nat_span.context.trace_id
|
|
154
154
|
|
|
155
|
-
if
|
|
156
|
-
parent_otel_span = convert_span_to_otel(
|
|
155
|
+
if nat_span.parent:
|
|
156
|
+
parent_otel_span = convert_span_to_otel(nat_span.parent)
|
|
157
157
|
parent_context = parent_otel_span.get_span_context()
|
|
158
158
|
trace_id = parent_context.trace_id
|
|
159
159
|
|
|
160
160
|
# Create SpanContext efficiently
|
|
161
161
|
otel_span_context = SpanContext(
|
|
162
162
|
trace_id=trace_id,
|
|
163
|
-
span_id=
|
|
163
|
+
span_id=nat_span.context.span_id,
|
|
164
164
|
is_remote=False,
|
|
165
165
|
trace_flags=_SAMPLED_TRACE_FLAGS, # Reuse flags object
|
|
166
166
|
)
|
|
167
167
|
|
|
168
168
|
# Create OtelSpan bypassing expensive constructor
|
|
169
169
|
otel_span = object.__new__(OtelSpan) # Bypass __init__
|
|
170
|
-
otel_span._name =
|
|
170
|
+
otel_span._name = nat_span.name
|
|
171
171
|
otel_span._context = otel_span_context
|
|
172
172
|
otel_span._parent = parent_otel_span
|
|
173
|
-
otel_span._attributes =
|
|
173
|
+
otel_span._attributes = nat_span.attributes.copy()
|
|
174
174
|
otel_span._events = []
|
|
175
175
|
otel_span._links = []
|
|
176
176
|
otel_span._kind = SpanKind.INTERNAL
|
|
177
|
-
otel_span._start_time =
|
|
178
|
-
otel_span._end_time =
|
|
177
|
+
otel_span._start_time = nat_span.start_time
|
|
178
|
+
otel_span._end_time = nat_span.end_time
|
|
179
179
|
|
|
180
180
|
# Reuse status conversion
|
|
181
|
-
status_code = convert_span_status_code(
|
|
182
|
-
otel_span._status = Status(status_code,
|
|
181
|
+
status_code = convert_span_status_code(nat_span.status.code)
|
|
182
|
+
otel_span._status = Status(status_code, nat_span.status.message)
|
|
183
183
|
|
|
184
184
|
otel_span._ended = False
|
|
185
185
|
otel_span._resource = _get_shared_resource() # type: ignore
|
|
@@ -190,37 +190,37 @@ def convert_span_to_otel(aiq_span: Span) -> OtelSpan:
|
|
|
190
190
|
otel_span._status_description = None
|
|
191
191
|
|
|
192
192
|
# Set span kind efficiently (direct attribute modification)
|
|
193
|
-
event_type =
|
|
193
|
+
event_type = nat_span.attributes.get("nat.event_type", "UNKNOWN")
|
|
194
194
|
span_kind = SPAN_EVENT_TYPE_TO_SPAN_KIND_MAP.get(event_type, OpenInferenceSpanKindValues.UNKNOWN)
|
|
195
195
|
otel_span._attributes[SpanAttributes.OPENINFERENCE_SPAN_KIND] = span_kind.value
|
|
196
196
|
|
|
197
197
|
# Process events (only if they exist)
|
|
198
|
-
if
|
|
199
|
-
for
|
|
198
|
+
if nat_span.events:
|
|
199
|
+
for nat_event in nat_span.events:
|
|
200
200
|
# Optimize timestamp handling
|
|
201
|
-
if isinstance(
|
|
202
|
-
event_timestamp_ns =
|
|
203
|
-
elif
|
|
204
|
-
event_timestamp_ns = int(
|
|
201
|
+
if isinstance(nat_event.timestamp, int):
|
|
202
|
+
event_timestamp_ns = nat_event.timestamp
|
|
203
|
+
elif nat_event.timestamp:
|
|
204
|
+
event_timestamp_ns = int(nat_event.timestamp)
|
|
205
205
|
else:
|
|
206
206
|
event_timestamp_ns = int(time.time() * 1e9)
|
|
207
207
|
|
|
208
208
|
# Add event directly to internal list (bypass add_event method)
|
|
209
209
|
otel_span._events.append({
|
|
210
|
-
"name":
|
|
210
|
+
"name": nat_event.name, "attributes": nat_event.attributes, "timestamp": event_timestamp_ns
|
|
211
211
|
})
|
|
212
212
|
|
|
213
213
|
return otel_span
|
|
214
214
|
|
|
215
215
|
|
|
216
216
|
def convert_spans_to_otel_batch(spans: list[Span]) -> list[OtelSpan]:
|
|
217
|
-
"""Convert a list of
|
|
217
|
+
"""Convert a list of NAT spans to OtelSpans using stateless conversion.
|
|
218
218
|
|
|
219
219
|
This is useful for batch processing or demos. Each span is converted
|
|
220
220
|
independently using the stateless approach.
|
|
221
221
|
|
|
222
222
|
Args:
|
|
223
|
-
spans (list[Span]): List of
|
|
223
|
+
spans (list[Span]): List of NAT spans to convert
|
|
224
224
|
|
|
225
225
|
Returns:
|
|
226
226
|
list[OtelSpan]: List of converted OtelSpans with proper parent-child relationships
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nvidia-nat-opentelemetry
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.0rc6
|
|
4
4
|
Summary: Subpackage for OpenTelemetry integration in NeMo Agent toolkit
|
|
5
5
|
Keywords: ai,observability,opentelemetry
|
|
6
6
|
Classifier: Programming Language :: Python
|
|
7
7
|
Requires-Python: <3.13,>=3.11
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
|
-
Requires-Dist: nvidia-nat==v1.2.
|
|
9
|
+
Requires-Dist: nvidia-nat==v1.2.0-rc6
|
|
10
10
|
Requires-Dist: opentelemetry-api~=1.2
|
|
11
11
|
Requires-Dist: opentelemetry-exporter-otlp~=1.3
|
|
12
12
|
Requires-Dist: opentelemetry-sdk~=1.3
|
|
@@ -28,7 +28,7 @@ See the License for the specific language governing permissions and
|
|
|
28
28
|
limitations under the License.
|
|
29
29
|
-->
|
|
30
30
|
|
|
31
|
-
![NVIDIA NeMo Agent Toolkit](https://media.githubusercontent.com/media/NVIDIA/NeMo-Agent-Toolkit/refs/heads/main/docs/source/_static/
|
|
31
|
+
![NVIDIA NeMo Agent Toolkit](https://media.githubusercontent.com/media/NVIDIA/NeMo-Agent-Toolkit/refs/heads/main/docs/source/_static/banner.png "NeMo Agent toolkit banner image"
|
|
32
32
|
|
|
33
33
|
# NVIDIA NeMo Agent Toolkit Subpackage
|
|
34
34
|
This is a subpackage for OpenTelemetry integration for observability.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
nat/meta/pypi.md,sha256=_o1o1BLPY1pvjCkklWxlm7LlIDMPCk-2Rho85NUuN8U,1109
|
|
2
|
+
nat/plugins/opentelemetry/__init__.py,sha256=Xs1JQ16L9btwreh4pdGKwskffAw1YFO48jKrU4ib_7c,685
|
|
3
|
+
nat/plugins/opentelemetry/otel_span.py,sha256=dn-wI4iYS02z8WZWpamX4ISxhhmjRKWgPk9mAqIASZg,16554
|
|
4
|
+
nat/plugins/opentelemetry/otel_span_exporter.py,sha256=zxlbj0kODcqPeI5zVs_XQR7HsvlOMFhw6iEWJOOLWVM,6559
|
|
5
|
+
nat/plugins/opentelemetry/otlp_span_adapter_exporter.py,sha256=MtkmpLklvyIhCYXHvkY_sZRffwTiAvbQxBen02a89mo,3970
|
|
6
|
+
nat/plugins/opentelemetry/register.py,sha256=ZwOL4aXsnX0bokfuRnYQLrCk27BrUGruTIy4um6lXW8,9354
|
|
7
|
+
nat/plugins/opentelemetry/span_converter.py,sha256=lgdqXI0yn6OZ8xxo9wOwTmicUTJ_RA9f-uMnCAl2HIk,8846
|
|
8
|
+
nat/plugins/opentelemetry/mixin/__init__.py,sha256=Xs1JQ16L9btwreh4pdGKwskffAw1YFO48jKrU4ib_7c,685
|
|
9
|
+
nat/plugins/opentelemetry/mixin/otlp_span_exporter_mixin.py,sha256=va5TuEMz8raO6NeDCytYm5tL9uyMih3gYiP_H7KmNdU,2808
|
|
10
|
+
nvidia_nat_opentelemetry-1.2.0rc6.dist-info/METADATA,sha256=9sW8949ypgqQRsClIm6YlbGLKgrcUiqKg2spnKxI9K0,1569
|
|
11
|
+
nvidia_nat_opentelemetry-1.2.0rc6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
+
nvidia_nat_opentelemetry-1.2.0rc6.dist-info/entry_points.txt,sha256=gmEKhCafyibUJLGxbn8luTK0UTgIvV2vAtr4uZ8M85I,72
|
|
13
|
+
nvidia_nat_opentelemetry-1.2.0rc6.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
|
14
|
+
nvidia_nat_opentelemetry-1.2.0rc6.dist-info/RECORD,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
nat/meta/pypi.md,sha256=lNE7pC7ozs7bGnoe6mNGsI8s-iu1lO2h4LJgNZpmcJQ,1120
|
|
2
|
-
nat/plugins/opentelemetry/__init__.py,sha256=Xs1JQ16L9btwreh4pdGKwskffAw1YFO48jKrU4ib_7c,685
|
|
3
|
-
nat/plugins/opentelemetry/otel_span.py,sha256=cQgKY12PNw6oo5OizbfZ22FPBbnHcrhq80_zExleR-w,16554
|
|
4
|
-
nat/plugins/opentelemetry/otel_span_exporter.py,sha256=zxlbj0kODcqPeI5zVs_XQR7HsvlOMFhw6iEWJOOLWVM,6559
|
|
5
|
-
nat/plugins/opentelemetry/otlp_span_adapter_exporter.py,sha256=MtkmpLklvyIhCYXHvkY_sZRffwTiAvbQxBen02a89mo,3970
|
|
6
|
-
nat/plugins/opentelemetry/register.py,sha256=ZwOL4aXsnX0bokfuRnYQLrCk27BrUGruTIy4um6lXW8,9354
|
|
7
|
-
nat/plugins/opentelemetry/span_converter.py,sha256=DkmJh_2GYWmezP9lvU-Y_VSKfn1ANDbaimJgGpJ7XiQ,8847
|
|
8
|
-
nat/plugins/opentelemetry/mixin/__init__.py,sha256=Xs1JQ16L9btwreh4pdGKwskffAw1YFO48jKrU4ib_7c,685
|
|
9
|
-
nat/plugins/opentelemetry/mixin/otlp_span_exporter_mixin.py,sha256=va5TuEMz8raO6NeDCytYm5tL9uyMih3gYiP_H7KmNdU,2808
|
|
10
|
-
nvidia_nat_opentelemetry-1.2.0a20250813.dist-info/METADATA,sha256=5JLN1MhhcehcoDp74QclR7mis_KWM1lQciVtCP0wTJ0,1591
|
|
11
|
-
nvidia_nat_opentelemetry-1.2.0a20250813.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
-
nvidia_nat_opentelemetry-1.2.0a20250813.dist-info/entry_points.txt,sha256=gmEKhCafyibUJLGxbn8luTK0UTgIvV2vAtr4uZ8M85I,72
|
|
13
|
-
nvidia_nat_opentelemetry-1.2.0a20250813.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
|
14
|
-
nvidia_nat_opentelemetry-1.2.0a20250813.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|