You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`GET /loki/api/v1/query`| Instant query. Supports the same LogQL used by Grafana's Explore panel. An optional `time` parameter (nanoseconds) defaults to "now", and the adapter automatically looks back 5 minutes when computing SQL bounds. |
125
-
|`GET /loki/api/v1/query_range`| Range query. Requires `start`/`end` nanoseconds and accepts `limit`/`step`. Log queries stream raw lines; metric queries return Loki matrix results and require `step` to match the range selector duration. |
126
+
|`GET /loki/api/v1/query_range`| Range query. Requires `start`/`end` nanoseconds and accepts `limit`/`step`. Log queries stream raw lines; metric queries return Loki matrix results and require a `step`value (the adapter may clamp it to keep bucket counts bounded, default cap 240 buckets). |
126
127
|`GET /loki/api/v1/labels`| Lists known label keys for the selected schema. Optional `start`/`end` parameters (nanoseconds) fence the search window; unspecified values default to the last 5 minutes, matching Grafana's Explore defaults. |
127
128
|`GET /loki/api/v1/label/{label}/values`| Lists distinct values for a specific label key using the same optional `start`/`end` bounds as `/labels`. Works for both `loki` and `flat` schemas and automatically filters out empty strings. |
128
129
|`GET /loki/api/v1/index/stats`| Returns approximate `streams`, `chunks`, `entries`, and `bytes` counters for a selector over a `[start, end]` window. `chunks` are estimated via unique stream keys because Databend does not store Loki chunks. |
@@ -148,7 +149,7 @@ The adapter currently supports a narrow LogQL metric surface area:
148
149
- Range functions: `count_over_time` and `rate`. The latter reports per-second values (`COUNT / window_seconds`).
149
150
- Optional outer aggregations: `sum`, `avg`, `min`, `max`, `count`, each with `by (...)`. `without` or other modifiers return `errorType:bad_data`.
150
151
- Pipelines: only `drop` stages are honored (labels are removed after aggregation to match Loki semantics). Any other stage still results in `errorType:bad_data`.
151
-
-`/loki/api/v1/query_range` metric calls must provide `step`, and `step`must equal the range selector duration so Databend can materialize every bucket in a single SQL statement; the adapter never fans out multiple queries or aggregates in memory.
152
+
-`/loki/api/v1/query_range` metric calls must provide `step`. When the requested `(end - start) / step`would exceed the configured bucket cap (default 240, tweak via `--max-metric-buckets`), the adapter automatically increases the effective step to keep the SQL result size manageable; the adapter never fans out multiple queries or aggregates in memory.
152
153
-`/loki/api/v1/query` metric calls reuse the same expressions but evaluate them over `[time - range, time]`.
153
154
154
155
Both schema adapters (loki VARIANT labels and flat wide tables) translate the metric expression into one SQL statement that joins generated buckets with the raw rows via `generate_series`, so all aggregation happens inside Databend. Non-metric queries continue to stream raw logs.
0 commit comments