Skip to content
DuckDB community extension

prometheus

Query Prometheus-compatible HTTP APIs directly from DuckDB

01 / SETUP

Install and load

Run these commands in a Haybarn SQL session. The extension is available from the community repository.

Haybarn 2.0.0 · SQL
INSTALL prometheus FROM community;
LOAD prometheus FROM community;

Using upstream DuckDB? Follow the maintainer’s installation instructions.

02 / QUERY

Usage example

Replace localhost:9090 with your Prometheus-compatible endpoint.

SQL
-- Replace localhost:9090 with your Prometheus-compatible endpoint.
SELECT timestamp, job, instance, value
FROM prometheus_scan(
    'up',
    current_timestamp - INTERVAL '15 minutes',
    current_timestamp,
    endpoint := 'http://localhost:9090',
    step := INTERVAL '1 minute',
    labels := ['job', 'instance']
)
ORDER BY timestamp DESC, job, instance;

Provided by botan. Not yet verified on Haybarn 2.0.0.

Sample data & setup

About this extension

Run instant PromQL queries with prometheus_query and range queries with prometheus_scan; their _many variants accept multiple expressions. Each sample contains labels MAP(VARCHAR, VARCHAR), timestamp TIMESTAMPTZ, and value DOUBLE. Pass labels := [...] to expose selected labels as columns.

Discovery functions list labels, label values, series, and metric metadata. Requests are unauthenticated. See the README for function signatures and limitations.

Project overview from the community descriptor.

Documentation and resources

Project and build details
Repository
botan/duckdb-prometheus
License
Apache-2.0
Maintainers
botan
Written in
Rust
Build source
7dff993bacd1
Build definition
Community descriptor