Metrics API

Scrape per-project runtime metrics

The metrics endpoint exposes per Spice project instance runtime metrics in Prometheus format. Use this endpoint to scrape metrics and send them to Datadog, Grafana, Prometheus, and OpenTelemetry compatible systems for dashboards and alerting.

Get Metrics

GET https://<project-cname>.spiceai.io/v1/metrics

Returns runtime metrics for the Spice project instance in Prometheus exposition format.

Headers

HeaderTypeDescription
X-API-KeystringYour project API key

Response

Returns metrics in Prometheus text exposition format.

# HELP http_requests Number of HTTP requests.
# TYPE http_requests counter
http_requests_total{method="GET",path="/v1/sql"} 1024

# HELP query_duration_ms The total amount of time spent planning and executing queries in milliseconds.
# TYPE query_duration_ms histogram
query_duration_ms_bucket{le="10"} 50
query_duration_ms_bucket{le="100"} 200
...

Example

curl https://us-west-2-prod-aws-data.spiceai.io/v1/metrics \
  -H "X-API-Key: <API_KEY>"

Monitoring Integrations

The metrics output is compatible with standard monitoring systems. Pre-built dashboards and setup guides are available:

  • Grafana & Prometheus - Scrape metrics with Prometheus, visualize in Grafana
  • Datadog - Scrape metrics with the Datadog Agent's OpenMetrics integration
  • OpenTelemetry - Use the OTEL Prometheus receiver

Available Metrics

All metrics include relevant labels (dimensions) for filtering and aggregation.

Acceleration

MetricTypeDescription
accelerated_ready_state_federated_fallbackcountNumber of times the federated table was queried due to the accelerated table loading the initial data.
accelerated_zero_results_federated_fallbackcountNumber of times the federated table was queried due to the accelerated table returning zero results.
dataset_acceleration_ingestion_lag_msgaugeLag between the current wall-clock time and the maximum time_column value after the refresh operation, in milliseconds. Disabled by default.
dataset_acceleration_last_refresh_time_msgaugeUnix timestamp in milliseconds when the last refresh completed. Disabled by default.
dataset_acceleration_max_timestamp_after_refresh_msgaugeMaximum value of the dataset's time_column after the refresh operation, in milliseconds. Disabled by default.
dataset_acceleration_max_timestamp_before_refresh_msgaugeMaximum value of the dataset's time_column before the refresh operation, in milliseconds. Disabled by default.
dataset_acceleration_refresh_data_fetches_skippedcountNumber of refresh data fetches skipped due to unchanged file metadata.
dataset_acceleration_refresh_duration_mshistogramDuration in milliseconds to load a full or appended refresh data.
dataset_acceleration_refresh_errorscountNumber of errors refreshing the dataset.
dataset_acceleration_refresh_lag_msgaugeDifference between the maximum time_column value after and before the refresh operation, in milliseconds.
dataset_acceleration_refresh_worker_panicscountNumber of times a refresh worker panicked while refreshing a dataset.
dataset_acceleration_snapshot_bootstrap_bytesgaugeNumber of bytes downloaded when bootstrapping the acceleration from a snapshot.
dataset_acceleration_snapshot_bootstrap_checksumgaugeChecksum of the snapshot downloaded during bootstrap (emitted with checksum attribute).
dataset_acceleration_snapshot_bootstrap_duration_mscountTime in milliseconds taken to download the snapshot used to bootstrap acceleration.
dataset_acceleration_snapshot_failure_countcountNumber of failures encountered while writing snapshots.
dataset_acceleration_snapshot_write_bytesgaugeNumber of bytes written for the most recent snapshot.
dataset_acceleration_snapshot_write_checksumgaugeChecksum of the most recent snapshot write (emitted with checksum attribute).
dataset_acceleration_snapshot_write_duration_mshistogramTime in milliseconds taken to write the latest snapshot to object storage.
dataset_acceleration_snapshot_write_timestampgaugeUnix timestamp (seconds) when the most recent snapshot write completed.

Datasets

MetricTypeDescription
dataset_active_countgaugeNumber of currently loaded datasets.
dataset_load_errorscountNumber of errors loading the dataset.
dataset_load_stategaugeStatus of the dataset. 0=Initializing, 1=Ready, 2=Disabled, 3=Error, 4=Refreshing, 5=ShuttingDown.
dataset_unavailable_time_msgaugeTime dataset went offline in milliseconds.

Catalogs

MetricTypeDescription
catalog_load_errorscountNumber of errors loading the catalog provider.
catalog_load_stategaugeStatus of the catalog provider. 0=Initializing, 1=Ready, 2=Disabled, 3=Error, 4=Refreshing, 5=ShuttingDown.

Queries

MetricTypeDescription
query_active_counthistogramNumber of concurrent top-level queries actively being processed. Includes the protocol dimension (http, flight, flightsql, internal).
query_duration_mshistogramThe total amount of time spent planning and executing queries in milliseconds.
query_execution_duration_mshistogramThe total amount of time spent only executing queries (0 for cached queries).
query_executionscountNumber of query executions.
query_failurescountNumber of query failures.
query_processed_bytescountNumber of bytes processed by the runtime.
query_produced_spillscountNumber of spills produced by the query.
query_returned_bytescountNumber of bytes returned to query clients.
query_returned_rowshistogramNumber of rows returned to query clients.
query_spilled_bytescountNumber of spilled bytes produced by the query.
query_spilled_rowscountNumber of spilled rows produced by the query.

HTTP & Flight

MetricTypeDescription
http_requestscountNumber of HTTP requests.
http_requests_duration_mshistogramMeasures the duration of HTTP requests in milliseconds.
flight_requestscountTotal number of Flight requests.
flight_request_duration_mshistogramMeasures the duration of Flight requests in milliseconds.
flight_do_exchange_data_updates_sentcountNumber of data updates sent via DoExchange.

AI / LLM

MetricTypeDescription
ai_inferences_with_spice_countcountAI Inferences with Spice count.
llm_requestscountNumber of LLM requests.
llm_failurescountNumber of LLM failures.
llm_internal_request_duration_mshistogramThe duration of running an LLM request internally.
llm_load_stategaugeStatus of the LLM model. 0=Initializing, 1=Ready, 2=Disabled, 3=Error, 4=Refreshing, 5=ShuttingDown.

Models

MetricTypeDescription
model_active_countgaugeNumber of currently loaded models.
model_load_duration_mshistogramDuration in milliseconds to load the model.
model_load_errorscountNumber of errors loading the model.
model_load_stategaugeStatus of the model. 0=Initializing, 1=Ready, 2=Disabled, 3=Error, 4=Refreshing, 5=ShuttingDown.

Embeddings

MetricTypeDescription
embeddings_active_countgaugeNumber of currently loaded embeddings.
embeddings_requestscountNumber of embedding requests.
embeddings_failurescountNumber of embedding failures.
embeddings_internal_request_duration_mshistogramThe duration of running an embedding(s) internally.
embeddings_load_errorscountNumber of errors loading the embedding.
embeddings_load_stategaugeStatus of the embedding. 0=Initializing, 1=Ready, 2=Disabled, 3=Error, 4=Refreshing, 5=ShuttingDown.

Embeddings Cache

MetricTypeDescription
embeddings_cache_hitscountCache hit count.
embeddings_cache_missescountCache miss count.
embeddings_cache_requestscountNumber of requests to get a key from the cache.
embeddings_cache_evictionscountNumber of cache evictions.
embeddings_cache_hit_ratiogaugeCache hit ratio (hits / total requests).
embeddings_cache_items_countgaugeNumber of items currently in the cache.
embeddings_cache_size_bytesgaugeSize of the cache in bytes.
embeddings_cache_max_size_bytesgaugeMaximum allowed size of the cache in bytes.
embeddings_cache_stale_swr_countcountNumber of stale-while-revalidate background refreshes skipped due to existing in-flight revalidation.
embeddings_cache_swr_background_query_countcountNumber of background queries triggered for stale-while-revalidate cache refreshes.

Results Cache

MetricTypeDescription
results_cache_hitscountCache hit count.
results_cache_missescountCache miss count.
results_cache_requestscountNumber of requests to get a key from the cache.
results_cache_evictionscountNumber of cache evictions.
results_cache_hit_ratiogaugeCache hit ratio (hits / total requests).
results_cache_items_countgaugeNumber of items currently in the cache.
results_cache_size_bytesgaugeSize of the cache in bytes.
results_cache_max_size_bytesgaugeMaximum allowed size of the cache in bytes.
results_cache_stale_swr_countcountNumber of stale-while-revalidate background refreshes skipped due to existing in-flight revalidation.
results_cache_swr_background_query_countcountNumber of background queries triggered for stale-while-revalidate cache refreshes.

Search Results Cache

MetricTypeDescription
search_results_cache_hitscountSearch cache hit count.
search_results_cache_missescountCache miss count.
search_results_cache_requestscountNumber of requests to get a key from the search cache.
search_results_cache_evictionscountNumber of cache evictions.
search_results_cache_hit_ratiogaugeCache hit ratio (hits / total requests).
search_results_cache_items_countgaugeNumber of items currently in the search cache.
search_results_cache_size_bytesgaugeSize of the search cache in bytes.
search_results_cache_max_size_bytesgaugeMaximum allowed size of the search cache in bytes.
search_results_cache_stale_swr_countcountNumber of stale-while-revalidate background refreshes skipped due to existing in-flight revalidation.
search_results_cache_swr_background_query_countcountNumber of background queries triggered for stale-while-revalidate cache refreshes.

Tools & Views

MetricTypeDescription
tool_active_countgaugeNumber of currently loaded LLM tools.
tool_load_errorscountNumber of errors loading the LLM tool.
tool_load_stategaugeStatus of the LLM tools. 0=Initializing, 1=Ready, 2=Disabled, 3=Error, 4=Refreshing, 5=ShuttingDown.
view_load_errorscountNumber of errors loading the view.
view_load_stategaugeStatus of the views. 0=Initializing, 1=Ready, 2=Disabled, 3=Error, 4=Refreshing, 5=ShuttingDown.

Runtime

MetricTypeDescription
component_metric_registered_countgaugeNumber of currently registered component metrics.
runtime_http_server_startedcountIndicates the runtime HTTP server has started.
runtime_flight_server_startedcountIndicates the runtime Flight server has started.
secrets_store_load_duration_mshistogramDuration in milliseconds to load the secret stores.
worker_active_countgaugeNumber of currently loaded workers.
workers_load_duration_mshistogramDuration in milliseconds to load the worker.

See also: