ToolJet supports OpenTelemetry (OTEL) for comprehensive observability, enabling you to monitor application performance, track query executions, and analyze the health of ToolJet services and infrastructure through metrics. OpenTelemetry provides a standardized, vendor-agnostic way to collect observability data, allowing ToolJet to integrate with any OTEL-compatible third-party monitoring tool such as [Datadog](/docs/tj-setup/observability/datadog), [New Relic](/docs/tj-setup/observability/new-relic), and [Grafana](/docs/tj-setup/observability/grafana).
**Categories of Metrics**
1.**App-Based Metrics** - Monitor the performance and reliability of individual ToolJet applications. These metrics include detailed labels such as `app_name`, `query_name`, `environment`, `query_text`, and `query_mode` (SQL/GUI) for fine-grained analysis.
- **Query Executions:** Track total query executions per application
- **Query Duration:** Measure query execution times with histogram buckets
- **Query Failures:** Monitor failed queries with error categorization
# Authentication (if required by your OTEL collector)
OTEL_EXPORTER_OTLP_HEADERS=<your-api-key>
# Advanced Configuration
OTEL_LOG_LEVEL=debug # Enable debug logging for OTEL
OTEL_ACTIVE_USER_WINDOW_MINUTES=5 # Activity window for concurrent user tracking (default: 5)
OTEL_MAX_TRACKED_USERS=10000 # Maximum tracked users/sessions (default: 10000)
# WARNING: High Cardinality - Only enable for debugging
OTEL_INCLUDE_QUERY_TEXT=false # Include actual query text in metrics (default: false)
# Creates HIGH CARDINALITY - use OTEL Collector to drop in production
```
For a complete list of OpenTelemetry environment variables, refer to the [OpenTelemetry documentation](https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/).
## Setup Local OTEL Collector
Some observability platforms require an OpenTelemetry Collector as an intermediary. In such cases, you can deploy the Collector alongside ToolJet. ToolJet sends telemetry data to the Collector, which then forwards it to your observability platform based on its configuration.
This Docker Compose configuration can be used to deploy an OpenTelemetry Collector alongside ToolJet.
2. Open Grafana and navigate to **Dashboards** → **Import**
3. Click **Upload JSON file** and select the downloaded dashboard JSON file
4. Select your Prometheus data source
5. Click **Import**
The dashboards will be immediately available with real-time data from your ToolJet instance. -->
## Production Considerations
### High Cardinality Warning
The app-based metrics can optionally include a `query_text` label that contains the actual SQL or query content. **By default, this is disabled** to prevent high cardinality issues.
#### Enabling Query Text (For Debugging Only)
To enable query text in metrics for debugging purposes:
```bash
OTEL_INCLUDE_QUERY_TEXT=true
```
:::warning
Enabling `query_text` creates **high cardinality time series** that can significantly impact Prometheus storage and query performance. Only enable this temporarily for debugging specific query issues.
:::
#### Production Best Practices
If you must enable `query_text` in production:
1.**Use an OTEL Collector** to drop the label before metrics reach Prometheus:
```yaml
# otel-collector-config.yaml
processors:
attributes:
actions:
- key: query_text
action: delete
service:
pipelines:
metrics:
receivers: [otlp]
processors: [attributes]
exporters: [prometheus]
```
2.**Alternative: Hash the query text** to reduce cardinality: