TimelessMetrics.Query (timeless_metrics v6.0.12)

Copy Markdown View Source

Query engine with automatic tier selection.

For raw queries, reads gorilla-compressed segments from shard DBs. For aggregate queries, reads from rollup tiers when the time range falls outside raw retention, or when a matching tier resolution exists. Stitches results across tiers for queries spanning multiple windows.

Summary

Functions

Query with aggregation. Automatically selects the best tier.

Query the latest value for a series. Checks raw segments first (from shard DB), then falls back to the finest rollup tier.

Query raw points for a series within a time range.

Read pre-computed rollup data directly from a tier table.

Functions

aggregate(store, series_id, opts \\ [])

Query with aggregation. Automatically selects the best tier.

When a schema is provided, the query router will read from rollup tables if the data is available there, falling back to raw segments.

Returns {:ok, [{bucket_timestamp, aggregate_value}, ...]}.

latest(store, series_id, opts \\ [])

Query the latest value for a series. Checks raw segments first (from shard DB), then falls back to the finest rollup tier.

raw(store, series_id, opts \\ [])

Query raw points for a series within a time range.

Reads from the shard DB that owns this series_id.

Returns {:ok, [{timestamp, value}, ...]} sorted by timestamp.

read_tier(store, tier_name, series_id, opts \\ [])

Read pre-computed rollup data directly from a tier table.

Returns {:ok, [%{bucket: ts, avg: v, min: v, max: v, count: n, sum: v, last: v}, ...]}.