Skip to content

PromQL /series still scans every sample: no block records the label COMBINATIONS it answers with #7710

Closed

Description

@robfrank

Follow-up to #7660, which stopped GET /prom/api/v1/label/{name}/values scanning the samples by unioning each
sealed block's declared distinct tag values.

The gap

GetPromQLSeriesHandler is the other discovery endpoint and it was NOT fixed by that change, because the answer
it produces is a different shape:

$ grep -n 'forEachRow' server/src/main/java/com/arcadedb/server/http/handler/*.java
server/src/main/java/com/arcadedb/server/http/handler/GetPromQLSeriesHandler.java:145:        engine.forEachRow(startMs, endMs, columnIndices, null, null, row -> {

It returns the distinct label COMBINATIONS a metric carries - one JSON object per {host, region, ...} tuple -
and nothing on disk records a tuple. BlockEntry.tagDistinctValues is per COLUMN
(engine/src/main/java/com/arcadedb/engine/timeseries/TimeSeriesSealedStore.java:162, "indexed by schema column
index"), so the cross product of two columns' declared sets over-counts: a block declaring
host in {h1, h2} and region in {eu, us} is consistent with two combinations or with four, and the entry
cannot say which.

So this endpoint still walks every sample of every matching type, exactly as label-values did before #7660, and
Grafana calls it on the same dashboard-load path.

Suggested work

Three options, in increasing cost:

  1. Record the distinct COMBINATIONS per block alongside the per-column sets, at seal time, capped - the tuple
    cardinality of one block is bounded by its sample count but not by anything smaller, so an uncapped set is a
    new way to blow up a block header. A cap turns the entry into a hint, and a block over the cap falls back to
    the scan, the same shape collectDistinctTagValues already uses for a block with no usable declaration.
  2. Answer from the per-column sets when a block declares EVERY tag column as a single value - that block
    contributes exactly one combination and needs no read at all. blockMatchesTagFilter already computes that
    condition for pruning (allSingleMatch), which is a common shape for Prometheus data where one block holds one
    series.
  3. Leave the scan and bound it: the endpoint has no limit, so a high-cardinality metric answers with everything.

Option 2 is the cheapest real win and needs no new on-disk state.

Verification

  • Byte-identical response to the scanning implementation, including the ordering the handler documents (earliest
    first-observed timestamp first).
  • A block holding more than one combination must not be answered from the per-column sets: the cross product is
    the wrong answer and a test has to hold a block that proves it.
  • The start/end bounds the endpoint already honours must keep being honoured.

Activity

  1. added
    server
    timeseries
    on Sep 16, 2026
  2. added this to the 26.10.1 milestone on Sep 16, 2026
  3. added
    in progress
    on Sep 16, 2026
  4. self-assigned this
    on Sep 16, 2026
  5. added 6 commits that reference this issue on Sep 16, 2026
  6. lvca commented on Sep 16, 2026

    @lvca
    Member

    Fixed in #7730, released in 26.10.1.

    GET /prom/api/v1/series no longer reads every sample to list which label combinations a metric has. Where a stored block holds a single series - the usual shape for Prometheus data - the answer is now taken from the block's own summary without reading it at all. Blocks that hold more than one combination, or that are only partly inside the requested time range, are read as before.

    The response is unchanged, ordering included; only the work behind it is smaller. This mainly helps Grafana dashboard loads, which call this endpoint on every refresh.

    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  7. removed
    in progress
    on Sep 16, 2026
  8. added a commit that references this issue on Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

performanceservertimeseries

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions