https://github.com/billmeyer/send-traces
Send OpenTelemetry traces via a python script
https://github.com/billmeyer/send-traces
Last synced: over 1 year ago
JSON representation
Send OpenTelemetry traces via a python script
- Host: GitHub
- URL: https://github.com/billmeyer/send-traces
- Owner: billmeyer
- Created: 2021-09-08T12:42:36.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-09-09T16:27:05.000Z (almost 5 years ago)
- Last Synced: 2025-02-11T20:57:46.375Z (over 1 year ago)
- Language: Python
- Size: 2.86 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# send-trace
This short python script is useful for sending OpenTelemetry traces to an OpenTelemetry collector.
## Setup
Install the module dependencies with
```bash
pip3 install -r requirements.txt
```
## Enable zPages in the OpenTelemetry Collector
Enabling the zPages extension in the OpenTelemetry collector is a useful troubleshooting aid. See https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/troubleshooting.md for more details.
Once enabled, browsing to the `http://:55679/debug/tracez` page will show a history of the spans that have been sent to and processed by the collector. This is one mechanism to confirm traces are being received and processed by the collector. See the *Viewing the results* section below for examples.
## Execution
Execute the script by running it with python and passing the hostname of the OpenTelemetry collector as an argument to the script:
```bash
python3 send-python.py
```
```
OTEL Host: k8s-worker-intel2
Sending trace to k8s-worker-intel2...
Hello world from OpenTelemetry Python!
Done.
```
## Viewing the results
### Confirm the OpenTelemetry collector received the trace
Open a browser window and navigate to the OpenTelemetry collector to confirm the trace was received. The URL uses this format:
```
http://:55679/debug/tracez
```
On this page, there should be a span named `receiver/jaeger/TraceDataReceived` and under the `Latency Samples`, there should be a least one span received:

### View the trace in Splunk Observability
Sign into Splunk Observability and navigate to __APM__ → __Explore__. After a few minutes, the trace should appear in the Service Map:

To view the trace, under the __Service Requests & Errors__, click the purple spike that represents the trace that was sent:

This reveals a list of available traces for the time period that was clicked on. View the trace by clicking on it's `Trace ID`.
The resulting trace and it's span information will be displayed similar to:
