Explore documentation
Schema migration Feb ’26
We’re unifying how we store user-defined metrics extracted from logs and spans alongside Prometheus metrics.
Going forward, there’s just one way to query your metrics.
Schema overview
Our new row-based schema stores all data in a unified format:
- Metrics stored as named values with labels in a
tagsmap - Original log data accessible via
_row_type = 'log' - Aggregated metric functions for efficient querying
| Old schema | New schema |
|---|---|
response_status |
label('response_status') |
buckets |
bucket_bounds + bucket_counts |
p50, p90, p95, p99 |
histogramQuantile(0.5), histogramQuantile(0.9), ... |
_row_type = 'logs' |
_row_type = 'log' |
Accessing tags and labels
All non-aggregated columns that were previously accessed directly must now use the label() function. Labels are always strings, so toString(label(...)) is redundant.
Standard columns
The following columns are part of the schema itself and don't need the label() wrapper.
Row type filtering
Each ingested event creates multiple rows. One row for the original event (_row_type = 'log' or 'span'), and multiple for extracted metrics (_row_type = 'extracted_metric').
| Value | Alias | Description |
|---|---|---|
1 |
'log' |
Original log event |
2 |
'extracted_metric' |
Metrics extracted from logs/spans |
3 |
'span' |
Original span event |
Count log events
Don't use _row_type = 'log' or 'span' when querying named metrics
Type handling for labels
Since labels are always strings, you must handle type conversions explicitly when comparing to numbers.
Numeric comparison
Histograms and buckets
The new schema uses bucket_bounds and bucket_counts, with the counts storing deltas. sumForEachMerge() is used to sum these deltas.
Quantiles and percentiles
Use the histogramQuantile(p) helper function for single metrics, or quantilePrometheusHistogramArrayMergeIf(p)(bucket_quantiles, condition) for multiple metrics.
Event counting
For aggregated metrics queries, use countMerge(events_count). Because a single event can be represented as multiple metric rows, you need to add the AND _row_type = 'log' filter to get accurate event counts.
This change will go in effect for existing organizations during February ’26.
Let us know at hello@betterstack.com if you have any feedback. We hope this change will make the product more straightforward and intuitive going forward.