Repository navigation
feat: Enhanced Severity filter for logs - #3437
SpencerTorres wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 2faf6d1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
E2E Test Results✅ All tests passed • 456 passed • 1 skipped • 1867s
Tests ran across 4 shards in parallel. |
Duplicate code analysis2 new clones introduced by this PR.
If one of these duplicates a helper that already exists, import it instead jscpd compared this branch against |
[Medium impact] The changes reach log search and several log-error views. Guard string-backed severity numbers before merging so automatic error queries do not fail.
|
| const numberExpr = getSelectableSeverityNumberExpression(source); | ||
| if (numberExpr == null) return undefined; |
There was a problem hiding this comment.
String severity columns break queries
If a saved source points severityNumberExpression at a String column, getSeverityClassKey accepts it and builds comparisons such as SeverityNumber >= 21, which ClickHouse rejects. The new LLM error counts and Kubernetes “Errors” tables apply this SQL automatically, so previously working queries now fail. The form warning neither protects existing sources nor blocks saving.
Check the expression’s type before enabling these queries, or convert it safely.
Closes HDX-5776. Stacked on the HDX-5768 PR.
Why
HDX-5768 made log levels display from the OTel
SeverityNumber, but filters still match the rawSeverityText. A row shown asERRORbecause its number is 17 doesn't matchSeverityText:errorwhen its text is empty or spelled differently ("ERROR", "err", "critical"). To find errors, users have to know every spelling. This adds a Severity filter that matches on intent instead: the class comes fromSeverityNumber(1-24) when that's set, and from the text otherwise. It uses the same rules as the HDX-5768 labels.SeverityTextfilters, its facet, and every existing saved search, alert and dashboard behave exactly as before.Changes
Class SQL (
@hyperdx/common-utilscore/severity):buildSeverityClassExpressionV1generates the ClickHouse expression from the rules table the UI labels use.multiIf: SeverityNumber thresholds first (21+ FATAL … 1+ TRACE), then oneSeverityText ILIKE '<word>%'check per common level word (e.g.err,crit,panic,warn,inf), else OTHER. There's no regex. Broader guessing (punctuation, rarer spellings) belongs to the collector.Severity facet: first in the search sidebar, with fixed values in severity order (TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OTHER for unrecognized text). Selecting a value writes
<class expression> IN ('ERROR')in the existing filter format. Only, Exclude, Clear and percentages work as on other facets. The facet doesn't fetch its values.Pills, saved searches and source switching: pills read
Severity = ERROR. The save modal showsSeverity: ERROR. Switching sources moves the filter to the new source's expression.Consumers: on sources with the field, the Kubernetes "Errors" log tables and the LLM dashboard error counts match FATAL and ERROR. That also catches
critical,fatal,panicand number-only errors.Alert text: notifications show
Severity: ERRORinstead of about 800 characters of SQL. How the alert is evaluated is unchanged.Source form: the Severity Number Expression help text says it must be an OpenTelemetry SeverityNumber, and the form marks a non-numeric expression as invalid, since the class SQL compares it with numbers.
Compatibility and cost
SeverityText, so those queries fall back to the raw table (still correct). The changeset suggests adding SeverityNumber to the views' dimensions.SeverityTextcounts by design. For example, (9, "error") is INFO, because the number wins.How to reproduce
yarn devon this branch and register a fresh account. The default Logs source has Severity Number Expression set toSeverityNumber.-H "authorization: <ingestion key>"(Team Settings → API Keys) and use the OTLP HTTP port shown in the dev portal at http://localhost:9900.SeverityText:erroronly finds "old HyperDX SDK".Severity = ERROR. Save the search and reload: the filter is still applied.Screenshots