Code-quality pass on the OTEL legacy-logs module. Collapses the four structures
that were each keyed by LogsTableName (the source map, the column switch, and the
error/warning severity switches) plus the filter-template map into a single
OTEL_SOURCES descriptor, so every table is described once and coverage can be
eyeballed against the enum. Adding or changing a table is now one object entry
instead of edits across five sites.
- Introduce OtelSourceDescriptor { source, columns?, filterTemplates?, error?,
warning?, basePredicate? } and read it from genOtelWhere / genOtelSelectColumns
/ the chart builder. Deletes genOtelExtraColumns, otelErrorCondition,
otelWarningCondition, LOG_TABLE_TO_OTEL_SOURCE and SQL_FILTER_TEMPLATES_OTEL.
- Extract the duplicated OTEL timestamp heuristic into a shared
parseOtelTimestamp in otel-inspection.utils, used by both the legacy path and
unified-logs-infinite-query (which had a near-verbatim copy).
- Data-drive the single-log metadata reconstruction via a SINGLE_LOG_METADATA map
so the api/database branches share one path and the unchecked cast is isolated.
- Use the confirmed OTEL error-code key (response.headers.sb_error_code) and note
that the JWT/apikey subtree exists as flattened keys (tracked follow-up).
Behavior-preserving: generated SQL is unchanged (spot-checked against staging),
and the existing unit tests cover the builders and mappers.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>