Skip to content

refactor(processor): assemble side-PU report metrics at end of preprocess stage - #7346

Merged
mihir20 merged 3 commits into
masterfrom
pipeline-inspector/05-reportmetrics-assembly-refactor
Sep 9, 2026
Merged

mihir20 merged 3 commits into
masterfrom
pipeline-inspector/05-reportmetrics-assembly-refactor

Conversation

@mihir20

@mihir20 mihir20 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

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

…cess stage

Pure refactor, no behavior change: convert the eight side-PU status-details
maps (gateway, enricher, bot management, event blocking, user suppression,
dedup, gateway_ingested, destination_filter) into PUReportedMetric rows at the
end of preprocessStage — where the maps and connectionDetailsMap are already
complete for the batch — instead of threading nine map fields through
srcHydrationMessage and preTransformationMessage and assembling them only at
pretransformStage. The assembly loop, AssertKeysSubset guards, and per-key row
order are relocated verbatim into a new assembleSideStatusDetailMetrics
helper; rows ride the pre-existing reportMetrics field and the same storeStage
transaction. Addresses review discussion r3904965715 on PR #7325.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TrZn7jT7WtkTrujuMiU6d9

🔒 Scanned for secrets using gitleaks 8.28.0
@mihir20

mihir20 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Stack (merge bottom-up)

…tests

Drop redundant embedded-field selectors (QF1008) and the always-constant
connKey parameter of statusDetailsMapWith (unparam).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TrZn7jT7WtkTrujuMiU6d9

🔒 Scanned for secrets using gitleaks 8.28.0
The srchydration integration test ordered rows by source_id, MIN(id) —
i.e. reports-table insertion order. Side-PU rows are now assembled at the
end of preprocessStage, so for a source with a hydration failure the
gateway row is appended (and inserted) before the source_hydration row,
flipping insertion order while the row set stays identical. Insertion
order across PUs was never part of the reporting contract (same-stage
rows already depended on Go map iteration), so sort both expected and
actual rows by the report key before comparing.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TrZn7jT7WtkTrujuMiU6d9

🔒 Scanned for secrets using gitleaks 8.28.0
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.31%. Comparing base (f4dc4d9) to head (6c7c1e3).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7346      +/-   ##
==========================================
- Coverage   80.39%   80.31%   -0.09%     
==========================================
  Files         615      615              
  Lines       69132    69128       -4     
==========================================
- Hits        55576    55517      -59     
- Misses      10311    10346      +35     
- Partials     3245     3265      +20     

☔ 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 merged commit 4540876 into master Sep 9, 2026
77 checks passed
@mihir20
mihir20 deleted the pipeline-inspector/05-reportmetrics-assembly-refactor branch September 9, 2026 06:39
atzoum pushed a commit that referenced this pull request Sep 14, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0-rc.1](v1.86.0...v1.87.0-rc.1)
(2026-09-14)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
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>
This was referenced Sep 14, 2026
atzoum pushed a commit that referenced this pull request Sep 14, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0-rc.2](v1.86.0...v1.87.0-rc.2)
(2026-09-14)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
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>
This was referenced Sep 14, 2026
atzoum pushed a commit that referenced this pull request Sep 14, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0-rc.3](v1.86.0...v1.87.0-rc.3)
(2026-09-14)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **router:** request fails with unexpected use of stub RoundTripper
error ([#7386](#7386))
([2ff491f](2ff491f))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
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>
This was referenced Sep 15, 2026
atzoum pushed a commit that referenced this pull request Sep 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0-rc.4](v1.86.0...v1.87.0-rc.4)
(2026-09-15)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **batchrouter:** retry failed async manager initialization
([#7374](#7374))
([974d383](974d383))
* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **router:** request fails with unexpected use of stub RoundTripper
error ([#7386](#7386))
([2ff491f](2ff491f))
* singer-protocol sources filtered destination config for source type
cloud instead of cloudSource
([#7389](#7389))
([f48c997](f48c997))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
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>
atzoum pushed a commit that referenced this pull request Sep 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.87.0](v1.86.0...v1.87.0)
(2026-09-15)


### Features

* backend config shadow mode
([#7340](#7340))
([4898165](4898165))
* bump rudder-go-kit and go modules to Go 1.27.1
([#7345](#7345))
([8d95c68](8d95c68))
* **router:** read transformerProxy from transformer features before env
([#7337](#7337))
([e8f0ea6](e8f0ea6))


### Bug Fixes

* **batchrouter:** retry failed async manager initialization
([#7374](#7374))
([974d383](974d383))
* **router:** redact credentials from destination URLs in failure
responses
([#7372](#7372))
([14659bf](14659bf))
* **router:** request fails with unexpected use of stub RoundTripper
error ([#7386](#7386))
([2ff491f](2ff491f))
* singer-protocol sources filtered destination config for source type
cloud instead of cloudSource
([#7389](#7389))
([f48c997](f48c997))
* **warehouse:** instrument the clickhouse v2 load path
([#7355](#7355))
([4d743db](4d743db))
* **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy
engine
([#7353](#7353))
([4d743db](4d743db))
* **warehouse:** retire idle clickhouse v2 connections
([#7352](#7352))
([4d743db](4d743db))
* **warehouse:** retry a failed clickhouse v2 block
([#7354](#7354))
([4d743db](4d743db))


### Miscellaneous

* log the candidate error when a backend config shadow sample fails to
fetch ([#7383](#7383))
([eaa9b61](eaa9b61))
* **processor:** assemble side-PU report metrics at end of preprocess
stage ([#7346](#7346))
([4540876](4540876))
* sync release v1.86.0 to main branch
([#7356](#7356))
([6868c6c](6868c6c))

---
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