This setup is based on: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/examples/demo
- Tool for building and running containers, e.g. Docker Desktop, Podman or Rancher Desktop.
- If you are using podman, you need to set docker alias. On mac this will be
alias docker=podman
- Your application send data directly to the OTEl collector over gRPC
- Prometheus scrapes data from the OTEL collector
- Collector writes data to Loki and Tempo
- Grafana uses the 3 sources to display data
This demo uses docker compose. To run:
To develop on the C# app:
docker compose -f docker-compose-csharp.yaml upTo develop on the Kotlin app:
docker compose -f docker-compose-kotlin.yaml upadd -d to run detatched (just start it without displaying all logs)
The demo exposes the following backends:
- Tempo at http://localhost:3200 (no User interface)
- Loki at http://localhost:3100 (no User interface)
- Prometheus at http://localhost:9090
- Grafana at http://localhost:3000 (Sign in with admin/admin)
Notes:
- It may take some time for the application metrics to appear on the Prometheus dashboard;
To clean up any docker container run docker-compose down from this folder.
Run it with dotnet run or inside an IDE. This will give you more about URLs you can visit.
- Docker is running? Run
docker ps. You seeCONTAINER IDand a lot of other stuff.error during connectmeans Rancher Desktop/Podman Desktop/Docker Desktop has not been starterd
- Docker-Compose is installed? Run
Docker-Compose -v - Dotnet is installed?
dotnet --version. This should display the version.- If this fails, but you have
Visual Studioinstalled, just run from insideVisual Studio. PS:Visual Studiois not the same asVisual Studio Code
- If this fails, but you have
To look at the traces go to ´Grafana´ and open ´Explore´, and choose ´Tempo´ as data source. Make sure tab ´Search´ is chosen, and not ´TraceQL´
- Start the infrastructure as in this section
- Start the
ExampleApi - Open the webpage in
ExampleApiand become familiar with the links
- Understand the setup
- Refer to all comments starting with "SETUP"
- Verify that
ExampleApiis sending Metrics and Traces to the OpenTelemetry- How did you verify it?
- Try changing the ENV-variable
collector- What happend?
- Try disabling the RequestFilter
- (use swagger) to send requests to the APIs
/remove
- Update the request filter (input to AddElementsOpenTelemetry) to remove this endpoint
- Verify in Tempo that you succeeded.
- (use swagger) to send requests to the APIs
/parallel/serial
- (Use Jaeger) to understand what is causing the delay?
- Find out why tracing is missing in
ThisNeedsToBeTraced
- (use swagger) to send requests to the APIs
/error
- Look at trace in Jaeger and add imprevements
- I have added a custom metric to
SuperServiceWithMetrics - Use the endpoint
/metric/incto increment this. Refer to swagger. - Verify that this is working
- Find the metric in the output of the Open Telemetry Collector http://localhost:8889/metrics
- Find the metric in prometheus: http://localhost:9090/graph
- Find the metric in Grafana: http://localhost:3000/explore
- Add another counter to the setup
- Verify that this has been added to your metrics
- Install k6. E.g. by running this https://dl.k6.io/msi/k6-latest-amd64.msi
- Docs: https://k6.io/docs/
- Update URL in
script.jslocated inside thetest-folder -k6 run script.js - See if you can make the application struggle a bit by e.g. run the script for a longer period of time.
