prometheus_fdw
prometheus_fdw · A Rust/pgrx foreign data wrapper that queries Prometheus metrics through PostgreSQL foreign tables.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100718 | prometheus_fdw | prometheus_fdw | 0.2.1 | FDW | PostgreSQL | Rust |
PostgreSQL · 14, 15, 16, 17
Usage
Sources:
prometheus_fdw is a read-only foreign data wrapper that turns a Prometheus range-query response into PostgreSQL rows. Version 0.2.1 supports one metrics object and requires exact metric-name and time-bound predicates to construct the Prometheus request.
Configure and Query
The three predicates are operationally required by the implementation: metric_name =, metric_time >, and metric_time <. Missing them produces no valid request. step is passed to Prometheus and defaults to 10m.
Returned Columns
metric_namerepeats the requested metric name.metric_labelscontains the Prometheus series label object.metric_timeis the Unix timestamp returned by the range query.metric_valueis the sample parsed asfloat8.
Operational Boundaries
Each scan performs a synchronous outbound HTTP request with a 30-second client timeout and materializes all returned samples in backend memory; SQL sort, limit, and most filters are not pushed down. Restrict the endpoint, query window, step, row count, statement timeout, and network egress. Although the source defines username, password, and bearer-token fields, the reviewed constructor does not populate them from server or user-mapping options, so do not assume authenticated Prometheus works without verifying the packaged build. It also unwraps JSON parsing and does not explicitly reject HTTP error status. Test malformed/error responses, TLS trust, planner rescans, parallel queries, timestamp boundary semantics, large series sets, and credential handling before production use.