Skip to content

docs: explain how to reason about dimension anomaly tests - #2319

Merged
joostboon merged 5 commits into
docsfrom
docs-dimension-anomalies-deep-dive
Aug 11, 2026
Merged

docs: explain how to reason about dimension anomaly tests#2319
joostboon merged 5 commits into
docsfrom
docs-dimension-anomalies-deep-dive

Conversation

@joostboon

Copy link
Copy Markdown

Adds a conceptual guide for dimension_anomalies — the test with the most configuration nuance and the sparsest docs. Written to be sendable to a team member who needs to understand the test, not just look up a parameter.

Behaviour was verified against the macros in dbt-data-reliability, because two of the three areas below have answers that are non-obvious from the reference pages.

What it covers

Multiple dimensions produce one composite series per observed combination, not one series per column. Columns are concatenated with ; (NULLs rendered as the literal NULL), so [country, device_os] monitors US; ios, US; android, … Series count multiplies, and combinations are individually noisier than either column alone. Also documented: the dimension list — including its order — is part of the metric identity, so editing or reordering it orphans the collected history and restarts the training set.

detection_delay is not needed to avoid partial buckets. Only complete time buckets are ever evaluated: the newest bucket is the last one whose end falls at or before the invocation time. With daily buckets and a 02:00 run, the newest scored bucket is yesterday 00:00→today 00:00, and today's partial data is never scored. A delay exists for data arriving after its bucket closed. It also snaps to bucket boundaries — a 4-hour delay on a 02:00 run costs a full day, same as asking for one. The case where a delay genuinely is needed: the detection boundary comes from the dbt invocation time (UTC) while buckets align to midnight in the timestamp_column's own frame, so a local-time column can be scored before it is complete.

Training/detection overlap is self-masking, not just imprecise. The expected range at each bucket is a cumulative window over that series up to and including that bucket. With a multi-bucket detection_period, Monday's anomaly joins the training data used to judge Tuesday, widening the range Wednesday is measured against — a sustained incident hides its own tail, giving one alert then silence that reads like recovery. Hence the flat recommendation: detection_period longer than one bucket ⇒ set exclude_detection_period_from_training: true.

Also covered: dimension value lifecycle (previously-seen values get an explicit 0 for empty buckets, which is what makes disappearance detectable; never-seen values get no backfill, so a new value cannot alert on first appearance), the seasonality interaction, the no-timestamp_column mode, and how to read a failure (the failure count is anomalous bucket/value pairs, while stored results deliberately include each affected value's full series for graph context).

Files

  • data-tests/anomaly-detection-tests/understanding-dimension-anomalies.mdx — new page
  • data-tests/anomaly-detection-tests/dimension-anomalies.mdx — series-per-value note and a card link to the guide
  • data-tests/anomaly-detection-configuration/dimensions.mdx — multi-dimension behaviour
  • data-tests/anomaly-detection-configuration/detection-delay.mdx — complete buckets, boundary snapping, how to choose
  • data-tests/anomaly-detection-configuration/exclude_detection_period_from_training.mdx — why the overlap happens
  • docs.json — nav entry

The reference pages repeat the guidance inline rather than only linking out, since skills.md asks for pages to be self-contained enough for Kapa to answer from a single page.

Checks

JSON parses, every internal link and nav target resolves to a real file, MDX tags and fences balanced. mintlify dev was not run — the CLI is not installed locally, so a preview check before merge would be worthwhile.

Note for a follow-up

docs/skills.md instructs git checkout -b docs/<feature-name>, which git cannot push while a branch named docs exists (directory file conflict). Hence the flat branch name here. Worth fixing in the guide separately.

🤖 Generated with Claude Code

Adds a conceptual guide for dimension_anomalies and fills in the three
areas that were hardest to reason about from the reference pages alone:

- Multiple dimensions are concatenated into one composite series per
  observed combination, not one series per column. Documents the
  cardinality multiplication and that editing/reordering the list
  restarts the training set.
- detection_delay: only complete time buckets are ever evaluated, so a
  delay is not needed to avoid partial days. It exists for late-arriving
  data, and it snaps to bucket boundaries, so a sub-bucket delay still
  costs a full bucket of freshness.
- Training/detection overlap: the expected range includes the bucket
  being evaluated, so a multi-bucket detection period lets a sustained
  incident hide its own tail.

Also covers dimension value lifecycle (zero-filling vs. no history),
seasonality interaction, the no-timestamp mode, and how to read a
failure. Reference pages for dimensions, detection_delay and
exclude_detection_period_from_training gained the same guidance so each
page stands alone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 353e774a-9607-4abb-a51b-e2c3daebfaf3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Joost Boonzajer Flaes and others added 4 commits August 11, 2026 15:27
Cut the guide roughly in half and remove the near-verbatim duplication
between it and the reference pages:

- Dropped the configuration checklist accordions; tuning advice already
  lives in the troubleshooting guide.
- detection-delay.mdx keeps the complete-buckets point and the boundary
  table, and links out for the trade-off rather than restating it.
- Trimmed prose throughout.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The previous wording described the detection boundary as a UTC wall-clock
time compared against buckets aligned to the timestamp column's own
midnight, and asserted that a local-time column is scored early. Neither
holds unconditionally:

- The detection boundary is rendered with its UTC offset, while the
  bucket start is rendered without one, so reconciliation depends on the
  adapter and column type.
- Early scoring only occurs when the column's offset is behind UTC; a
  zone ahead of UTC yields a complete bucket.

Reworded to state the asymmetry and tell the reader to verify, instead of
asserting one deterministic behaviour.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The wording assumed a reader comfortable with the internals. Reworded
throughout for a less technical audience:

- Dropped jargon: series, cardinality, composite value, invocation time,
  metric identity, false negatives, standard deviation, bucket boundary.
- Replaced abstractions with what the reader sees: 'each value is checked
  on its own', 'things to watch', 'a long problem covers its own tracks'.
- Rewrote the timezone note as two plain sentences plus what to do.
- Shortened sentences and cut hedging clauses.

Same information, no new claims.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Checked the guide against the original questions and closed two gaps:

- The training and detection periods always overlap. The previous wording
  explained the mechanism but never said this outright, leaving room to
  think careful period-picking avoids it. Also states that the defaults
  (2-day detection period, daily buckets) already trigger it, so the
  recommendation applies to most tests.
- Says explicitly that the job does not need to run at midnight: with
  daily buckets the newest day tested is always yesterday, whatever time
  dbt starts. This was only implied by a single 02:00 example.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@joostboon
joostboon merged commit 54b57be into docs Aug 11, 2026
5 of 6 checks passed
@joostboon
joostboon deleted the docs-dimension-anomalies-deep-dive branch August 11, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant