Skip to content

feat: per-destination visibility at the destination-filter boundary - #7283

Merged
mihir20 merged 13 commits into
masterfrom
pipeline-inspector/02-per-destination-visibility
Sep 1, 2026
Merged

mihir20 merged 13 commits into
masterfrom
pipeline-inspector/02-per-destination-visibility

Conversation

@mihir20

@mihir20 mihir20 commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

Part of Pipeline Inspector: gives per-destination visibility at the destination-filter boundary so fully- and partially-dropped events stop vanishing from the reporting funnel without a trace.

What changed

Single classification site. The per-destType destination discovery in the fan-out loop is replaced by one classifyDestinations call that splits a source's candidate destinations into available and excluded (with the exclusion reason and status code). A RETL-stamped destination_id narrows the candidate set before classification. isDestinationAvailable (the preprocess guard) and classifyDestinations agree by construction, which is pinned by tests.

Per-source destination snapshot. classifyDestinations runs per event, so it now consumes a sourceDestinations snapshot (destTypes DisplayName → definition for FilterClientIntegrations, byTypeName definition-name → enabled destinations in backend-config order) built once per source under a single config RLock, instead of taking two RLocks and re-scanning the source's destination list for every event. Only the event-dependent work (client-integration filtering, consent filtering) remains per event. Filtering semantics, ordering and RETL narrowing are unchanged.

One flag: Processor.earlyDestinationFilter (reloadable, default true).

  • true (default): behavior is byte-identical to today. Events with no surviving destination drop at the preprocess guard (pre tracking-plan) with the existing source-level destination_filter filtered/298 row. No new rows are emitted anywhere.
  • false: the preprocess guard is skipped, so every event reaches source hydration and tracking-plan validation, and the destination-filter decision moves to fan-out — which becomes the single drop point. Per-destination visibility comes with it unconditionally:
    • destination_enter succeeded/200 for every candidate destination (survivors and excluded alike), so destination_enter − filtered_* = user_transformer input holds per destination;
    • per-destination destination_filter rows for excluded candidates: filtered_integration/298 (integrations opt-out) and filtered_consent/297 (consent denied);
    • filtered_no_destination/298 (source-level, empty destination_id) for zero-candidate events — a source with no destinations, or a RETL event whose stamped destination is unavailable. Without this carve-out those events would disappear from the funnel entirely.

The flag is snapshotted once per batch in preprocessStage and threaded through the stage messages, so an in-flight batch never observes mixed values when the reloadable config flips.

Hard cutover, no dual-emit. With the flag false, the old source-level filtered row stops entirely — there is no intermediate state where the drop moves to fan-out but keeps the old row shape. Consumers of that row (reporting-service filteredEvents, dashboards) must be ready before the flip.

in_pu is left empty on all new rows. The field is slated for deprecation, so no chain value is computed for the rows introduced here, and the inPU values of pre-existing rows (gateway, tracking-plan, source-hydration, user-transformer) are untouched regardless of the flag.

Proc rebuild stage: disabled destinations keep flowing (review follow-up). DESTINATION_ENTER is recorded at fan-out, but a forked event whose destination got disabled before the proc rebuild stage consumed it used to be dropped there with no reporting row — leaving the reporting chain dangling. The rebuild stage now re-hydrates a disabled destination as-is and lets the event continue through the pipeline, so it reaches the router/batchrouter queue and is aborted there with the usual drain reporting ("destination is disabled"). A destination deleted from the config is still dropped at rebuild to a terminal Filtered status: without its config there is no destination type, hence no transformation to run and no router queue to store to.

New reloadable flag Processor.DestinationIsolation.dropEventsForDisabledDestAtProcRebuild (default false) opts back into the early drop for disabled destinations — useful for draining a proc-table backlog quickly after the user disables a misbehaving destination.

Behavior summary for a fully-dropped event

Processor.earlyDestinationFilter Drop point Rows emitted
true (default) preprocess guard, pre-TP old source-level filtered/298 only — identical to today
false fan-out, post-TP destination_enter ×N + filtered_* ×N; zero-candidate events emit filtered_no_destination/298

Side effects of flipping to false, for rollout notes: zero-destination events now incur source-hydration/TP transformer cost for sources that have those configured, and TP incoming/violation counts increase accordingly (arguably a fix — TP health no longer silently excludes events whose user opted out of every destination).

Tests

  • TestClassifyDestinations: unit coverage of the classifier — integrations/consent exclusion, RETL narrowing, ordering, disabled destinations excluded from the candidate set, and an invariant subtest that len(available) > 0 agrees with isDestinationAvailable across a case table.
  • TestDestinationVisibilityReporting: stage-level coverage of the fan-out reporting — enter/filter row shapes, the zero-candidate and RETL carve-outs, forked-destination enter rows, both flag states, and mid-flight flag flips on the same handle.
  • TestProcRebuildStage: config-drift coverage of the rebuild stage — a disabled destination flows through re-hydrated as-is by default, is dropped as Filtered when dropEventsForDisabledDestAtProcRebuild is set, and a deleted destination is always dropped.
  • integration_test/reporting_dropped_events: an end-to-end scenario driving one server through both flag states against a real Postgres reports table (preprocess row byte-compat, enter rows, partial exclusion, zero-candidate).

Linear Ticket

pipe-3286

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@mihir20

mihir20 commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Stack (merge bottom-up)

@codecov

codecov Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.74%. Comparing base (e7e50b5) to head (cc80dc9).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7283      +/-   ##
==========================================
- Coverage   79.84%   79.74%   -0.10%     
==========================================
  Files         611      611              
  Lines       68316    68418     +102     
==========================================
+ Hits        54545    54559      +14     
- Misses      10566    10641      +75     
- Partials     3205     3218      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mihir20
mihir20 marked this pull request as draft August 18, 2026 07:03
@mihir20
mihir20 force-pushed the pipeline-inspector/01-dedup-metrics branch from 17bcee0 to 5445674 Compare August 19, 2026 10:57
@mihir20
mihir20 force-pushed the pipeline-inspector/02-per-destination-visibility branch 2 times, most recently from 2155a5b to 63dfc97 Compare August 19, 2026 11:29
Base automatically changed from pipeline-inspector/01-dedup-metrics to master August 19, 2026 12:14
@mihir20
mihir20 force-pushed the pipeline-inspector/02-per-destination-visibility branch from 63dfc97 to d4c03d8 Compare August 19, 2026 12:17
@mihir20
mihir20 marked this pull request as ready for review August 20, 2026 17:14
Comment thread utils/types/types.go Outdated
DrainEventCode = 410
SuccessEventCode = 200
DeliveredWithWarningCode = 296
ConsentDeniedEventCode = 297

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this require a new status code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's as per the original design proposal 😅. We are distinguishing filtering at a stage with different status codes for different statuses.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still trying to remember why we need this, I mean we are using different statuses already

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I was influenced by the reportingv2 solution where counter labels are stable and we classify through special category codes. But not sure there is any benefit in the current design by inventing yet another status code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, will move to old filter status code. we can update later if required. So far I also do not see a need of a diff code

Comment thread processor/processor.go Resolved
Comment thread processor/processor.go Resolved
@mihir20
mihir20 requested a review from atzoum August 25, 2026 15:10
@mihir20
mihir20 force-pushed the pipeline-inspector/02-per-destination-visibility branch from cb7f42b to ef26068 Compare August 27, 2026 07:44
Comment thread processor/proc_consumer.go Outdated
// so the reused transform stages operate on them unchanged.
// passed them.
//
// Config drift between fan-out and consume: a destination deleted from the config

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice destinations are soft deleted, never hard deleted & soft deleted destinations arrive to rudder-server as disabled

Comment thread processor/processor.go Outdated
// survive filtering (available) and the ones excluded, with reason and status code, in the same
// order and applying the same filters the fan-out uses today: client-integration filtering first,
// then consent filtering. When specificDestID is set (RETL), the candidate set is narrowed to that
// single destination before classification — sibling destinations are never candidates and produce

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are sibling destinations?

Comment thread utils/types/types.go Outdated
DrainEventCode = 410
SuccessEventCode = 200
DeliveredWithWarningCode = 296
ConsentDeniedEventCode = 297

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I was influenced by the reportingv2 solution where counter labels are stable and we classify through special category codes. But not sure there is any benefit in the current design by inventing yet another status code.

@atzoum atzoum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mihir20 I think that ideally, destination-specific reports should be persisted on the same tx that writes jobs to rt & batchrt jobsdb. Not a hard requirement though

@mihir20
mihir20 force-pushed the pipeline-inspector/02-per-destination-visibility branch 2 times, most recently from 7c978b4 to 2af0265 Compare August 31, 2026 06:54
mihir20 added 10 commits August 31, 2026 13:00
… boundary

Add classifyDestinations as the single classification site at fan-out,
narrowing the candidate set to the RETL-stamped destination before
classification, and emit per-candidate destination_enter succeeded/200
rows (Reporting.destinationEnterMetrics.enabled) plus per-destination
filtered_integration/298 and filtered_consent/297 destination_filter
rows (Reporting.perDestinationFilterMetrics.enabled), with a
filtered_no_destination/298 carve-out for zero-candidate events.

Processor.earlyDestinationFilter (default true) gates the reorder: when
false the preprocess destination-filter guard is skipped so all events
reach source hydration and tracking-plan validation, fan-out becomes the
drop point, and the inPU chain labels are rewired to the new stage order
(source_hydration=gateway, tracking_plan_validator=srchyd|gateway,
user_transformer=destination_filter). The flag is snapshotted once per
batch and threaded through the stage messages so one in-flight batch
never observes mixed values. All flags are reloadable and default to
byte-identical-to-today behavior.

Co-Authored-By: Claude Fable 5 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.28.0
The old two-level per-destType fan-out loop was collapsed into a single
loop over availableDestinations, but the inner block's indentation and
closing brace were left behind, breaking the build at processor.go:2577.

Co-Authored-By: Claude Fable 5 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
…ctions and update related logic

🔒 Scanned for secrets using gitleaks 8.28.0
…lter handling in reporting

🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
… destination classification

🔒 Scanned for secrets using gitleaks 8.28.0
… rehydration and update related logic

🔒 Scanned for secrets using gitleaks 8.28.0
- procRebuildStage: describe soft-deletion/disabled as the real config-drift
  case and the missing-destination drop as a defensive fallback (review
  r3878718615)
- classifyDestinations: replace invented 'sibling destinations' term with an
  explanation in terms of RETL per-connection copies (review r3878840812),
  and retire the term from test names

Co-Authored-By: Claude Fable 5 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.28.0
…es 298

Per review (r3829990734): the status string, not the status code, is the
discriminator within the filtered_* family — filtered_integration,
filtered_no_destination and the filtered rows of dedup already share
FilterEventCode = 298, so a dedicated 297 for filtered_consent added no
information (and collided with StatusMirrorFiltered = 297 in
processor/internal/transformer).

Co-Authored-By: Claude Fable 5 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.28.0
@mihir20
mihir20 force-pushed the pipeline-inspector/02-per-destination-visibility branch from 2af0265 to 71deb70 Compare August 31, 2026 07:44
…lity

A consent-gated destination (oneTrustCookieCategories) denied by the event's
context.consentManagement.deniedConsentIds produces one filtered_consent/298
row for that destination, destination_enter rows for all candidates, no
source-level row, and delivery continues to the consented destinations.

Co-Authored-By: Claude Fable 5 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.28.0
@mihir20 mihir20 changed the title feat(processor): per-destination visibility at the destination-filter boundary feat: per-destination visibility at the destination-filter boundary Aug 31, 2026
@ktgowtham
ktgowtham removed their request for review August 31, 2026 17:17
@mihir20
mihir20 merged commit 3d83f02 into master Sep 1, 2026
77 checks passed
@mihir20
mihir20 deleted the pipeline-inspector/02-per-destination-visibility branch September 1, 2026 10:26
This was referenced Sep 7, 2026
mihir20 pushed a commit that referenced this pull request Sep 7, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.86.0-rc.1](v1.85.0...v1.86.0-rc.1)
(2026-09-07)


### Features

* backend config v2-to-v1 mapper
([#7315](#7315))
([887f6d2](887f6d2))
* **core:** capture the final recorded error for failed rETL records
([#7295](#7295))
([f4dc4d9](f4dc4d9))
* per-destination visibility at the destination-filter boundary
([#7283](#7283))
([3d83f02](3d83f02))
* user_suppression counter via suppressed dummy jobs
([#7325](#7325))
([77d3d37](77d3d37))
* **warehouse:** support jsonPaths for gcs datalake
([#7333](#7333))
([e714140](e714140))


### Bug Fixes

* rsources failed-records pagination drops records across failed-key
boundaries
([#7329](#7329))
([0a50439](0a50439))
* **warehouse:** stop logging full schemas on table-level schema
mismatch
([#7339](#7339))
([f244c14](f244c14))
* **warehouse:** upgrade clickhouse v2 driver
([#7332](#7332))
([e2c5cb9](e2c5cb9))


### Miscellaneous

* **ci:** remove unused Snyk policy file (SEC-409)
([#7317](#7317))
([d60b3c6](d60b3c6))
* make reporting 413 handling unconditional
([#7313](#7313))
([d2474e9](d2474e9))
* moving pyt contract tests
([#7327](#7327))
([8316af2](8316af2))
* **processor:** pipeline attribution in processor stats
([#7326](#7326))
([3e97f7c](3e97f7c))
* skip consent and connection-mode filtering for replays of non-existent
connections
([#7323](#7323))
([d2474e9](d2474e9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
mihir20 pushed a commit that referenced this pull request Sep 8, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.86.0](v1.85.0...v1.86.0)
(2026-09-07)


### Features

* backend config v2-to-v1 mapper
([#7315](#7315))
([887f6d2](887f6d2))
* **core:** capture the final recorded error for failed rETL records
([#7295](#7295))
([f4dc4d9](f4dc4d9))
* per-destination visibility at the destination-filter boundary
([#7283](#7283))
([3d83f02](3d83f02))
* user_suppression counter via suppressed dummy jobs
([#7325](#7325))
([77d3d37](77d3d37))
* **warehouse:** support jsonPaths for gcs datalake
([#7333](#7333))
([e714140](e714140))


### Bug Fixes

* rsources failed-records pagination drops records across failed-key
boundaries
([#7329](#7329))
([0a50439](0a50439))
* **warehouse:** stop logging full schemas on table-level schema
mismatch
([#7339](#7339))
([f244c14](f244c14))
* **warehouse:** upgrade clickhouse v2 driver
([#7332](#7332))
([e2c5cb9](e2c5cb9))


### Miscellaneous

* **ci:** remove unused Snyk policy file (SEC-409)
([#7317](#7317))
([d60b3c6](d60b3c6))
* make reporting 413 handling unconditional
([#7313](#7313))
([d2474e9](d2474e9))
* moving pyt contract tests
([#7327](#7327))
([8316af2](8316af2))
* **processor:** pipeline attribution in processor stats
([#7326](#7326))
([3e97f7c](3e97f7c))
* skip consent and connection-mode filtering for replays of non-existent
connections
([#7323](#7323))
([d2474e9](d2474e9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
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.

3 participants