Documentation versions (currently viewingVaadin 23)

You are viewing documentation for Vaadin 23. View latest documentation

Getting Started with Observability Kit

Step-by-step guide showing how to add Observability Kit to your application.

This guide covers the following topics:

  • downloading Observability Kit, and configuring it to export data to the infrastructure;

  • setting up infrastructure for collecting and viewing observability data, such as traces and metrics;

  • running a Vaadin application with Observability Kit.

1. Download and Configure Observability Kit

Observability Kit is packaged as a Java agent based on the OpenTelemetry standard. For more information, see Reference.

Next, Observability Kit needs to be configured to export traces to Jaeger, and metrics to Prometheus. For this, create an file with the following contents:


2. Setup Infrastructure

Use Jaeger to process traces and Prometheus to process metrics. They both run locally and are suitable for development and testing. For integration with other vendors, see Integrations.

Jaeger is a tool for collecting traces.

Extract the contents of the downloaded archive (tar.gz file). Open a terminal to the Jaeger directory and start Jaeger:


Prometheus is a tool for collecting metrics.

Extract the contents of the downloaded archive (tar.gz file). Create a Prometheus configuration with a scraper that reads metrics data from the OpenTelemetry exporter:

  scrape_interval: 15s # Default is every 1 minute.

  - job_name: 'opentelemetry'
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
      - targets: ['localhost:9464']
    # Host and port need to match the
    # OpenTelemetry prometheus exporter configuration

Open a terminal to the Prometheus directory and start Prometheus with the configuration file:

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

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

3. Run the Application

If you don’t have an application to use, you can download an application from Vaadin Start, and create a production build with the following command:

./mvnw package -Pproduction

Then run the packaged JAR file from the target folder:

Run the application using the Java binary and pass the respective arguments for the Java agent and the agent configuration:

java -javaagent:PATH/TO/vaadin-opentelemetry-javaagent-VERSION.jar \
     -Dotel.javaagent.configuration-file=PATH/TO/ \
     -jar myapp.jar
Replace placeholder paths and version
Remember to correct the path to the file, as well as the path and version of the Observability Kit .jar file.

4. Viewing Traces in Jaeger

The default address for the Jaeger user interface is http://localhost:16686. From there you can select your service name – vaadin by default – 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 results, increase the value in the Limit Results field.

On the right, there is now a graph of timeline versus duration. From there you can see events that are causing delays, expressed by larger circles, or errors, expressed by red circles. Clicking one of the circles opens the trace detail page.

A list of the root spans is also available. Each span shows the duration relative to the other root spans, how many nested spans it contains, and how many errors. Once again, clicking on an item opens up the trace detail page.

4.1. Trace Detail

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

For each of the spans, you can view more details by clicking on the row. In the span details, you can expand Tags to view attributes for the span. Vaadin-specific attributes are detailed in the reference page. If there has been an error, you can find any related stack traces under Logs.

5. Viewing Metrics in Prometheus

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

If you don’t know the metric name, you can use the metrics explorer, by clicking the Earth icon next to Execute. This provides an alphabetical list of available metrics.

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