Docs

Jaeger & Prometheus Integration

Set up a local Jaeger and Prometheus stack to collect traces and metrics from Observability Kit.

This page shows how to set up local Jaeger and Prometheus — a simple stack for testing, with support for traces and metrics — to collect telemetry from a Vaadin application running Observability Kit. Jaeger receives traces over OpenTelemetry Protocol (OTLP); Prometheus scrapes metrics from Actuator.

Caution
Not Production-Ready
This setup is intended for local testing only. See the Jaeger documentation for how to prepare a setup for production.

Download & Run Jaeger

Jaeger is a tool for collecting and viewing traces. Recent versions accept OTLP directly, so no collector is needed for local use.

Extract the contents of the downloaded archive, open a terminal in the Jaeger directory, and start it:

Source code
terminal
./jaeger-all-in-one

Jaeger’s OTLP receiver listens on port 4318 (HTTP) and 4317 (gRPC), and the user interface on http://localhost:16686.

Download & Run Prometheus

Prometheus is a tool for collecting metrics. Configure it to scrape the application’s Actuator endpoint at /actuator/prometheus:

Source code
prometheus.yml
global:
  scrape_interval: 15s # Default is every 1 minute.

scrape_configs:
  - job_name: 'vaadin'
    metrics_path: '/actuator/prometheus'
    static_configs:
      - targets: ['localhost:8080']

Extract the archive, open a terminal in the Prometheus directory, and start it with the configuration file:

Source code
terminal
./prometheus --config.file=/PATH/TO/prometheus.yml

Remember to substitute the correct path to the prometheus.yml file.

Configure the Application

Add Actuator and the Prometheus registry for metrics, and a tracing bridge with an OTLP exporter for traces:

Source code
pom.xml
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-tracing-bridge-otel</artifactId>
</dependency>
<dependency>
    <groupId>io.opentelemetry</groupId>
    <artifactId>opentelemetry-exporter-otlp</artifactId>
</dependency>

Then point traces at Jaeger’s OTLP endpoint and expose the Prometheus endpoint:

Source code
application.properties
spring.application.name=vaadin

# Metrics: scraped by Prometheus
management.endpoints.web.exposure.include=prometheus

# Traces: pushed to Jaeger over OTLP
management.otlp.tracing.endpoint=http://localhost:4318/v1/traces
management.tracing.sampling.probability=1.0

The sampling probability is set to 1.0 so that every request produces a span while testing. Lower it for production.

Viewing Traces in Jaeger

The default address for the Jaeger user interface is http://localhost:16686. From there, select your service name — vaadin if you set spring.application.name=vaadin — from the Service field and click the Find Traces button.

The default time period to search is within the last hour. To search further back, select a time period from the Lookback field.

The default number of results is 20. To see more, increase the value in the Limit Results field.

On the right, there is a graph of time versus duration. Larger circles indicate events causing delays; red circles indicate errors. Clicking a circle opens the trace detail page.

A list of the root spans is also available. Each span shows its duration relative to the others, how many nested spans it contains, and how many errors. Clicking an item opens the trace detail page.

Trace Detail

The trace detail page has a tree list showing the root span and all nested spans. If a span has an error, it’s marked with a red exclamation (!) icon.

Click a row to view a span’s details. Expand Tags to see the span’s attributes — the Vaadin-specific ones are described on the Reference page.

Viewing Metrics in Prometheus

The default address for the Prometheus user interface is http://localhost:9090. Enter a metric name into the search field and click Execute.

If you don’t know the metric name, click the globe icon next to Execute to open the metrics explorer, which lists the available metrics alphabetically.

To view a result as a graph, click the Graph tab.

Updated