Repository navigation
Conversation
The Maple source behind @maple/promql. A selector's metric name resolves through metric_catalog to stored metrics the way Prometheus' OTLP translation names them (`http.server.request.duration` answers to `http_server_request_duration_seconds_bucket`, a monotonic sum to `..._total`, scraped names match as stored), and each (table, component) it resolves to becomes one warehouse query. That query pushes the label matchers into WHERE, rebuilds counters (delta sums become running sums, explicit histograms expand into cumulative `le` series) and returns one row per series with every bucket's statistics, so the evaluator recombines whole buckets instead of reading raw samples. Series labels follow the OTLP mapping: datapoint attributes, promoted resource attributes, and job/instance from service.name and service.instance.id. PromqlQueryService runs a query: validate, plan, one catalog read, the selector queries concurrently, evaluate. apps/cli/test/promql-engine stores the compliance dataset in chDB the way Maple stores it and every corpus query must equal the in-memory reference, which matches Prometheus 3.5.
The series key hashed every resource attribute, but the labels drop service.*, telemetry.* and maple* keys. A deploy that changed service.version split one counter into two series with the same labels, and rate() over the deploy failed with a duplicate labelset. The key now hashes exactly what the labels are built from. Pushed-down regexes are anchored as ^(?s:...)$, the way Prometheus and the evaluator's RE2 anchor them. A selector may resolve to at most 100 stored metrics, the catalog read fails instead of truncating past 50,000 metrics, and resolution limits run before anything is read.
# Conflicts: # .github/workflows/ci.yml # packages/query-engine/package.json
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait...
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…ver splits a series The catalog took one arbitrary unit per metric name, so a name exported in ms by one service and in s by another answered to one Prometheus name with mixed values. Names now resolve per (name, unit) and the scan reads only the resolved pairs: request_duration_seconds and request_duration_milliseconds are separate metrics. The series key hashes sorted attribute maps, so an exporter reordering attributes keeps one series. A selector read that hit its row limit fails instead of returning what survived the le check after the limit.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Matcher values can carry user identifiers; record the query length instead. The selector and metric attributes already identify the read.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Without it the OrgId filter did not count, every selector read compiled as untenanted and the warehouse refused it. The chDB parity suite now asserts every compiled read is single-tenant.
This comment has been minimized.
This comment has been minimized.
# Conflicts: # .github/workflows/ci.yml
Maple review🟡 Confidence 6/10 · needs attention. Held at 6 because a correctness warning is open. Runs PromQL on the metric tables: Prometheus names resolve through
Before merge
Findings🟠 Warning · F4 ·
|
|
Note ⏳ Maple is reviewing this pull request at |

Native PromQL, part 2: run PromQL on the metric tables.
What changed
packages/query-engine/src/promql: a selector's metric name resolves throughmetric_catalogto stored metrics the way the OTLP-to-Prometheus translation names them (http.server.request.durationin seconds answers tohttp_server_request_duration_seconds_bucket, a monotonic sum to..._total, scraped names match as stored). Each (table, component) becomes one warehouse query that pushes label matchers intoWHERE, turns delta sums into running counters, expands explicit histograms into cumulativeleseries, and returns one row per series with every bucket's statistics.job/instancefromservice.nameandservice.instance.id. The series key hashes exactly what the labels are built from, so a deploy that changesservice.versionkeeps one series.PromqlQueryService: validate, plan, one catalog read, the selector queries concurrently, evaluate. A selector may resolve to at most 100 stored metrics, and an org with more catalog rows than one read holds gets an error instead of silently missing names.How it was verified
apps/cli/test/promql-engine.test.ts(chDB, added to the CI chDB list) stores the compliance dataset the way Maple stores it and requires every corpus query to equal the in-memory reference, which matches Prometheus 3.5: all pass.apps/cli/test/promql-source.test.ts: every bucket field against a reference in bucketed and raw mode, all four matcher operators, a counter reset, delta sums, histograms, org isolation, the series cap, and one series across a deploy.Known limit: a delta-temporality counter's raw value is a running sum from the scan start, so only functions of differences (
rate,increase,resets) are exact on it.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit