Skip to main content

How to set up Observability with OpenTelemetry SDK

Atoti Server has been manually instrumented to provide precise and relevant feedback. However, having the generated traces, metrics and logs reach your chosen endpoint requires a bit of work.

In this example, we will write a Spring configuration that sets up the Atoti Server tracing to send traces to a local OpenTelemetry collector instance. The OpenTelemetry SDK will be used as our OpenTelemetry backend.

Prerequisites

This guides is written under the assumption that an OpenTelemetry collector runs at the address localhost:4317. Readers can easily create such a server from Docker, see the OpenTelemetry Collector setup.

General structure

The tracing setup is a good fit for a Spring configuration class, so that it can be swapped easily. Create a Spring configuration, make sure it is imported by Spring, and start writing a Bean with the OpenTelemetry type.

Creating the OpenTelemetry instance

You need to create an OpenTelemetry instance with the desired configuration. You can follow the OpenTelemetry documentation to create an instance.

Wiring the OpenTelemetry instance

Now that the OpenTelemetry instance is finished, we have to provide it to the Atoti Server tracing framework. Import the TracingConfig from our activepivot-server-spring module to take care of this step. The TracingConfig will autowire the OpenTelemetry bean and provide it to the tracing framework.

Check out the result

Everything is now setup to send application traces, metrics and logs (depending of the configuration) to the collector.
Go to your AtotiUI application and create a new Pivot Table with some hierarchies and measures. You can see traces related to the queries.

Going further

  • There are many other OpenTelemetry exporters one may want to use, listed there.