You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+54-4Lines changed: 54 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -280,6 +280,55 @@ OpenTelemetry (OTEL)
280
280
281
281
Read more about OpenTelemetry in Python [here](https://opentelemetry.io/docs/instrumentation/python/)
282
282
283
+
284
+
### Exporting Synapse Client Traces to Jaeger for developers
285
+
The following shows an example of setting up [jaegertracing](https://www.jaegertracing.io/docs/1.50/deployment/#all-in-one) via docker and executing a simple python script that implements the Synapse Python client.
286
+
287
+
#### Running the jaeger docker container
288
+
Start a docker container with the following options:
289
+
```
290
+
docker run --name jaeger \
291
+
-e COLLECTOR_OTLP_ENABLED=true \
292
+
-p 16686:16686 \
293
+
-p 4318:4318 \
294
+
jaegertracing/all-in-one:latest
295
+
```
296
+
Explanation of ports:
297
+
*`4318` HTTP port for OTLP data collection
298
+
*`16686` Jaeger UI for visualizing traces
299
+
300
+
Once the docker container is running you can access the Jaeger UI via: `http://localhost:16686`
301
+
302
+
#### Environment Variable Configuration
303
+
304
+
By default, the OTEL exporter sends trace data to `http://localhost:4318/v1/traces`. You can customize the behavior through environment variables:
305
+
306
+
*`OTEL_SERVICE_NAME`: Defines a unique identifier for your application or service in telemetry data (defaults to 'synapseclient'). Set this to a descriptive name that represents your specific implementation, making it easier to filter and analyze traces in your monitoring system.
307
+
*`OTEL_EXPORTER_OTLP_ENDPOINT`: Specifies the destination URL for sending telemetry data (defaults to 'http://localhost:4318'). Configure this to direct data to your preferred OpenTelemetry collector or monitoring service.
308
+
*`OTEL_DEBUG_CONSOLE`: Controls local visibility of telemetry data. Set to 'true' to output trace information to the console, which is useful for development and troubleshooting without an external collector.
309
+
*`OTEL_SERVICE_INSTANCE_ID`: Distinguishes between multiple instances of the same service (e.g., 'prod', 'development', 'local'). This helps identify which specific deployment or environment generated particular traces.
310
+
*`OTEL_EXPORTER_OTLP_HEADERS`: Configures authentication and metadata for telemetry exports. Use this to add API keys, authentication tokens, or custom metadata when sending traces to secured collectors or third-party monitoring services.
311
+
312
+
313
+
#### Enabling OpenTelemetry in your code
314
+
To enable OpenTelemetry with the Synapse Python client, simply call the
315
+
`enable_open_telemetry()` method on the Synapse class. Additionally you can access an
316
+
instance of the OpenTelemetry tracer via the `get_tracer()` call. This will allow you
317
+
to create new spans for your code.
318
+
319
+
```python
320
+
import synapseclient
321
+
322
+
# Enable OpenTelemetry with default settings
323
+
synapseclient.Synapse.enable_open_telemetry()
324
+
tracer = synapseclient.Synapse.get_tracer()
325
+
326
+
# Then create and use the Synapse client as usual
327
+
with tracer.start_as_current_span("my_function_span"):
328
+
syn = synapseclient.Synapse()
329
+
syn.login(authToken='auth_token')
330
+
```
331
+
283
332
### Exporting Synapse Client Traces to SigNoz Cloud for developers
284
333
285
334
#### Prerequisites
@@ -303,8 +352,6 @@ Explanation of both required and optional environment variables:
303
352
*`OTEL_SERVICE_INSTANCE_ID`: Distinguishes between multiple instances of the same service (e.g., 'prod', 'development', 'local'). This helps identify which specific deployment or environment generated particular traces.
304
353
305
354
#### Enabling OpenTelemetry in your code
306
-
You can copy `.env.example` file to `.env` and fill in the values as needed
307
-
308
355
To enable OpenTelemetry with the Synapse Python client, simply call the
309
356
`enable_open_telemetry()` method on the Synapse class. Additionally you can access an
310
357
instance of the OpenTelemetry tracer via the `get_tracer()` call. This will allow you
@@ -314,8 +361,11 @@ to create new spans for your code.
0 commit comments