This example demonstrates how to use the OpenTelemetry SDK to instrument a simple application using Prometheus as the metric exporter and expose the metrics via HTTP.
These are collected by a Prometheus instance which is configured to pull these metrics via HTTP.
- Java 1.7
- Docker 19.03
../gradlew shadowJar
Start Prometheus instance with a configuration that sets up a HTTP collection job for 127.0.0.1:19090
See prometheus.yml
docker run --network="host" --rm -it \
--name prometheus \
-v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus
java -cp build/libs/opentelemetry-examples-prometheus-0.1.0-SNAPSHOT-all.jar io.opentelemetry.example.prometheus.PrometheusExample 19090
Navigate to:
http://localhost:9090/graph?g0.range_input=15m&g0.expr=incoming_messages&g0.tab=0