mirror of
https://github.com/hanzoai/o11y.git
synced 2026-10-15 12:58:33 +00:00
Every metric read through PromQL failed with "Database o11y_metrics does not exist": dashboards, service health, ingest, memory, plane throughput and alert delivery all returned an error the UI renders as an empty chart. 96 failures in 30 minutes on one pod, every one of them this. Metrics moved into the one event plane and telemetrymetrics moved with them -- DBName is "event", the tables are series and metric. This package did not, because it kept its OWN copy of those names, and a copy has no reason to change when the original does. It went on addressing signoz-era names in a database that the rename left behind. So it no longer keeps a copy. databaseName and samplesTableName alias the telemetrymetrics constants, and the rollup choice is telemetrymetrics' WhichTSTableToUse -- the same function every other metrics builder calls -- so one window resolves to one table service-wide instead of two selectors drifting apart. That also gains the 1-week tier this package never had: a 30-day PromQL range read the 1-day rollup because the duplicate stopped at 1 day. The tests assert the rendered SQL. Nothing did before, which is exactly why a dead database name survived a rename and shipped.
31 lines
1.4 KiB
Go
31 lines
1.4 KiB
Go
package datastoreprometheus
|
|
|
|
import (
|
|
"github.com/hanzoai/o11y/pkg/telemetrymetrics"
|
|
)
|
|
|
|
// PromQL reads the same two tables every other metrics query reads, so it reads
|
|
// their names from telemetrymetrics and nowhere else. This package used to keep
|
|
// its own copy — o11y_metrics.distributed_time_series_v4 and friends — and that
|
|
// is how it went on addressing a database that stopped existing when metrics
|
|
// moved into the one event plane: a copy has no reason to change when the
|
|
// original does. A second spelling of a physical name is a second thing to
|
|
// migrate, and the one the migration does not read is the one that rots.
|
|
const (
|
|
databaseName = telemetrymetrics.DBName
|
|
samplesTableName = telemetrymetrics.MetricTableName
|
|
)
|
|
|
|
// getStartAndEndAndTableName returns the start time, end time and the series
|
|
// table to read, picking the coarsest rollup the requested window can afford.
|
|
//
|
|
// The choice is telemetrymetrics.WhichTSTableToUse — the same function every
|
|
// other metrics query builder calls, so one window resolves to one table across
|
|
// the whole service. PromQL has no read buffer and no table hints to offer it.
|
|
func getStartAndEndAndTableName(start, end int64) (int64, int64, string) {
|
|
adjustedStart, adjustedEnd, tableName, _ := telemetrymetrics.WhichTSTableToUse(
|
|
uint64(start), uint64(end), false, nil,
|
|
)
|
|
return int64(adjustedStart), int64(adjustedEnd), tableName
|
|
}
|