Skip to main content
To monitor product usage, see Usage analytics. Lightdash can expose Prometheus metrics to help you monitor the performance and health of your Lightdash instance. This guide explains how to enable and configure Prometheus metrics for your self-hosted Lightdash deployment.

Enabling Prometheus metrics

By default, Prometheus metrics are disabled in Lightdash. To enable them, set the following environment variable:

Configuration options

You can customize the Prometheus metrics endpoint using the following environment variables: Operator-configurable counter metrics driven by application events are set through LIGHTDASH_CUSTOM_METRICS_CONFIG_PATH — see Custom event metrics below.

Available metrics

Lightdash exposes the following metrics:

Process metrics

These metrics provide information about the Node.js process running Lightdash:

Node.js metrics

These metrics provide information about the Node.js runtime:

PostgreSQL metrics

These metrics provide information about the PostgreSQL connection pool:

Queue metrics

Query metrics

These metrics track query execution performance. The context label is either scheduled or interactive based on the execution context.

Pre-aggregate metrics

These metrics track the pre-aggregate system, including materialization, DuckDB resolution, and file management:

AI agent metrics

These metrics track the performance of the AI agent:

S3 metrics

HTTP server metrics

When LIGHTDASH_PROMETHEUS_HTTP_METRICS_ENABLED is set to true, Lightdash exposes a standardized OpenTelemetry HTTP server semantic convention histogram. Buckets are in seconds and labels use route templates (not raw URLs) to keep cardinality bounded.

Custom event metrics

Lightdash supports operator-configurable Prometheus counter metrics that are driven by application events. These are defined via a JSON configuration file specified by the LIGHTDASH_CUSTOM_METRICS_CONFIG_PATH environment variable. Each entry in the config file creates a counter metric that increments when a matching application event fires. This allows you to track custom business-level metrics such as user logins or query executions without modifying the application code. To turn it on, set LIGHTDASH_PROMETHEUS_ENABLED=true and LIGHTDASH_PROMETHEUS_EVENT_METRICS_ENABLED=true, and point LIGHTDASH_CUSTOM_METRICS_CONFIG_PATH at a JSON file inside the Lightdash working directory. Set them on every process you scrape, including scheduler workers, because each process only counts the events it emits.
Each entry needs eventName, metricName, help, and labelNames. Label names must match the event’s property keys exactly (for example projectId, not project_id); a property the event doesn’t have is recorded as unknown. Avoid high-cardinality labels such as threadId or promptId. For AI agents, useful events include ai_agent_request.outcome (label outcome, success or error), ai_agent_tool_call_failed (labels toolName, aiAgentId), and ai_agent.response_streamed (labels such as aiAgentId, model, or surface). Events don’t carry upstream HTTP status codes or error text from your LLM provider, so you can’t build a counter for those. mcp_tool_call counts calls to the Lightdash MCP server, not calls agents make to external MCP servers.

Using metrics for monitoring and alerting

You can use these metrics to create dashboards and alerts in your monitoring system. Some common use cases include:
  • Monitoring memory usage and setting alerts for potential memory leaks
  • Tracking PostgreSQL connection pool utilization
  • Monitoring event loop lag to detect performance issues
  • Setting up alerts for high CPU usage
For example, you might want to create alerts for:
  • High memory usage: process_resident_memory_bytes > threshold
  • Event loop lag: nodejs_eventloop_lag_p99_seconds > threshold
  • Database connection pool saturation: pg_active_connections / pg_pool_max_size > 0.8

OpenTelemetry support

Lightdash metrics are also compatible with OpenTelemetry. You can use the OpenTelemetry Collector with the Prometheus receiver to scrape Lightdash’s Prometheus metrics endpoint and export them to any OpenTelemetry-compatible backend. Lightdash can also export distributed traces directly over OTLP. See Configure OpenTelemetry tracing. Example OpenTelemetry Collector configuration:

Setting up a Prometheus server

If you don’t already have a Prometheus server set up, here are some resources to help you get started:

General Prometheus setup

Setting up Prometheus in Google Cloud Platform (GCP)

Setting up Prometheus in Amazon Web Services (AWS)