> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tracing

Atoti Server provides tracing capabilities through the OpenTelemetry API, which can be used with a
variety of observability backends.

By default, Atoti enables tracing for the CSV source and every query execution, including distributed queries (i.e. all queries endpoints are traced).

## Tracing Setup

In order to use Atoti Server's tracing capabilities, you will need to use your chosen
OpenTelemetry-compatible backend, such as OpenTelemetry SDK, to generate an `OpenTelemetry` instance.
That instance must then be supplied to Atoti Server in one of these two ways:

* Through a call to `Tracing.setOtelInstance()`.
* By setting the `GlobalOpenTelemetry`.
  Please note that in the event that both of these means are used, the instance supplied
  through `Tracing.setOtelInstance()` has precedence.

For spring based properties please refer to the Spring Cloud Sleuth [Reference Documentation](https://docs.spring.io/spring-cloud-sleuth/docs/current/reference/html/).

Tracing granularity can be configured within Atoti Server by calling `Tracing.setSpanLevel()`. There are three possibilities:

* NONE: continues the parent span.
* SPECIFIC: mode creates new child span when some significant tasks are being invoked, specified in `Tracing#IMPORTANT_TASKS`.
* TASK:  mode creates new child span whenever a new ForkJoinTask is being called.

Please refer the [SpanLevel](https://assets.activeviam.com/products/atoti/server/latest/javadoc/com/activeviam/tech/core/internal/observability/SpanLevel.html) for more details.

## Component specifics

In addition to the out-of-the-box information provided by OpenTelemetry,
some components of Atoti add extra metrics (by adding metadata to the spans) in order to provide more insights.

Check the tracing documentation of the component you want to monitor to see what information you can get:

* [DirectQuery](../directquery/monitoring#tracing)
