nvidia-nat-opentelemetry 1.2.1rc1__py3-none-any.whl → 1.3.0__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.
Potentially problematic release.
This version of nvidia-nat-opentelemetry might be problematic. Click here for more details.
- nat/plugins/opentelemetry/__init__.py +12 -0
- nat/plugins/opentelemetry/mixin/otlp_span_exporter_mixin.py +24 -7
- nat/plugins/opentelemetry/otel_span.py +4 -3
- nat/plugins/opentelemetry/otel_span_exporter.py +2 -3
- nat/plugins/opentelemetry/otlp_span_adapter_exporter.py +10 -4
- nat/plugins/opentelemetry/otlp_span_redaction_adapter_exporter.py +149 -0
- nat/plugins/opentelemetry/register.py +13 -13
- nat/plugins/opentelemetry/span_converter.py +4 -4
- {nvidia_nat_opentelemetry-1.2.1rc1.dist-info → nvidia_nat_opentelemetry-1.3.0.dist-info}/METADATA +14 -3
- nvidia_nat_opentelemetry-1.3.0.dist-info/RECORD +17 -0
- nvidia_nat_opentelemetry-1.3.0.dist-info/licenses/LICENSE-3rd-party.txt +5478 -0
- nvidia_nat_opentelemetry-1.3.0.dist-info/licenses/LICENSE.md +201 -0
- nvidia_nat_opentelemetry-1.2.1rc1.dist-info/RECORD +0 -14
- {nvidia_nat_opentelemetry-1.2.1rc1.dist-info → nvidia_nat_opentelemetry-1.3.0.dist-info}/WHEEL +0 -0
- {nvidia_nat_opentelemetry-1.2.1rc1.dist-info → nvidia_nat_opentelemetry-1.3.0.dist-info}/entry_points.txt +0 -0
- {nvidia_nat_opentelemetry-1.2.1rc1.dist-info → nvidia_nat_opentelemetry-1.3.0.dist-info}/top_level.txt +0 -0
|
@@ -12,3 +12,15 @@
|
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
from nat.plugins.opentelemetry.mixin.otlp_span_exporter_mixin import OTLPProtocol
|
|
17
|
+
from nat.plugins.opentelemetry.otel_span_exporter import OtelSpanExporter
|
|
18
|
+
from nat.plugins.opentelemetry.otlp_span_adapter_exporter import OTLPSpanAdapterExporter
|
|
19
|
+
from nat.plugins.opentelemetry.otlp_span_redaction_adapter_exporter import OTLPSpanHeaderRedactionAdapterExporter
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"OTLPProtocol",
|
|
23
|
+
"OTLPSpanHeaderRedactionAdapterExporter",
|
|
24
|
+
"OTLPSpanAdapterExporter",
|
|
25
|
+
"OtelSpanExporter",
|
|
26
|
+
]
|
|
@@ -14,44 +14,61 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
16
|
import logging
|
|
17
|
-
|
|
18
|
-
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
|
17
|
+
from typing import Literal
|
|
19
18
|
|
|
20
19
|
from nat.plugins.opentelemetry.otel_span import OtelSpan
|
|
20
|
+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter as OTLPSpanExporterGRPC
|
|
21
|
+
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter as OTLPSpanExporterHTTP
|
|
21
22
|
|
|
22
23
|
logger = logging.getLogger(__name__)
|
|
23
24
|
|
|
25
|
+
OTLPProtocol = Literal['http', 'grpc']
|
|
26
|
+
|
|
24
27
|
|
|
25
28
|
class OTLPSpanExporterMixin:
|
|
26
29
|
"""Mixin for OTLP span exporters.
|
|
27
30
|
|
|
28
31
|
This mixin provides OTLP-specific functionality for OpenTelemetry span exporters.
|
|
29
|
-
It handles OTLP protocol transmission using the standard OpenTelemetry OTLP
|
|
32
|
+
It handles OTLP protocol transmission using the standard OpenTelemetry OTLP exporters.
|
|
30
33
|
|
|
31
34
|
Key Features:
|
|
32
|
-
- Standard OTLP HTTP protocol support for span export
|
|
35
|
+
- Standard OTLP HTTP and gRPC protocol support for span export
|
|
33
36
|
- Configurable endpoint and headers for authentication/routing
|
|
34
37
|
- Integration with OpenTelemetry's OTLPSpanExporter for reliable transmission
|
|
35
38
|
- Works with any OTLP-compatible collector or service
|
|
36
39
|
|
|
37
40
|
This mixin is designed to be used with OtelSpanExporter as a base class:
|
|
38
41
|
|
|
39
|
-
Example
|
|
42
|
+
Example::
|
|
43
|
+
|
|
40
44
|
class MyOTLPExporter(OtelSpanExporter, OTLPSpanExporterMixin):
|
|
41
45
|
def __init__(self, endpoint, headers, **kwargs):
|
|
42
46
|
super().__init__(endpoint=endpoint, headers=headers, **kwargs)
|
|
43
47
|
"""
|
|
44
48
|
|
|
45
|
-
def __init__(self,
|
|
49
|
+
def __init__(self,
|
|
50
|
+
*args,
|
|
51
|
+
endpoint: str,
|
|
52
|
+
headers: dict[str, str] | None = None,
|
|
53
|
+
protocol: OTLPProtocol = 'http',
|
|
54
|
+
**kwargs):
|
|
46
55
|
"""Initialize the OTLP span exporter.
|
|
47
56
|
|
|
48
57
|
Args:
|
|
49
58
|
endpoint: OTLP service endpoint URL.
|
|
50
59
|
headers: HTTP headers for authentication and metadata.
|
|
60
|
+
protocol: Transport protocol to use ('http' or 'grpc'). Defaults to 'http'.
|
|
51
61
|
"""
|
|
52
62
|
# Initialize exporter before super().__init__() to ensure it's available
|
|
53
63
|
# if parent class initialization potentially calls export_otel_spans()
|
|
54
|
-
|
|
64
|
+
|
|
65
|
+
if protocol == 'http':
|
|
66
|
+
self._exporter = OTLPSpanExporterHTTP(endpoint=endpoint, headers=headers)
|
|
67
|
+
elif protocol == 'grpc':
|
|
68
|
+
self._exporter = OTLPSpanExporterGRPC(endpoint=endpoint, headers=headers)
|
|
69
|
+
else:
|
|
70
|
+
raise ValueError(f"Invalid protocol: {protocol}")
|
|
71
|
+
|
|
55
72
|
super().__init__(*args, **kwargs)
|
|
56
73
|
|
|
57
74
|
async def export_otel_spans(self, spans: list[OtelSpan]) -> None:
|
|
@@ -46,7 +46,7 @@ class MimeTypes(Enum):
|
|
|
46
46
|
JSON = "application/json"
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
class OtelSpan(Span):
|
|
49
|
+
class OtelSpan(Span):
|
|
50
50
|
"""A manually created OpenTelemetry span.
|
|
51
51
|
|
|
52
52
|
This class is a wrapper around the OpenTelemetry Span class.
|
|
@@ -86,8 +86,9 @@ class OtelSpan(Span): # pylint: disable=too-many-public-methods
|
|
|
86
86
|
self._name = name
|
|
87
87
|
# Create a new SpanContext if none provided or if Context is provided
|
|
88
88
|
if context is None or isinstance(context, Context):
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
# Generate non-zero IDs per OTel spec (uuid4 is automatically non-zero)
|
|
90
|
+
trace_id = uuid.uuid4().int
|
|
91
|
+
span_id = uuid.uuid4().int >> 64
|
|
91
92
|
self._context = SpanContext(
|
|
92
93
|
trace_id=trace_id,
|
|
93
94
|
span_id=span_id,
|
|
@@ -18,8 +18,6 @@ from abc import abstractmethod
|
|
|
18
18
|
from importlib.metadata import PackageNotFoundError
|
|
19
19
|
from importlib.metadata import version
|
|
20
20
|
|
|
21
|
-
from opentelemetry.sdk.resources import Resource
|
|
22
|
-
|
|
23
21
|
from nat.builder.context import ContextState
|
|
24
22
|
from nat.data_models.span import Span
|
|
25
23
|
from nat.observability.exporter.span_exporter import SpanExporter
|
|
@@ -27,6 +25,7 @@ from nat.observability.processor.batching_processor import BatchingProcessor
|
|
|
27
25
|
from nat.observability.processor.processor import Processor
|
|
28
26
|
from nat.plugins.opentelemetry.otel_span import OtelSpan
|
|
29
27
|
from nat.plugins.opentelemetry.span_converter import convert_span_to_otel
|
|
28
|
+
from opentelemetry.sdk.resources import Resource
|
|
30
29
|
|
|
31
30
|
logger = logging.getLogger(__name__)
|
|
32
31
|
|
|
@@ -60,7 +59,7 @@ class OtelSpanBatchProcessor(BatchingProcessor[OtelSpan]):
|
|
|
60
59
|
pass
|
|
61
60
|
|
|
62
61
|
|
|
63
|
-
class OtelSpanExporter(SpanExporter[Span, OtelSpan]):
|
|
62
|
+
class OtelSpanExporter(SpanExporter[Span, OtelSpan]):
|
|
64
63
|
"""Abstract base class for OpenTelemetry exporters.
|
|
65
64
|
|
|
66
65
|
This class provides a specialized implementation for OpenTelemetry exporters.
|
|
@@ -16,13 +16,14 @@
|
|
|
16
16
|
import logging
|
|
17
17
|
|
|
18
18
|
from nat.builder.context import ContextState
|
|
19
|
+
from nat.plugins.opentelemetry.mixin.otlp_span_exporter_mixin import OTLPProtocol
|
|
19
20
|
from nat.plugins.opentelemetry.mixin.otlp_span_exporter_mixin import OTLPSpanExporterMixin
|
|
20
21
|
from nat.plugins.opentelemetry.otel_span_exporter import OtelSpanExporter
|
|
21
22
|
|
|
22
23
|
logger = logging.getLogger(__name__)
|
|
23
24
|
|
|
24
25
|
|
|
25
|
-
class OTLPSpanAdapterExporter(OTLPSpanExporterMixin, OtelSpanExporter):
|
|
26
|
+
class OTLPSpanAdapterExporter(OTLPSpanExporterMixin, OtelSpanExporter):
|
|
26
27
|
"""An OpenTelemetry OTLP span exporter for sending traces to OTLP-compatible services.
|
|
27
28
|
|
|
28
29
|
This class combines the OtelSpanExporter base functionality with OTLP-specific
|
|
@@ -32,7 +33,7 @@ class OTLPSpanAdapterExporter(OTLPSpanExporterMixin, OtelSpanExporter): # pylin
|
|
|
32
33
|
Key Features:
|
|
33
34
|
- Complete span processing pipeline (IntermediateStep → Span → OtelSpan → Export)
|
|
34
35
|
- Batching support for efficient transmission
|
|
35
|
-
- OTLP HTTP protocol for maximum compatibility
|
|
36
|
+
- OTLP HTTP and gRPC protocol for maximum compatibility
|
|
36
37
|
- Configurable authentication via headers
|
|
37
38
|
- Resource attribute management
|
|
38
39
|
- Error handling and retry logic
|
|
@@ -43,10 +44,12 @@ class OTLPSpanAdapterExporter(OTLPSpanExporterMixin, OtelSpanExporter): # pylin
|
|
|
43
44
|
- Grafana Tempo
|
|
44
45
|
- Custom OTLP-compatible backends
|
|
45
46
|
|
|
46
|
-
Example
|
|
47
|
+
Example::
|
|
48
|
+
|
|
47
49
|
exporter = OTLPSpanAdapterExporter(
|
|
48
50
|
endpoint="https://api.service.com/v1/traces",
|
|
49
51
|
headers={"Authorization": "Bearer your-token"},
|
|
52
|
+
protocol='http',
|
|
50
53
|
batch_size=50,
|
|
51
54
|
flush_interval=10.0
|
|
52
55
|
)
|
|
@@ -66,6 +69,7 @@ class OTLPSpanAdapterExporter(OTLPSpanExporterMixin, OtelSpanExporter): # pylin
|
|
|
66
69
|
# OTLPSpanExporterMixin args
|
|
67
70
|
endpoint: str,
|
|
68
71
|
headers: dict[str, str] | None = None,
|
|
72
|
+
protocol: OTLPProtocol = 'http',
|
|
69
73
|
**otlp_kwargs):
|
|
70
74
|
"""Initialize the OTLP span exporter.
|
|
71
75
|
|
|
@@ -79,7 +83,8 @@ class OTLPSpanAdapterExporter(OTLPSpanExporterMixin, OtelSpanExporter): # pylin
|
|
|
79
83
|
resource_attributes: Additional resource attributes for spans.
|
|
80
84
|
endpoint: The endpoint for the OTLP service.
|
|
81
85
|
headers: The headers for the OTLP service.
|
|
82
|
-
|
|
86
|
+
protocol: The protocol to use for the OTLP service, default is 'http'.
|
|
87
|
+
otlp_kwargs: Additional keyword arguments for the OTLP service.
|
|
83
88
|
"""
|
|
84
89
|
super().__init__(context_state=context_state,
|
|
85
90
|
batch_size=batch_size,
|
|
@@ -90,4 +95,5 @@ class OTLPSpanAdapterExporter(OTLPSpanExporterMixin, OtelSpanExporter): # pylin
|
|
|
90
95
|
resource_attributes=resource_attributes,
|
|
91
96
|
endpoint=endpoint,
|
|
92
97
|
headers=headers,
|
|
98
|
+
protocol=protocol,
|
|
93
99
|
**otlp_kwargs)
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
import logging
|
|
17
|
+
from collections.abc import Callable
|
|
18
|
+
from collections.abc import Mapping
|
|
19
|
+
from enum import Enum
|
|
20
|
+
from typing import Any
|
|
21
|
+
|
|
22
|
+
from nat.builder.context import ContextState
|
|
23
|
+
from nat.observability.processor.redaction import SpanHeaderRedactionProcessor
|
|
24
|
+
from nat.observability.processor.span_tagging_processor import SpanTaggingProcessor
|
|
25
|
+
from nat.plugins.opentelemetry.mixin.otlp_span_exporter_mixin import OTLPProtocol
|
|
26
|
+
from nat.plugins.opentelemetry.otlp_span_adapter_exporter import OTLPSpanAdapterExporter
|
|
27
|
+
|
|
28
|
+
logger = logging.getLogger(__name__)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class OTLPSpanHeaderRedactionAdapterExporter(OTLPSpanAdapterExporter):
|
|
32
|
+
"""An OpenTelemetry OTLP span exporter with built-in redaction and privacy tagging.
|
|
33
|
+
|
|
34
|
+
This class extends OTLPSpanAdapterExporter to provide automatic span redaction
|
|
35
|
+
and privacy tagging capabilities. It automatically adds header-based redaction
|
|
36
|
+
and span tagging processors to the processing pipeline.
|
|
37
|
+
|
|
38
|
+
Key Features:
|
|
39
|
+
- Header-based span redaction with configurable callback logic
|
|
40
|
+
- Privacy level tagging for compliance and governance
|
|
41
|
+
- Complete span processing pipeline (IntermediateStep → Span → Redaction → Tagging → OtelSpan → Batching → Export)
|
|
42
|
+
- Batching support for efficient transmission
|
|
43
|
+
- OTLP HTTP and gRPC protocol for maximum compatibility
|
|
44
|
+
- Configurable authentication via headers
|
|
45
|
+
- Resource attribute management
|
|
46
|
+
- Error handling and retry logic
|
|
47
|
+
|
|
48
|
+
The redaction processor allows conditional redaction based on authentication headers,
|
|
49
|
+
while the tagging processor adds privacy-level metadata to spans for downstream
|
|
50
|
+
processing and compliance tracking.
|
|
51
|
+
|
|
52
|
+
This exporter is commonly used with services like:
|
|
53
|
+
- OpenTelemetry Collector
|
|
54
|
+
- DataDog (OTLP endpoint)
|
|
55
|
+
- Jaeger (OTLP endpoint)
|
|
56
|
+
- Grafana Tempo
|
|
57
|
+
- Custom OTLP-compatible backends
|
|
58
|
+
|
|
59
|
+
Example::
|
|
60
|
+
|
|
61
|
+
def should_redact(auth_key: str) -> bool:
|
|
62
|
+
return auth_key in ["sensitive_user", "test_user"]
|
|
63
|
+
|
|
64
|
+
exporter = OTLPSpanRedactionAdapterExporter(
|
|
65
|
+
endpoint="https://api.service.com/v1/traces",
|
|
66
|
+
headers={"Authorization": "Bearer your-token"},
|
|
67
|
+
protocol='http',
|
|
68
|
+
redaction_attributes=["user.email", "request.body"],
|
|
69
|
+
redaction_headers=["x-user-id"],
|
|
70
|
+
redaction_callback=should_redact,
|
|
71
|
+
redaction_value="REDACTED",
|
|
72
|
+
tags={"privacy.level": PrivacyLevel.HIGH, "service.type": "sensitive"},
|
|
73
|
+
batch_size=50,
|
|
74
|
+
flush_interval=10.0
|
|
75
|
+
)
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
def __init__(
|
|
79
|
+
self,
|
|
80
|
+
*,
|
|
81
|
+
# OtelSpanExporter args
|
|
82
|
+
context_state: ContextState | None = None,
|
|
83
|
+
batch_size: int = 100,
|
|
84
|
+
flush_interval: float = 5.0,
|
|
85
|
+
max_queue_size: int = 1000,
|
|
86
|
+
drop_on_overflow: bool = False,
|
|
87
|
+
shutdown_timeout: float = 10.0,
|
|
88
|
+
resource_attributes: dict[str, str] | None = None,
|
|
89
|
+
# Redaction args
|
|
90
|
+
redaction_attributes: list[str] | None = None,
|
|
91
|
+
redaction_headers: list[str] | None = None,
|
|
92
|
+
redaction_callback: Callable[..., Any] | None = None,
|
|
93
|
+
redaction_enabled: bool = False,
|
|
94
|
+
force_redaction: bool = False,
|
|
95
|
+
redaction_value: str = "[REDACTED]",
|
|
96
|
+
redaction_tag: str | None = None,
|
|
97
|
+
tags: Mapping[str, Enum | str] | None = None,
|
|
98
|
+
# OTLPSpanExporterMixin args
|
|
99
|
+
endpoint: str,
|
|
100
|
+
headers: dict[str, str] | None = None,
|
|
101
|
+
protocol: OTLPProtocol = 'http',
|
|
102
|
+
**otlp_kwargs):
|
|
103
|
+
"""Initialize the OTLP span exporter with redaction and tagging capabilities.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
context_state: The context state for the exporter.
|
|
107
|
+
batch_size: Number of spans to batch before exporting, default is 100.
|
|
108
|
+
flush_interval: Time in seconds between automatic batch flushes, default is 5.0.
|
|
109
|
+
max_queue_size: Maximum number of spans to queue, default is 1000.
|
|
110
|
+
drop_on_overflow: Whether to drop spans when queue is full, default is False.
|
|
111
|
+
shutdown_timeout: Maximum time to wait for export completion during shutdown, default is 10.0.
|
|
112
|
+
resource_attributes: Additional resource attributes for spans.
|
|
113
|
+
redaction_attributes: List of span attribute keys to redact when conditions are met.
|
|
114
|
+
redaction_headers: List of header keys to check for authentication/user identification.
|
|
115
|
+
redaction_callback: Function that returns true to redact spans based on header value, false otherwise.
|
|
116
|
+
redaction_enabled: Whether the redaction processor is enabled, default is False.
|
|
117
|
+
force_redaction: If True, always redact regardless of header checks, default is False.
|
|
118
|
+
redaction_value: Value to replace redacted attributes with, default is "[REDACTED]".
|
|
119
|
+
tags: Mapping of tag keys to their values (enums or strings) to add to spans.
|
|
120
|
+
redaction_tag: Tag to add to spans when redaction occurs.
|
|
121
|
+
endpoint: The endpoint for the OTLP service.
|
|
122
|
+
headers: The headers for the OTLP service.
|
|
123
|
+
protocol: The protocol to use for the OTLP service, default is 'http'.
|
|
124
|
+
otlp_kwargs: Additional keyword arguments for the OTLP service.
|
|
125
|
+
"""
|
|
126
|
+
super().__init__(context_state=context_state,
|
|
127
|
+
batch_size=batch_size,
|
|
128
|
+
flush_interval=flush_interval,
|
|
129
|
+
max_queue_size=max_queue_size,
|
|
130
|
+
drop_on_overflow=drop_on_overflow,
|
|
131
|
+
shutdown_timeout=shutdown_timeout,
|
|
132
|
+
resource_attributes=resource_attributes,
|
|
133
|
+
endpoint=endpoint,
|
|
134
|
+
headers=headers,
|
|
135
|
+
protocol=protocol,
|
|
136
|
+
**otlp_kwargs)
|
|
137
|
+
|
|
138
|
+
# Insert redaction and tagging processors to the front of the processing pipeline
|
|
139
|
+
self.add_processor(SpanHeaderRedactionProcessor(attributes=redaction_attributes or [],
|
|
140
|
+
headers=redaction_headers or [],
|
|
141
|
+
callback=redaction_callback or (lambda _: False),
|
|
142
|
+
enabled=redaction_enabled,
|
|
143
|
+
force_redact=force_redaction,
|
|
144
|
+
redaction_value=redaction_value,
|
|
145
|
+
redaction_tag=redaction_tag),
|
|
146
|
+
name="header_redaction",
|
|
147
|
+
position=0)
|
|
148
|
+
|
|
149
|
+
self.add_processor(SpanTaggingProcessor(tags=tags), name="span_sensitivity_tagging", position=1)
|
|
@@ -38,18 +38,18 @@ class LangfuseTelemetryExporter(BatchConfigMixin, TelemetryExporterBaseConfig, n
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
@register_telemetry_exporter(config_type=LangfuseTelemetryExporter)
|
|
41
|
-
async def langfuse_telemetry_exporter(config: LangfuseTelemetryExporter, builder: Builder):
|
|
41
|
+
async def langfuse_telemetry_exporter(config: LangfuseTelemetryExporter, builder: Builder):
|
|
42
42
|
|
|
43
43
|
import base64
|
|
44
44
|
|
|
45
|
-
from nat.plugins.opentelemetry
|
|
45
|
+
from nat.plugins.opentelemetry import OTLPSpanAdapterExporter
|
|
46
46
|
|
|
47
47
|
secret_key = config.secret_key or os.environ.get("LANGFUSE_SECRET_KEY")
|
|
48
48
|
public_key = config.public_key or os.environ.get("LANGFUSE_PUBLIC_KEY")
|
|
49
49
|
if not secret_key or not public_key:
|
|
50
50
|
raise ValueError("secret and public keys are required for langfuse")
|
|
51
51
|
|
|
52
|
-
credentials = f"{public_key}:{secret_key}".encode(
|
|
52
|
+
credentials = f"{public_key}:{secret_key}".encode()
|
|
53
53
|
auth_header = base64.b64encode(credentials).decode("utf-8")
|
|
54
54
|
headers = {"Authorization": f"Basic {auth_header}"}
|
|
55
55
|
|
|
@@ -75,10 +75,10 @@ class LangsmithTelemetryExporter(BatchConfigMixin, CollectorConfigMixin, Telemet
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
@register_telemetry_exporter(config_type=LangsmithTelemetryExporter)
|
|
78
|
-
async def langsmith_telemetry_exporter(config: LangsmithTelemetryExporter, builder: Builder):
|
|
78
|
+
async def langsmith_telemetry_exporter(config: LangsmithTelemetryExporter, builder: Builder):
|
|
79
79
|
"""Create a Langsmith telemetry exporter."""
|
|
80
80
|
|
|
81
|
-
from nat.plugins.opentelemetry
|
|
81
|
+
from nat.plugins.opentelemetry import OTLPSpanAdapterExporter
|
|
82
82
|
|
|
83
83
|
api_key = config.api_key or os.environ.get("LANGSMITH_API_KEY")
|
|
84
84
|
if not api_key:
|
|
@@ -105,11 +105,11 @@ class OtelCollectorTelemetryExporter(BatchConfigMixin,
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
@register_telemetry_exporter(config_type=OtelCollectorTelemetryExporter)
|
|
108
|
-
async def otel_telemetry_exporter(config: OtelCollectorTelemetryExporter, builder: Builder):
|
|
108
|
+
async def otel_telemetry_exporter(config: OtelCollectorTelemetryExporter, builder: Builder):
|
|
109
109
|
"""Create an OpenTelemetry telemetry exporter."""
|
|
110
110
|
|
|
111
|
+
from nat.plugins.opentelemetry import OTLPSpanAdapterExporter
|
|
111
112
|
from nat.plugins.opentelemetry.otel_span_exporter import get_opentelemetry_sdk_version
|
|
112
|
-
from nat.plugins.opentelemetry.otlp_span_adapter_exporter import OTLPSpanAdapterExporter
|
|
113
113
|
|
|
114
114
|
# Default resource attributes
|
|
115
115
|
default_resource_attributes = {
|
|
@@ -140,10 +140,10 @@ class PatronusTelemetryExporter(BatchConfigMixin, CollectorConfigMixin, Telemetr
|
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
@register_telemetry_exporter(config_type=PatronusTelemetryExporter)
|
|
143
|
-
async def patronus_telemetry_exporter(config: PatronusTelemetryExporter, builder: Builder):
|
|
143
|
+
async def patronus_telemetry_exporter(config: PatronusTelemetryExporter, builder: Builder):
|
|
144
144
|
"""Create a Patronus telemetry exporter."""
|
|
145
145
|
|
|
146
|
-
from nat.plugins.opentelemetry
|
|
146
|
+
from nat.plugins.opentelemetry import OTLPSpanAdapterExporter
|
|
147
147
|
|
|
148
148
|
api_key = config.api_key or os.environ.get("PATRONUS_API_KEY")
|
|
149
149
|
if not api_key:
|
|
@@ -159,10 +159,10 @@ async def patronus_telemetry_exporter(config: PatronusTelemetryExporter, builder
|
|
|
159
159
|
flush_interval=config.flush_interval,
|
|
160
160
|
max_queue_size=config.max_queue_size,
|
|
161
161
|
drop_on_overflow=config.drop_on_overflow,
|
|
162
|
-
shutdown_timeout=config.shutdown_timeout
|
|
162
|
+
shutdown_timeout=config.shutdown_timeout,
|
|
163
|
+
protocol="grpc")
|
|
163
164
|
|
|
164
165
|
|
|
165
|
-
# pylint: disable=W0613
|
|
166
166
|
class GalileoTelemetryExporter(BatchConfigMixin, CollectorConfigMixin, TelemetryExporterBaseConfig, name="galileo"):
|
|
167
167
|
"""A telemetry exporter to transmit traces to externally hosted galileo service."""
|
|
168
168
|
|
|
@@ -173,10 +173,10 @@ class GalileoTelemetryExporter(BatchConfigMixin, CollectorConfigMixin, Telemetry
|
|
|
173
173
|
|
|
174
174
|
|
|
175
175
|
@register_telemetry_exporter(config_type=GalileoTelemetryExporter)
|
|
176
|
-
async def galileo_telemetry_exporter(config: GalileoTelemetryExporter, builder: Builder):
|
|
176
|
+
async def galileo_telemetry_exporter(config: GalileoTelemetryExporter, builder: Builder):
|
|
177
177
|
"""Create a Galileo telemetry exporter."""
|
|
178
178
|
|
|
179
|
-
from nat.plugins.opentelemetry
|
|
179
|
+
from nat.plugins.opentelemetry import OTLPSpanAdapterExporter
|
|
180
180
|
|
|
181
181
|
headers = {
|
|
182
182
|
"Galileo-API-Key": config.api_key,
|
|
@@ -18,16 +18,16 @@ import time
|
|
|
18
18
|
|
|
19
19
|
from openinference.semconv.trace import OpenInferenceSpanKindValues
|
|
20
20
|
from openinference.semconv.trace import SpanAttributes
|
|
21
|
+
|
|
22
|
+
from nat.data_models.span import Span
|
|
23
|
+
from nat.data_models.span import SpanStatusCode
|
|
24
|
+
from nat.plugins.opentelemetry.otel_span import OtelSpan
|
|
21
25
|
from opentelemetry.trace import SpanContext
|
|
22
26
|
from opentelemetry.trace import SpanKind
|
|
23
27
|
from opentelemetry.trace import Status
|
|
24
28
|
from opentelemetry.trace import StatusCode
|
|
25
29
|
from opentelemetry.trace import TraceFlags
|
|
26
30
|
|
|
27
|
-
from nat.data_models.span import Span
|
|
28
|
-
from nat.data_models.span import SpanStatusCode
|
|
29
|
-
from nat.plugins.opentelemetry.otel_span import OtelSpan
|
|
30
|
-
|
|
31
31
|
logger = logging.getLogger(__name__)
|
|
32
32
|
|
|
33
33
|
SPAN_EVENT_TYPE_TO_SPAN_KIND_MAP = {
|
{nvidia_nat_opentelemetry-1.2.1rc1.dist-info → nvidia_nat_opentelemetry-1.3.0.dist-info}/METADATA
RENAMED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nvidia-nat-opentelemetry
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Subpackage for OpenTelemetry integration in NeMo Agent toolkit
|
|
5
|
+
Author: NVIDIA Corporation
|
|
6
|
+
Maintainer: NVIDIA Corporation
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
Project-URL: documentation, https://docs.nvidia.com/nemo/agent-toolkit/latest/
|
|
9
|
+
Project-URL: source, https://github.com/NVIDIA/NeMo-Agent-Toolkit
|
|
5
10
|
Keywords: ai,observability,opentelemetry
|
|
6
11
|
Classifier: Programming Language :: Python
|
|
7
|
-
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Requires-Python: <3.14,>=3.11
|
|
8
16
|
Description-Content-Type: text/markdown
|
|
9
|
-
|
|
17
|
+
License-File: LICENSE-3rd-party.txt
|
|
18
|
+
License-File: LICENSE.md
|
|
19
|
+
Requires-Dist: nvidia-nat==v1.3.0
|
|
10
20
|
Requires-Dist: opentelemetry-api~=1.2
|
|
11
21
|
Requires-Dist: opentelemetry-exporter-otlp~=1.3
|
|
12
22
|
Requires-Dist: opentelemetry-sdk~=1.3
|
|
23
|
+
Dynamic: license-file
|
|
13
24
|
|
|
14
25
|
<!--
|
|
15
26
|
SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
nat/meta/pypi.md,sha256=_o1o1BLPY1pvjCkklWxlm7LlIDMPCk-2Rho85NUuN8U,1109
|
|
2
|
+
nat/plugins/opentelemetry/__init__.py,sha256=6RYrwlYGss4SzyAwjcbgFTLKaLk9jEIHTGEAF8XiC5E,1181
|
|
3
|
+
nat/plugins/opentelemetry/otel_span.py,sha256=MC_ROZ8gSTu0gxRaaz77UDbn1ouZTZP3N_-0PcN140U,16564
|
|
4
|
+
nat/plugins/opentelemetry/otel_span_exporter.py,sha256=YO7JsQgi8Cf2OQBJ_s78HwJjrWx9SdqMvPen3Pa2_bI,6533
|
|
5
|
+
nat/plugins/opentelemetry/otlp_span_adapter_exporter.py,sha256=cWBfPKHET7U1oRMs1QMXvg-z1c1DaqYrLzHIyUUbfGM,4237
|
|
6
|
+
nat/plugins/opentelemetry/otlp_span_redaction_adapter_exporter.py,sha256=YnoQlktT6EJRM7o8bhvYQcdGrAdOXNEk8wOimK_Wy88,7509
|
|
7
|
+
nat/plugins/opentelemetry/register.py,sha256=cgYbX1xuUl3FOYe6yXFV7dFogV5KBCi0_ZrQKXLz3a8,9114
|
|
8
|
+
nat/plugins/opentelemetry/span_converter.py,sha256=Gz3KvRNQeEBBlpaPO8YRAJkw4fmzV7m9bT6dGX0IV2E,8846
|
|
9
|
+
nat/plugins/opentelemetry/mixin/__init__.py,sha256=Xs1JQ16L9btwreh4pdGKwskffAw1YFO48jKrU4ib_7c,685
|
|
10
|
+
nat/plugins/opentelemetry/mixin/otlp_span_exporter_mixin.py,sha256=BN8fRHHEHEWZyrYoudl9lSeH--I2RY2dJVPyWIgDB0I,3454
|
|
11
|
+
nvidia_nat_opentelemetry-1.3.0.dist-info/licenses/LICENSE-3rd-party.txt,sha256=fOk5jMmCX9YoKWyYzTtfgl-SUy477audFC5hNY4oP7Q,284609
|
|
12
|
+
nvidia_nat_opentelemetry-1.3.0.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
13
|
+
nvidia_nat_opentelemetry-1.3.0.dist-info/METADATA,sha256=xlaL46W0ZP6FRzXjOyEwQpxS3jOhIcSJKb0-8OwmmZQ,2021
|
|
14
|
+
nvidia_nat_opentelemetry-1.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
+
nvidia_nat_opentelemetry-1.3.0.dist-info/entry_points.txt,sha256=gmEKhCafyibUJLGxbn8luTK0UTgIvV2vAtr4uZ8M85I,72
|
|
16
|
+
nvidia_nat_opentelemetry-1.3.0.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
|
17
|
+
nvidia_nat_opentelemetry-1.3.0.dist-info/RECORD,,
|