Grafana is an observability stack with support for metrics, traces, and logs. It can be self-hosted, in addition to using the commercial managed hosting.
These instructions are for a local Grafana setup which you can run using docker-compose. Alternatively, Grafana provides a managed hosting service for their products.
Not Production-ReadyThis setup is intended for local testing, only. It isn’t production ready. See the Grafana documentation on how to configure and secure a self-hosted setup.
Start by cloning the
git clone https://github.com/vaadin/observability-grafana-setup.git
From the setup folder, run:
cd observability-grafana-setup docker-compose up
This command starts a set of services for collecting and displaying data from Observability Kit:
Grafana Tempo for collecting and storing traces;
Prometheus for collecting and storing metrics;
Grafana Loki for collecting and storing logs;
OpenTelemetry collector for ingesting telemetry data from the agent, and distributing it to the services above; and
Grafana for displaying traces, metrics and logs, also from the services above.
To configure Observability Kit, create an
agent.properties file with the following content:
otel.service.name=vaadin otel.traces.exporter=otlp otel.metrics.exporter=otlp otel.logs.exporter=otlp
In the configuration above, the service name is defined as
vaadin, which is also the default of the agent. The service name can be customized. Notice that the pre-configured Grafana dashboard queries data from the
vaadin service, and needs to be edited when using a custom service name.
By default, the OpenTelemetry Protocol (OTLP) exporters assume that the OpenTelemetry collector is running locally. You don’t need to configure endpoints. If the collector is running on a different system, you need to configure an endpoint for the exporter:
Run the application using the Java binary and pass the respective arguments for the Agent and configuration like so:
java -javaagent:PATH/TO/observability-kit-agent-VERSION.jar \ -Dotel.javaagent.configuration-file=PATH/TO/agent.properties \ -jar myapp.jar
Replace Placeholder Paths & VersionRemember to correct the path to the
The Grafana setup provides a sample dashboard that shows basic metrics, like JVM memory usage and CPU usage, traces and errors, as well as logs. To log in, use the default credentials
Configure Service NameThe service name needs to be configured as
The individual panels of the dashboard may be used to explore the data in more detail. Click on a panel’s name to open the drop-down menu, and then click on Explore.
To view traces, open the Explore view, and select Tempo as the data source. Change the Query type to Search, and select the name of the service from the Service name menu. Then click the refresh button in the top-right to search for traces.
Use the Tags option to filter for specific span attributes. For example, to filter for traces that contains errors, enter
Clicking on a trace ID brings up a side panel that shows detailed information about a specific trace, such as nested spans, and their attributes and events.
To view metrics, open the Explore view, and select Prometheus as the data source. Select a metric from the Metric drop-down, for example, process_runtime_jvm_memory_usage to view JVM memory usage. Then click the refresh button in the top-right display the metric.