mirror of
https://github.com/SigNoz/signoz.git
synced 2026-08-08 14:10:42 +01:00
Some checks failed
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
cacheci / tests (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
The `telemetry.*.last_observed` stats took `max()` over client-supplied event-time columns, so a single row with a skewed or corrupt timestamp (a 2050-dated log, a `2^32−1`-second span) poisoned them indefinitely. ### What - Traces/logs `last_observed` now reads `max(inserted_at)` — the collector-stamped insert time added in SigNoz/signoz-otel-collector#875; metrics reads `inserted_at_unix_milli` (metrics migration 1007). - Each signal checks `hasColumnInTable` first and falls back to the previous expression, so tenants without the schema migration keep today's behavior and switch over automatically. ### Notes - `created_at` is unusable here: pre-migration rows evaluate its `now64(3)` default at read time, so `max(created_at)` always reads as "now". - Pre-migration rows read `inserted_at` as epoch, which `max()` ignores; the all-old case lands on the existing `Unix() != 0` skip-guard. - Future-dated garbage never TTLs out (TTL is keyed on the event timestamp), which is why the old stat stayed wrong once poisoned. ### Testing - Expressions validated against `clickhouse local`, including garbage rows (`2^64−1`, `9.3e18` ns) and empty/pre-migration tables. - `go build`, `go vet`, golangci-lint clean. Fixes https://github.com/SigNoz/engineering-pod/issues/5864