Skip to content

Commit

Permalink
Replace python script with tracegen (#4753)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
- Resolves #4503

## Description of the changes
- Replaces the python example with tracegen in order to reduce
maintenance needed on the script.

## How was this change tested?
- Ran locally E2E to confirm traces and metrics are appearing in Jaeger
UI.

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
~- [] I have added unit tests for the new functionality~
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: albertteoh <see.kwang.teoh@gmail.com>
  • Loading branch information
albertteoh committed Sep 12, 2023
1 parent 18f3c2a commit e2aa161
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 79 deletions.
9 changes: 0 additions & 9 deletions .github/dependabot.yml
Expand Up @@ -28,12 +28,3 @@ updates:
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "pip"
directory: "/docker-compose/monitor"
schedule:
interval: "weekly"
groups:
all:
patterns:
- "*"
42 changes: 23 additions & 19 deletions docker-compose/monitor/README.md
Expand Up @@ -77,38 +77,42 @@ For each "run" make target, you should expect to see the following in the Monito

## Sending traces

It is possible to send traces to this SPM Development Environment from your own application and viewing their RED metrics.
We will use [tracegen](https://github.com/jaegertracing/jaeger/tree/main/cmd/tracegen)
to emit traces to the OpenTelemetry Collector which, in turn, will aggregate the trace data into metrics.

For the purposes of this example, the Opentelemetry Collector of the [docker-compose.yml](./docker-compose.yml) file
has been configured to listen on port `14278` for Thrift formatted traces sent directly from applications to the
collector over HTTP.

An example Python script has been provided to demonstrate sending individual traces to the Opentelemetry Collector running in
this SPM Development Environment.

### Setup

Run the following commands to setup the Python virtual environment and install the Opentelemetry SDK:
Start the local stack needed for SPM, if not already done:
```shell
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
docker compose up
```

Then run this example a number of times to generate some traces:
Generate a specific number of traces with:
```shell
docker run --env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="http://otel_collector:4317" \
--network monitor_backend \
--rm \
jaegertracing/jaeger-tracegen:1.49 \
-trace-exporter otlp-grpc \
-traces 1
```

Or, emit traces over a period of time with:
```shell
./otlp_exporter_example.py
docker run --env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="http://otel_collector:4317" \
--network monitor_backend \
--rm \
jaegertracing/jaeger-tracegen:1.49 \
-trace-exporter otlp-grpc \
-duration 5s
```

Navigate to Jaeger UI at http://localhost:16686/ and you should be able to see traces from this demo application
under the `my_service` service:
under the `tracegen` service:

![My Service Traces](images/my_service_traces.png)
![TraceGen Traces](images/tracegen_traces.png)

Then navigate to the Monitor tab at http://localhost:16686/monitor to view the RED metrics:

![My Service RED Metrics](images/my_service_metrics.png)
![TraceGen RED Metrics](images/tracegen_metrics.png)

## Migrating to Span Metrics Connector

Expand Down
2 changes: 0 additions & 2 deletions docker-compose/monitor/docker-compose.yml
Expand Up @@ -22,8 +22,6 @@ services:
volumes:
- ${OTEL_CONFIG_SRC:-./otel-collector-config-connector.yml}:/etc/otelcol/otel-collector-config.yml
command: --config /etc/otelcol/otel-collector-config.yml
ports:
- "4317:4317"
depends_on:
- jaeger
microsim:
Expand Down
Binary file not shown.
Binary file removed docker-compose/monitor/images/my_service_traces.png
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 0 additions & 28 deletions docker-compose/monitor/otlp_exporter_example.py

This file was deleted.

21 changes: 0 additions & 21 deletions docker-compose/monitor/requirements.txt

This file was deleted.

0 comments on commit e2aa161

Please sign in to comment.