Convenience meta-package for OpenTelemetry Jaeger exporters that installs both gRPC and Thrift-based trace exporters.
npx @tessl/cli install tessl/pypi-opentelemetry-exporter-jaeger@1.21.00
# OpenTelemetry Jaeger Exporter
1
2
A convenience meta-package that provides unified access to OpenTelemetry Jaeger trace exporters. This package automatically installs both gRPC Protocol Buffer and Thrift-based Jaeger exporters, allowing users to export OpenTelemetry traces to Jaeger tracing systems with multiple serialization methods.
3
4
**Important**: This package is deprecated. Since Jaeger v1.35+, Jaeger supports OTLP natively. New implementations should use the OTLP exporter instead.
5
6
## Package Information
7
8
- **Package Name**: opentelemetry-exporter-jaeger
9
- **Package Type**: pypi
10
- **Language**: Python
11
- **Installation**: `pip install opentelemetry-exporter-jaeger`
12
- **Status**: Deprecated (support ends July 2023)
13
14
## Core Imports
15
16
Access the gRPC-based exporter (recommended):
17
18
```python
19
from opentelemetry.exporter.jaeger.proto.grpc import JaegerExporter
20
```
21
22
Access the Thrift-based exporter:
23
24
```python
25
from opentelemetry.exporter.jaeger.thrift import JaegerExporter
26
```
27
28
Access package version:
29
30
```python
31
from opentelemetry.exporter.jaeger.version import __version__
32
```
33
34
Access default constants:
35
36
```python
37
# gRPC exporter constants
38
from opentelemetry.exporter.jaeger.proto.grpc import (
39
DEFAULT_GRPC_COLLECTOR_ENDPOINT,
40
DEFAULT_EXPORT_TIMEOUT
41
)
42
43
# Thrift exporter constants
44
from opentelemetry.exporter.jaeger.thrift import (
45
DEFAULT_AGENT_HOST_NAME,
46
DEFAULT_AGENT_PORT,
47
DEFAULT_EXPORT_TIMEOUT
48
)
49
```
50
51
## Architecture
52
53
This meta-package provides a unified interface to OpenTelemetry's Jaeger exporters by automatically installing both supported implementations:
54
55
- **gRPC Protocol Buffer Exporter**: Uses Protocol Buffers over gRPC for efficient binary communication
56
- **Thrift Protocol Exporter**: Uses Thrift protocol over UDP (agent) or HTTP (collector) for legacy compatibility
57
58
The package registers a default entry point (`jaeger`) that references the gRPC implementation, while both exporters remain available for direct use based on specific deployment requirements.
59
60
## Basic Usage
61
62
### Using the gRPC Exporter (Default)
63
64
```python
65
from opentelemetry import trace
66
from opentelemetry.exporter.jaeger.proto.grpc import JaegerExporter
67
from opentelemetry.sdk.trace import TracerProvider
68
from opentelemetry.sdk.trace.export import BatchSpanProcessor
69
70
# Set up the tracer provider
71
trace.set_tracer_provider(TracerProvider())
72
tracer = trace.get_tracer(__name__)
73
74
# Create a Jaeger exporter (gRPC)
75
jaeger_exporter = JaegerExporter(
76
collector_endpoint='localhost:14250',
77
insecure=True
78
)
79
80
# Create a batch span processor and add the exporter
81
span_processor = BatchSpanProcessor(jaeger_exporter)
82
trace.get_tracer_provider().add_span_processor(span_processor)
83
84
# Create and export spans
85
with tracer.start_as_current_span('example-span'):
86
print('Hello from OpenTelemetry!')
87
```
88
89
### Using the Thrift Exporter
90
91
```python
92
from opentelemetry import trace
93
from opentelemetry.exporter.jaeger.thrift import JaegerExporter
94
from opentelemetry.sdk.trace import TracerProvider
95
from opentelemetry.sdk.trace.export import BatchSpanProcessor
96
97
# Set up the tracer provider
98
trace.set_tracer_provider(TracerProvider())
99
tracer = trace.get_tracer(__name__)
100
101
# Create a Jaeger exporter (Thrift)
102
jaeger_exporter = JaegerExporter(
103
agent_host_name='localhost',
104
agent_port=6831
105
)
106
107
# Create a batch span processor and add the exporter
108
span_processor = BatchSpanProcessor(jaeger_exporter)
109
trace.get_tracer_provider().add_span_processor(span_processor)
110
111
# Create and export spans
112
with tracer.start_as_current_span('example-span'):
113
print('Hello from OpenTelemetry!')
114
```
115
116
## Capabilities
117
118
### gRPC Protocol Buffer Exporter
119
120
Exports OpenTelemetry traces to Jaeger using Protocol Buffers over gRPC. This is the default exporter referenced by the package's entry point.
121
122
```python { .api }
123
class JaegerExporter(SpanExporter):
124
def __init__(
125
self,
126
collector_endpoint: Optional[str] = None,
127
insecure: Optional[bool] = None,
128
credentials: Optional[ChannelCredentials] = None,
129
max_tag_value_length: Optional[int] = None,
130
timeout: Optional[int] = None,
131
):
132
"""
133
Initialize the Jaeger gRPC exporter.
134
135
Args:
136
collector_endpoint: Jaeger collector endpoint (default: "localhost:14250")
137
insecure: Whether to use insecure connection (default: False)
138
credentials: gRPC channel credentials for secure connections
139
max_tag_value_length: Maximum length for string attribute values
140
timeout: Export timeout in seconds (default: 10)
141
"""
142
143
def export(self, spans) -> SpanExportResult:
144
"""
145
Export a batch of spans to Jaeger.
146
147
Args:
148
spans: List of spans to export
149
150
Returns:
151
SpanExportResult: SUCCESS or FAILURE
152
"""
153
154
def shutdown(self):
155
"""Shutdown the exporter."""
156
157
def force_flush(self, timeout_millis: int = 30000) -> bool:
158
"""
159
Force flush pending data.
160
161
Args:
162
timeout_millis: Timeout in milliseconds
163
164
Returns:
165
bool: True if successful
166
"""
167
```
168
169
### Thrift Protocol Exporter
170
171
Exports OpenTelemetry traces to Jaeger using Thrift protocol over UDP or HTTP. Supports both agent-based (UDP) and collector-based (HTTP) configurations.
172
173
```python { .api }
174
class JaegerExporter(SpanExporter):
175
def __init__(
176
self,
177
agent_host_name: Optional[str] = None,
178
agent_port: Optional[int] = None,
179
collector_endpoint: Optional[str] = None,
180
username: Optional[str] = None,
181
password: Optional[str] = None,
182
max_tag_value_length: Optional[int] = None,
183
udp_split_oversized_batches: bool = None,
184
timeout: Optional[int] = None,
185
):
186
"""
187
Initialize the Jaeger Thrift exporter.
188
189
Args:
190
agent_host_name: Jaeger agent hostname (default: "localhost")
191
agent_port: Jaeger agent port (default: 6831)
192
collector_endpoint: Jaeger collector HTTP endpoint
193
username: Basic authentication username
194
password: Basic authentication password
195
max_tag_value_length: Maximum length for string attribute values
196
udp_split_oversized_batches: Split oversized UDP batches
197
timeout: Export timeout in seconds (default: 10)
198
"""
199
200
def export(self, spans) -> SpanExportResult:
201
"""
202
Export a batch of spans to Jaeger.
203
204
Args:
205
spans: List of spans to export
206
207
Returns:
208
SpanExportResult: SUCCESS or FAILURE
209
"""
210
211
def shutdown(self):
212
"""Shutdown the exporter."""
213
214
def force_flush(self, timeout_millis: int = 30000) -> bool:
215
"""
216
Force flush pending data.
217
218
Args:
219
timeout_millis: Timeout in milliseconds
220
221
Returns:
222
bool: True if successful
223
"""
224
```
225
226
### Package Version
227
228
Access to the package version string.
229
230
```python { .api }
231
__version__: str = "1.21.0"
232
```
233
234
## Environment Variables
235
236
Both exporters support configuration via environment variables:
237
238
### Common Environment Variables
239
240
- `OTEL_EXPORTER_JAEGER_ENDPOINT`: Jaeger collector endpoint
241
- `OTEL_EXPORTER_JAEGER_TIMEOUT`: Export timeout in seconds
242
243
### gRPC-Specific Environment Variables
244
245
- `OTEL_EXPORTER_JAEGER_CERTIFICATE`: Path to TLS certificate file
246
- `OTEL_EXPORTER_JAEGER_GRPC_INSECURE`: Use insecure gRPC connection ("true"/"false")
247
248
### Thrift-Specific Environment Variables
249
250
- `OTEL_EXPORTER_JAEGER_AGENT_HOST`: Jaeger agent hostname
251
- `OTEL_EXPORTER_JAEGER_AGENT_PORT`: Jaeger agent port number
252
- `OTEL_EXPORTER_JAEGER_AGENT_SPLIT_OVERSIZED_BATCHES`: Split large UDP batches
253
- `OTEL_EXPORTER_JAEGER_USER`: Basic authentication username
254
- `OTEL_EXPORTER_JAEGER_PASSWORD`: Basic authentication password
255
256
## Types
257
258
```python { .api }
259
from typing import Optional
260
from grpc import ChannelCredentials
261
from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
262
263
# SpanExportResult is an enum with values:
264
# - SpanExportResult.SUCCESS
265
# - SpanExportResult.FAILURE
266
```
267
268
## Constants
269
270
### gRPC Exporter Constants
271
272
```python { .api }
273
DEFAULT_GRPC_COLLECTOR_ENDPOINT: str = "localhost:14250"
274
DEFAULT_EXPORT_TIMEOUT: int = 10
275
```
276
277
### Thrift Exporter Constants
278
279
```python { .api }
280
DEFAULT_AGENT_HOST_NAME: str = "localhost"
281
DEFAULT_AGENT_PORT: int = 6831
282
DEFAULT_EXPORT_TIMEOUT: int = 10
283
```
284
285
## Entry Point Configuration
286
287
This package registers a trace exporter entry point that can be used with OpenTelemetry's auto-configuration:
288
289
- **Entry point name**: `jaeger`
290
- **Target**: `opentelemetry.exporter.jaeger.proto.grpc:JaegerExporter` (gRPC implementation)
291
292
## Package Dependencies
293
294
This meta-package automatically installs:
295
296
- `opentelemetry-exporter-jaeger-proto-grpc==1.21.0`: gRPC/Protocol Buffer implementation
297
- `opentelemetry-exporter-jaeger-thrift==1.21.0`: Thrift/UDP implementation
298
299
Users can install specific exporters individually to avoid unnecessary dependencies if only one protocol is needed.
300
301
## Migration Notice
302
303
**Deprecation**: This package is deprecated as of version 1.16.0. Support will end in July 2023.
304
305
**Recommended Migration**: Use the OTLP exporter instead:
306
307
```python
308
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
309
310
# Replace Jaeger exporters with OTLP
311
otlp_exporter = OTLPSpanExporter(
312
endpoint="http://localhost:4317", # Jaeger's OTLP endpoint
313
insecure=True
314
)
315
```