Repository navigation
fix: classify reverse-ETL sources from config for MAR metering - #7159
Conversation
5830a2c to
a4b51d9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/1.80.x #7159 +/- ##
==================================================
- Coverage 79.73% 79.66% -0.07%
==================================================
Files 595 595
Lines 66095 66096 +1
==================================================
- Hits 52700 52655 -45
- Misses 10278 10328 +50
+ Partials 3117 3113 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes incorrect source_category stamping for jobs created via the gateway’s /internal/v1/batch handler by deriving it from backend source config (SourceDefinition.Category) instead of stream.MessageProperties.SourceType (which is empty for reverse-ETL/source-record messages on the internal-batch path). This ensures downstream MAR metering logic can correctly classify warehouse records.
Changes:
- Update internal-batch job parameter stamping to use the resolved source config category (
SourceDefinition.Category) forsource_category. - Add a focused unit test covering warehouse, event-stream, config-precedence, and unknown-source scenarios for
source_category.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| gateway/handle.go | Stamps source_category from backend source config category instead of msg.Properties.SourceType. |
| gateway/handle_test.go | Adds regression test validating source_category derivation behavior for internal-batch extraction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… the source_category param MAR metering gated on the job's source_category param, which is empty on the clustered /internal/v1/batch ingestion path, so every reverse-ETL record was silently skipped. Classify reverse-ETL (warehouse) sources from the source's SourceDefinition.Category instead: the processor snapshots a source_id -> category map once per batch and passes a lookup into GenerateReportsFromJobs. Path-independent and fail-closed (unknown source resolves to "" and is skipped). 🔒 Scanned for secrets using gitleaks 8.28.0
Classify from the source config lookup: warehouse source is metered with an empty source_category param, a non-warehouse source is skipped, a spoofed source_category=warehouse param does not win over config, and an unknown source is skipped fail-closed. 🔒 Scanned for secrets using gitleaks 8.28.0
a4b51d9 to
bccb7f3
Compare
… subscriber getSourceCategoriesBySourceID rebuilt a source_id -> category map on every batch. Build it once when the backend config changes (alongside sourceIdSourceMap/nonEventStreamSources) and return the shared reference, matching getNonEventStreamSources. Eliminates per-batch allocation on the processor hot path; still batch-consistent (the subscriber replaces the whole map on config change). 🔒 Scanned for secrets using gitleaks 8.28.0
8a6bba6 to
50d76c8
Compare
Drop the func(sourceID string) string wrapper around the source_id -> category map: GenerateReportsFromJobs now takes the map[string]string directly and indexes it, matching the sibling tracked-users reporter (which takes its source filter map directly). The processor fetches the map once via getSourceCategoriesBySourceID() before the reporter's loop and passes it directly, so the per-batch closure is gone. A nil/missing source_id still reads as "" and is skipped fail-closed, so behavior is unchanged. 🔒 Scanned for secrets using gitleaks 8.28.0
🤖 I have created a release *beep* *boop* --- ## [1.80.1](v1.80.0...v1.80.1) (2026-07-08) ### Bug Fixes * classify reverse-ETL sources from config for MAR metering ([#7159](#7159)) ([8e026e3](8e026e3)) --- 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>
# Description Syncing patch release v1.80.1 to main branch **↓↓ Please review and edit commit overrides before merging ↓↓** BEGIN_COMMIT_OVERRIDE fix: classify reverse-ETL sources from config for MAR metering (#7159) END_COMMIT_OVERRIDE --------- Co-authored-by: Alexandros Milaios <[email protected]> Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [1.81.0-rc.1](v1.80.0...v1.81.0-rc.1) (2026-07-20) ### Features * run python transformation tests on ephemeral per-request pyt deployments ([#7177](#7177)) ([1008ae7](1008ae7)) * support partition migration job fanout per jobsdb ([#7141](#7141)) ([be42e48](be42e48)) ### Bug Fixes * abort snowpipe events on channel bad request ([#7118](#7118)) ([6c08584](6c08584)) * avoid redundant transformer statTags unmarshalling ([#7182](#7182)) ([c3c283c](c3c283c)) * classify reverse-ETL sources from config for MAR metering ([#7159](#7159)) ([fa7870f](fa7870f)) * detect server-side snowpipe channel failures via per-channel status at stuck threshold ([#7166](#7166)) ([581410c](581410c)) * kafkamanager compilation error ([#7189](#7189)) ([1fb7f6e](1fb7f6e)) * **kafka:** support insecure TLS skip verify config ([#7022](#7022)) ([d01574f](d01574f)) * preserve order when overflowing snowpipe insert batches ([#7178](#7178)) ([9c01fa0](9c01fa0)) * quote postgres warehouse ddl identifiers ([#7127](#7127)) ([5aeb481](5aeb481)) * **router:** emit invalid payload metric ([#7168](#7168)) ([6e2009a](6e2009a)) * update null to #N/A for salesforce bulk upload ([#7151](#7151)) ([1dffd93](1dffd93)) * **warehouse:** use pod identity for rudder-storage flow; keep S3-copy user fallback for user S3 destinations ([#7167](#7167)) ([3f9aa32](3f9aa32)) ### Miscellaneous * add contract tests for test endpoints in pytransformer ([#7147](#7147)) ([3b210ec](3b210ec)) * bump compose-test to v0.1.5 to remediate pgx CVE-2026-33815 ([#7162](#7162)) ([7672f96](7672f96)) * **deps:** bump actions/checkout from 6.0.3 to 7.0.0 ([#7132](#7132)) ([d453c93](d453c93)) * **deps:** bump actions/setup-go from 6.4.0 to 6.5.0 ([#7150](#7150)) ([75d9648](75d9648)) * **deps:** bump aws-actions/amazon-ecr-login from 2.1.5 to 2.1.6 ([#7109](#7109)) ([7b2a859](7b2a859)) * **deps:** bump aws-actions/configure-aws-credentials from 6.2.0 to 6.2.2 ([#7152](#7152)) ([c984268](c984268)) * **deps:** bump golangci/golangci-lint-action from 9.2.1 to 9.3.0 ([#7170](#7170)) ([4565d25](4565d25)) * **deps:** bump the frequent group across 1 directory with 4 updates ([#6891](#6891)) ([88a0ddf](88a0ddf)) * support compression in bqstream destinations ([#7142](#7142)) ([0694f12](0694f12)) --- 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>
🤖 I have created a release *beep* *boop* --- ## [1.81.0](v1.80.0...v1.81.0) (2026-07-20) ### Features * run python transformation tests on ephemeral per-request pyt deployments ([#7177](#7177)) ([1008ae7](1008ae7)) * support partition migration job fanout per jobsdb ([#7141](#7141)) ([be42e48](be42e48)) ### Bug Fixes * abort snowpipe events on channel bad request ([#7118](#7118)) ([6c08584](6c08584)) * avoid redundant transformer statTags unmarshalling ([#7182](#7182)) ([c3c283c](c3c283c)) * classify reverse-ETL sources from config for MAR metering ([#7159](#7159)) ([fa7870f](fa7870f)) * detect server-side snowpipe channel failures via per-channel status at stuck threshold ([#7166](#7166)) ([581410c](581410c)) * kafkamanager compilation error ([#7189](#7189)) ([1fb7f6e](1fb7f6e)) * **kafka:** support insecure TLS skip verify config ([#7022](#7022)) ([d01574f](d01574f)) * preserve order when overflowing snowpipe insert batches ([#7178](#7178)) ([9c01fa0](9c01fa0)) * quote postgres warehouse ddl identifiers ([#7127](#7127)) ([5aeb481](5aeb481)) * **router:** emit invalid payload metric ([#7168](#7168)) ([6e2009a](6e2009a)) * update null to #N/A for salesforce bulk upload ([#7151](#7151)) ([1dffd93](1dffd93)) * **warehouse:** use pod identity for rudder-storage flow; keep S3-copy user fallback for user S3 destinations ([#7167](#7167)) ([3f9aa32](3f9aa32)) ### Miscellaneous * add contract tests for test endpoints in pytransformer ([#7147](#7147)) ([3b210ec](3b210ec)) * bump compose-test to v0.1.5 to remediate pgx CVE-2026-33815 ([#7162](#7162)) ([7672f96](7672f96)) * **deps:** bump actions/checkout from 6.0.3 to 7.0.0 ([#7132](#7132)) ([d453c93](d453c93)) * **deps:** bump actions/setup-go from 6.4.0 to 6.5.0 ([#7150](#7150)) ([75d9648](75d9648)) * **deps:** bump aws-actions/amazon-ecr-login from 2.1.5 to 2.1.6 ([#7109](#7109)) ([7b2a859](7b2a859)) * **deps:** bump aws-actions/configure-aws-credentials from 6.2.0 to 6.2.2 ([#7152](#7152)) ([c984268](c984268)) * **deps:** bump golangci/golangci-lint-action from 9.2.1 to 9.3.0 ([#7170](#7170)) ([4565d25](4565d25)) * **deps:** bump the frequent group across 1 directory with 4 updates ([#6891](#6891)) ([88a0ddf](88a0ddf)) * support compression in bqstream destinations ([#7142](#7142)) ([0694f12](0694f12)) --- 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>
What & why
MAR (Monthly Active Records) metering for reverse-ETL / Audiences sources produced no data in clustered/production deployments:
activation_records_reportsstayed empty and the MAR API returned[].The reporter gated reverse-ETL classification on the job's
source_categoryparam. That param is populated on the gateway web/auth path, but is empty on the clustered/internal/v1/batchingestion path (rudder-sources → ingestion-svc → Pulsar → srcrouter → gateway). So every reverse-ETL record was silently skipped — no rows, no skip stats.Change
Classify reverse-ETL (warehouse) sources from the source config (
SourceDefinition.Category) instead of the job param:processorsnapshots asource_id → categorymap once per batch (single lock, category strings only) and passes a lookupfunc(sourceID string) stringinto the reporter.records_reporter.GenerateReportsFromJobsgates on that lookup (== "warehouse"), still reading the fingerprint from the raw pre-strip job.Path-independent (works for
/internal/v1/batch,/internal/v1/retl, single-node/mini) and fail-closed: an unknown/missingsource_idresolves to""and is skipped; a spoofedsource_categoryparam can't force metering.This supersedes an earlier gateway-side approach (stamping
source_categoryin the internal-batch handler). Classifying at the consumer keeps the change contained to the MAR feature and independent of ingestion topology, and mirrors the sibling tracked-users reporter, which already takes a source-config lookup.Tests
records_reporter_test.go: warehouse source metered with an emptysource_categoryparam; non-warehouse source skipped; a spoofedsource_category=warehouseparam does not win over config; unknown source skipped fail-closed.Validation
Verified end-to-end in dev (
profiles-qa): reverse-ETL sync → rows inactivation_records_reports→ flushed to the reporting store → MAR API returns per-connection counts (was[]).Linear: PRO-5810