docs: explain how to reason about dimension anomaly tests - #2319
Merged
Conversation
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>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 literalNULL), so[country, device_os]monitorsUS; 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_delayis 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 thetimestamp_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_periodlonger than one bucket ⇒ setexclude_detection_period_from_training: true.Also covered: dimension value lifecycle (previously-seen values get an explicit
0for 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_columnmode, 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 pagedata-tests/anomaly-detection-tests/dimension-anomalies.mdx— series-per-value note and a card link to the guidedata-tests/anomaly-detection-configuration/dimensions.mdx— multi-dimension behaviourdata-tests/anomaly-detection-configuration/detection-delay.mdx— complete buckets, boundary snapping, how to choosedata-tests/anomaly-detection-configuration/exclude_detection_period_from_training.mdx— why the overlap happensdocs.json— nav entryThe reference pages repeat the guidance inline rather than only linking out, since
skills.mdasks 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 devwas not run — the CLI is not installed locally, so a preview check before merge would be worthwhile.Note for a follow-up
docs/skills.mdinstructsgit checkout -b docs/<feature-name>, which git cannot push while a branch nameddocsexists (directory file conflict). Hence the flat branch name here. Worth fixing in the guide separately.🤖 Generated with Claude Code