runtime-next: add minimum interval for post-txn triggers#3110
Open
dgreer-dev wants to merge 1 commit into
Open
runtime-next: add minimum interval for post-txn triggers#3110dgreer-dev wants to merge 1 commit into
dgreer-dev wants to merge 1 commit into
Conversation
|
🚀 Preview deployed to https://docs.estuary.dev/pr-preview/pr-3110/ 📄 Changed pages: |
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.
Description:
Adds an optional minimum fire interval (debounce) to materialization webhook triggers, for the V2 runtime. Fixes #3060.
Triggers previously fired once per committed transaction that materialized data, so a burst of transactions produced a burst of webhook deliveries (potentially costly). With an
intervalset, a burst collapses into at most one delivery per interval, whose payload covers the union of the collapsed transactions. The old connector-side dbt trigger had an equivalent debounce, this generalizes it to runtime triggers.Mechanically: each trigger config accumulates a pending window in a leader-lifetime accumulator, keyed by the config's method+URL. At commit time the accumulator is persisted and configs whose interval has elapsed fire with their accumulated window. The rest keep accumulating and fire either at the first commit at-or-after their interval elapses (fast path) or, if the task goes quiet, from the leader's idle loop once the deadline passes (so a debounced window never hangs waiting for a next transaction).
Workflow steps:
Add
intervalto a trigger config on a materialization:Unset preserves today's fire-every-transaction behavior; existing specs are unchanged. The field is per-config, so e.g. a Slack notification can fire every transaction while a dbt run on the same materialization is debounced to 30m.
Documentation links affected:
site/docs/concepts/materialization/materialization-triggers.md— updated in this PR:intervaladded to the spec example, properties table, and SOPS-excluded-fields list.Notes for reviewers:
HeadIdlefires due windows from idle and otherwise sleeps until the earliest pending deadline, so a burst's tail is delivered within its interval even with no further commits. The idle fire requiresTail::Doneand rotates the Tail into its normalTrigger→Persist→Donesequence, so it can't race a commit-path fire.TriggerVariablesto a{method+url → TriggerVariables}map. Both runtimes decode through the new serde-untaggedmodels::triggers::PersistedTriggerParams(the formats are mutually unambiguous), so: V2 recovering a pre-upgrade blob fans it out to all configs (its original fire-all semantics), and V1 after a V2→V1 rollback merges a map blob into one window (its normal fire-all behavior). Residual: a binary downgrade to a release before this PR has neither fallback — don't downgrade past this release while a trigger is mid-debounce.last_fire): a leader failover resets the window, worst case one early fire — same as pre-debounce behavior. Recovery re-fires the persisted accumulator verbatim (at-least-once), which can also mean one early fire post-recovery.interval(no debounce), and its only code change is the tolerantPersistedTriggerParamsdecode above.