In this example a demo application is run the computes random Fibonacci
numbers. The application is traced using OpenTelemetry with a flow
SpanProcessor
. The metrics produced with by flow
are collected with an
OpenTelemetry collector and ultimately shipped to a Prometheus instance.
This demo expects docker-compose is installed and working.
Start all services.
docker-compose up --detach
This should do a few things.
- Build the demo Fibonacci application and package it as a Docker image.
- Start the Fibonacci application.
- Start an OpenTelemetry Collector instance. This collector will forward traces from the application to a Jaeger instance and metrics to a Prometheus instance.
- Start a Jaeger instance to capture traces from the collector.
- Start a Prometheus instance to scrape metrics from the collector.
First, make sure the Fibonacci application is reporting metrics.
$ curl -s http://localhost:41820/metrics | grep 'spans_total'
# HELP spans_total The total number of processed spans
# TYPE spans_total counter
spans_total{state="ended"} 762
spans_total{state="started"} 762
The total number of spans will be different, but you should see something like above.
Next, make sure the traces are making it to the Jaeger instance. Navigate through the Jaeger UI you are running locally to ensure traces from the application are there.
Finally, verify the flow
SpanProcessor
is working. Go to the Prometheus
targets page and make sure all targets are up.
From here you can go to the Prometheus graph page and visualize that data being scraped.
For example, run the following query to see the exported span rate.
rate(spans_total[1m])
Stop all services.
docker-compose down
If you are all done with the demo you can remove everything as well.
docker-compose rm