This feature is experimental.
Introduction
The Query History Starter automatically sets up query history persistence, a REST API, and security rules for tracking MDX query executions in an Atoti Server application. When enabled, it records MDX queries executed against the server, including their status, duration, user, and metadata. It also exposes REST endpoints to browse, filter, cancel, and delete recorded queries, as well as retrieve query execution plans. The following metadata attributes are automatically attached to queries:apiType— set torestfor queries executed via the REST API.failureCause— added automatically when a query fails, containing the message of the error that made it fail, such as the query result limit it exceeded.
00f067aa0ba902b7.
That value is also reported in the query execution reports and on the OpenTelemetry spans of the query.
By default, a recorded query can therefore be joined with its log lines and its trace.
See What identifies a query in a trace?.
The Query History Starter is typically used alongside the Atoti Server Starter.
Installation
To use the starter, add the following dependency to yourpom.xml.
Configuration
All properties live under theatoti.server.query-history namespace.
Enabling and disabling
The starter is enabled by default. To disable it:Database
Query history is persisted using Hibernate. Thedatabase property accepts standard Hibernate and HikariCP connection pool settings.
The following example configures an H2 in-memory database:
Field limits
Maximum character lengths for stored fields can be tuned. Values exceeding the limit are truncated.Query id format
By default, the id of a recorded query is written as 16 lowercase hexadecimal characters, such as00f067aa0ba902b7.
Set atoti.server.query-history.legacy-id-format to true to write it as a signed decimal number instead, such as -1085102592571150095:
id column. Atoti always creates the id column as a VARCHAR.
Entries recorded before the format was changed keep the id they were written with.
The REST endpoints that get or delete a query by id take the id as it was recorded, in either format.
The endpoint that cancels a running query takes it in the configured format.
Security
The Atoti Server Starter registers aSecurityFilterChain (order 330) that protects all endpoints under /activeviam/query-history/rest/v1/**.
It uses the project’s MachineToMachineSecurityDsl with the following rules:
The security filter chain can be disabled via:
Distributed setup
In a distributed environment, the Query History Starter should be activated on the query node — the node that receives and executes client MDX queries. Activating it on a data node will have no effect since data nodes do not execute client MDX queries. Query cancellation is not supported in distributed environments. The cancel endpoints only operate on queries known to the local node.REST API
All endpoints are served under the base path/activeviam/query-history/rest/v1.
See the Query History REST API for the full endpoint reference.