Skip to content

feat: user_suppression counter via suppressed dummy jobs - #7325

Merged
mihir20 merged 10 commits into
masterfrom
pipeline-inspector/03-user-suppression-counter
Sep 7, 2026
Merged

mihir20 merged 10 commits into
masterfrom
pipeline-inspector/03-user-suppression-counter

Conversation

@mihir20

@mihir20 mihir20 commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Description

Suppressed events currently vanish at the gateway with only a prometheus stat — no report row, so they are invisible in the funnel and every "missing events" question about a suppressed user is a support ticket. This PR makes suppressed internal-batch events countable as user_suppression/filtered/298 rows, using the exact bot-blocking pattern: the gateway stores a dummy job that rides the normal gateway → jobsdb → processor path, and the processor reports and drops it in preprocess.

Scope decisions:

  • Internal batch path only. The public path (getJobDataFromRequest) always drops suppressed events regardless of the flag, exactly as today — a fully-suppressed public request still short-circuits via errRequestSuppressed. Only extractJobsFromInternalBatchPayload stores dummy jobs.
  • No gateway-side reporting: no Reporting instance, syncer label, or in-tx Report in the gateway — this works unchanged in GATEWAY-mode pods (the PROCESSOR pods own reporting), and no ingestion/succeeded counter is added (the existing GATEWAY PU stays the billing count).

What changed

Gateway — new reloadable flag Gateway.storeUserSuppressedEvents (default false), internal batch path only.

  • Flag off (default): byte-identical to today. Suppressed events are dropped at the gateway and nothing is stored.
  • Flag on: instead of dropping, the internal batch path stores a dummy job whose payload is stripped to messageId, type, event (name) and receivedAt — no properties, traits, context, or identifiers beyond the jobsdb routing key. Suppressed users are typically GDPR-suppressed, so no user data may survive suppression (even a payload-marshal failure drops the event rather than keeping the original payload). The job carries is_user_suppressed: true in its parameters and is excluded from live-event recording (skipLiveEventRecording, same as drop-mode bot events). is_user_suppressed and is_event_blocked are mutually exclusive — a suppressed event skips the event-blocking check.
  • The public path is untouched in every flag state, and the existing gateway.write_key_suppressed_events / write_key_suppressed_requests stats keep incrementing everywhere.

Processor — flag-independent (must be complete before the gateway flag is ever enabled).

At the very top of the preprocess loop — strictly before bot management, event blocking, dedup, and the GATEWAY billing metric — an event whose parameters carry is_user_suppressed: true emits exactly one report row and is unconditionally dropped (reporting on or off):

field value
reported_by (PU) user_suppression — standalone side PU, CreatePUDetails("", USER_SUPPRESSION, false, false)
state filtered (standard filter status, like dedup — reported_by is the discriminator)
status_code 298 (FilterEventCode)
in_pu / terminal / initial "" / false / false

The drop point guarantees suppressed dummy events never enter dedup keys, event schemas, archival, live events, or the GATEWAY billing metric. The new userSuppressionStatusDetailsMap is threaded through the stage messages exactly like the sibling bot/blocking/dedup maps, and the rows ride the existing storeStage reporting transaction.

Linear Ticket

pipe-3287

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 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Stack

@codecov

codecov Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.22%. Comparing base (d60b3c6) to head (3483870).

Files with missing lines Patch % Lines
gateway/handle.go 75.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7325      +/-   ##
==========================================
- Coverage   80.26%   80.22%   -0.04%     
==========================================
  Files         612      612              
  Lines       68676    68749      +73     
==========================================
+ Hits        55121    55157      +36     
- Misses      10306    10349      +43     
+ Partials     3249     3243       -6     

☔ 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 changed the title feat(gateway,processor): user_suppression counter via suppressed dummy jobs feat: user_suppression counter via suppressed dummy jobs Aug 31, 2026
@mihir20
mihir20 force-pushed the pipeline-inspector/03-user-suppression-counter branch from 5746f3f to 544f5e0 Compare August 31, 2026 11:45
@mihir20
mihir20 requested review from atzoum and itsmihir September 1, 2026 05:12
Base automatically changed from pipeline-inspector/02-per-destination-visibility to master September 1, 2026 10:26
@mihir20
mihir20 force-pushed the pipeline-inspector/03-user-suppression-counter branch from 544f5e0 to 262bba3 Compare September 1, 2026 10:35
…y jobs

Suppressed events currently vanish at the gateway with only a prometheus
stat. Behind the new reloadable flag Gateway.storeUserSuppressedEvents
(default false), the gateway now stores a dummy job instead — payload
stripped to messageId/type/event/receivedAt so no user data survives
suppression — marked is_user_suppressed in the job parameters and
excluded from live-event recording, on both the public and internal
batch paths (a fully-suppressed public request stores N dummy jobs and
returns 200 instead of short-circuiting via errRequestSuppressed).

The processor recognises the parameter at the top of the preprocess
loop — before bot management, event blocking, dedup and the GATEWAY
billing metric — emits one filtered/298 row under the new standalone
USER_SUPPRESSION PU (reportedBy is the discriminator, like dedup), and
unconditionally drops the event, following the bot-blocking pattern.
Billing, dedup keys, event schemas and archival are untouched.

The processor side is complete with the gateway flag off, so the flag
may only be enabled once all processor pods run this version.

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

🔒 Scanned for secrets using gitleaks 8.28.0
The public path (getJobDataFromRequest) always drops suppressed events
again, regardless of Gateway.storeUserSuppressedEvents — reverting its
dummy-job block and the per-job parameters override, so a
fully-suppressed public request short-circuits via errRequestSuppressed
exactly as before this branch. The flag now only controls the internal
batch path, where suppressed events become stripped dummy jobs reported
and dropped at the processor.

Public-path Ginkgo specs replaced with a guard that the flag never
leaks back into that path; the integration subtest now drives
/internal/v1/batch for the flag-on flow and pins that /v1/batch stores
nothing even with the flag on.

🔒 Scanned for secrets using gitleaks 8.28.0
Comment thread gateway/handle.go Resolved
Comment thread gateway/handle.go

isUserSuppressedEvent := false
if isUserSuppressed(msg.Properties.WorkspaceID, msg.Properties.UserID, msg.Properties.SourceID) {
gw.logger.Infon("suppressed event",

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.

do we really need to log an info message every time we find a suppressed event?

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.

not sure, may be for audit purpose

Comment thread processor/processor.go
Comment on lines 2415 to 2420
reportingtypes.AssertKeysSubset(preTrans.connectionDetailsMap, preTrans.destFilterStatusDetailMap)
reportingtypes.AssertKeysSubset(preTrans.connectionDetailsMap, preTrans.botManagementStatusDetailsMap)
reportingtypes.AssertKeysSubset(preTrans.connectionDetailsMap, preTrans.eventBlockingStatusDetailsMap)
reportingtypes.AssertKeysSubset(preTrans.connectionDetailsMap, preTrans.userSuppressionStatusDetailsMap)
reportingtypes.AssertKeysSubset(preTrans.connectionDetailsMap, preTrans.dedupStatusDetailsMap)
reportingtypes.AssertKeysSubset(preTrans.connectionDetailsMap, preTrans.enricherStatusDetailsMap)

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.

Please remind me why we need to wait to reach at the pretransform stage in order to fill reportMetrics for all these stages (dest filter, bot management, even blocking, dedup, user suppression, etc.)

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.

Actually, I don't think we need to wait to reach the pre-transform stage to fill reportMetrics. I can pick up the refactoring of this in a separate PR.

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.

yes, it is weird having to carry over all these maps in the stage messages

🔒 Scanned for secrets using gitleaks 8.28.0
@mihir20
mihir20 requested a review from atzoum September 2, 2026 07:13
…03-user-suppression-counter

🔒 Scanned for secrets using gitleaks 8.28.0
@mihir20
mihir20 force-pushed the pipeline-inspector/03-user-suppression-counter branch from 891feb3 to 2ce9f18 Compare September 2, 2026 07:27
Comment thread gateway/handle.go Resolved
Comment thread processor/processor.go Resolved
🔒 Scanned for secrets using gitleaks 8.28.0
@mihir20
mihir20 requested a review from itsmihir September 4, 2026 05:54
)

# Description

Adds a new `gateway_ingested` reporting PU that counts **every** event
entering the processor's preprocess stage — including events that are
subsequently dropped (bot, blocked, suppressed, dedup, filtered). This
gives the pipeline inspector a stable "everything that came in" baseline
to reconcile all downstream drop/filter rows against: `gateway_ingested
= delivered + all drop rows + multiplexed`.

## What changed

- **New `GATEWAY_INGESTED` PU** (`utils/types/reporting_types.go`):
reported as a standalone side PU (`inPU: ""`, not part of the
terminal/initial PU chain), so the existing `gateway` billing row and PU
chains are untouched.
- **Counter emission in preprocess** (`processor/processor.go`): in
`preprocessStage`, before any drop decision is made, every event is
recorded into a new `gatewayIngestedStatusDetailsMap` as a `succeeded`
row with `StatusCode: 200`. The shared reporting event's status code is
reset to 0 right after, so the `gateway` billing row keeps its
`StatusCode: 0` as before. The map is threaded through
`preTransformationMessage` → `srcHydrationMessage` →
`pretransformStage`, where rows are flushed into `reportMetrics`
alongside the other drop-metric maps (with the usual `AssertKeysSubset`
guard).
- **Feature flag**: emission is gated behind reloadable
`Reporting.gatewayIngestedMetrics.enabled` (default **false**) and
requires reporting to be enabled. With the flag off, report metrics are
identical to before.

## Semantics

- One `gateway_ingested` row aggregates events with the same
source/name/type; rows split by event type.
- Dropped events are still counted — that's the point of the baseline.
- A bot event that is flagged but not dropped counts exactly once in
both `gateway_ingested` and `gateway`.

## Tests

- `processor/processor_test.go` — new `TestGatewayIngestedReporting`
covering flag on/off, reporting disabled, mixed batches with drops,
all-dropped batches, aggregation/splitting by event type, billing-row
`StatusCode` unaffected, and bot-flagged-but-not-dropped events.
- `integration_test/reporting_dropped_events` — consent-filter scenario
verifying per-destination visibility at the destination-filter boundary
(`destination_enter` rows per candidate destination, per-destination
`filtered_consent` rows, `filtered_no_destination` for zero-candidate
events), with `Processor.earlyDestinationFilter` both on and off.

Remaining `processor.go` hunks are formatting-only (argument wrapping
from `make fmt`).

## Security

- [x] The code changed/added as part of this pull request won't create
any security issues with how the software is being used.
🔒 Scanned for secrets using gitleaks 8.28.0
…ession-counter' into pipeline-inspector/03-user-suppression-counter

🔒 Scanned for secrets using gitleaks 8.28.0
@mihir20
mihir20 merged commit 77d3d37 into master Sep 7, 2026
76 checks passed
@mihir20
mihir20 deleted the pipeline-inspector/03-user-suppression-counter branch September 7, 2026 08:25
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>
mihir20 added a commit that referenced this pull request Sep 9, 2026
…cess stage (#7346)

## What

Pure refactor, zero behavior change. Converts the eight side-PU
status-details maps accumulated in the processor's preprocess loop
(`statusDetailsMap`, `enricherStatusDetailsMap`,
`botManagementStatusDetailsMap`, `eventBlockingStatusDetailsMap`,
`userSuppressionStatusDetailsMap`, `dedupStatusDetailsMap`,
`gatewayIngestedStatusDetailsMap`, `destFilterStatusDetailMap`) into
`PUReportedMetric` rows at the end of `preprocessStage`, via a new
`assembleSideStatusDetailMetrics` helper — instead of threading nine map
fields (the eight maps + `connectionDetailsMap`) through
`srcHydrationMessage` and `preTransformationMessage` and assembling them
only at `pretransformStage`.

- The assembly loop body, the `AssertKeysSubset` guards, and the per-key
row-emission order are relocated verbatim.
- The map fields are removed from `srcHydrationMessage` and
`preTransformationMessage`; assembled rows ride the pre-existing
`reportMetrics` field and the same `storeStage` transaction, behind the
same `isReportingEnabled()` gate.
- Row content (ConnectionDetails, PUDetails, StatusDetail, counts) is
unchanged. The only observable difference is slice ordering within
`reportMetrics` (side-PU rows now precede source-hydration failure
rows); `Report` inserts rows independently and no production code is
position-sensitive. The one consumer of insertion order was the
`srchydration` integration test, which sorted by `MIN(id)` — updated to
sort by the report key instead (insertion order across PUs was never
part of the contract; same-stage rows already depended on Go map
iteration order).

## Why

Addresses the review discussion on #7325 ("why do we need to wait to
reach the pretransform stage to fill reportMetrics for all these stages"
/ "it is weird having to carry over all these maps in the stage
messages"). The maps are complete as soon as the preprocess loop
finishes, so assembly can happen right there and the stage messages get
9 fields lighter.

## Tests

- New `TestAssembleSideStatusDetailMetrics`: table-driven map→PU pairing
check (guards against silently swapping the same-typed positional map
args), plus an all-eight-maps case asserting exactly one row per PU and
per-row `ConnectionDetails` copies.
- New `TestSrcHydrationStage` subtest: hydration-failure rows are
appended to a `reportMetrics` slice that now arrives non-empty (no
clobbering/truncation), asserted as a multiset.
- Full `go test ./processor/...` and the `srchydration` integration test
pass; the `reporting_dropped_events` integration test (which asserts
real `reports`-table rows for `gateway`, `gw_ingested`, `dedup`,
`destination_filter`) passes unchanged.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01TrZn7jT7WtkTrujuMiU6d9
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