> Markdown version of [Jaeger & Prometheus](https://vaadin.com/docs/next/tools/observability/integrations/jaeger-prometheus). Section index: [llms.txt](https://vaadin.com/docs/next/tools/llms.txt)

# Jaeger & Prometheus Integration

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](https://www.jaegertracing.io/) for how to prepare a setup for production.

## <a id="download-run-jaeger"></a>Download & Run Jaeger

[Jaeger](https://www.jaegertracing.io/) is a tool for collecting and viewing traces. Recent versions accept OTLP directly, so no collector is needed for local use.

[Download Jaeger](https://www.jaegertracing.io/download/)

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

```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`.

## <a id="download-run-prometheus"></a>Download & Run Prometheus

[Prometheus](https://prometheus.io) is a tool for collecting metrics. Configure it to scrape the application’s Actuator endpoint at `/actuator/prometheus`:

`prometheus.yml`

```yaml
global:
  scrape_interval: 15s # Default is every 1 minute.

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

[Download Prometheus](https://prometheus.io/download/)

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

```terminal
./prometheus --config.file=/PATH/TO/prometheus.yml
```

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

## <a id="configure-the-application"></a>Configure the Application

Add Actuator and the Prometheus registry for metrics, and the OpenTelemetry starter for OTLP trace export:

`pom.xml`

```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>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-opentelemetry</artifactId>
</dependency>
```

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

`application.properties`

```properties
spring.application.name=vaadin

# Metrics: scraped by Prometheus
management.endpoints.web.exposure.include=prometheus
# The OpenTelemetry starter also brings in the OTLP metrics registry; disable it so metrics go through Prometheus only
management.otlp.metrics.export.enabled=false

# Traces: pushed to Jaeger over OTLP
management.opentelemetry.tracing.export.otlp.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.

## <a id="viewing-traces-in-jaeger"></a>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.

<!-- vale Vaadin.Wordiness = NO -->

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

<!-- vale Vaadin.Wordiness = YES -->

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](#trace-detail).

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.

### <a id="trace-detail"></a>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](https://vaadin.com/docs/next/tools/observability/reference.md#span-attributes) page.

## <a id="viewing-metrics-in-prometheus"></a>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.
