Skip to content

chore: avoid marshalling proc error job payloads - #6872

Merged
atzoum merged 1 commit into
masterfrom
chore.noProcErrorMarshal
Apr 21, 2026
Merged

atzoum merged 1 commit into
masterfrom
chore.noProcErrorMarshal

Conversation

@atzoum

@atzoum atzoum commented Apr 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

Eliminate an expensive jsonrs.Marshal on the processor hot path by carrying the original parsed events alongside proc error jobs instead of serializing them into EventPayload.

image

Problem

When building proc error jobs for failed/filtered transformer responses, the processor was:

  1. Unmarshalling the original job payload into []SingularEventT ([]map[string]any)
  2. Re-marshalling the slice back to JSON for EventPayload — expensive due to reflection on map[string]any
  3. The only consumer (recordEventDeliveryStatus, the live debugger) would immediately unmarshal it back, then re-marshal each individual event

Solution

Introduce a procErrorJob wrapper that carries the original []SingularEventT alongside the *jobsdb.JobT:

  • getTransformationMetrics: no longer marshals events into EventPayload
  • recordEventDeliveryStatus: reads .events directly, extracts event name/type via map lookup instead of marshal + gjson
  • droppedJobs (saveDroppedJobs/rsources): only reads Parameters, JobID, UUID — never touched EventPayload, so nil is fine

The only remaining per-event marshal is inside recordEventDeliveryStatus for the DeliveryStatusT.Payload field, but that only runs when the live debugger is active (rare).

Security

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

@atzoum
atzoum force-pushed the chore.noProcErrorMarshal branch from 33a420f to 41b1bce Compare April 11, 2026 16:42
@codecov

codecov Bot commented Apr 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.84211% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.77%. Comparing base (0530c8c) to head (c634566).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
processor/processor.go 86.48% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6872      +/-   ##
==========================================
+ Coverage   79.62%   79.77%   +0.15%     
==========================================
  Files         565      565              
  Lines       63317    63312       -5     
==========================================
+ Hits        50417    50510      +93     
+ Misses       9909     9815      -94     
+ Partials     2991     2987       -4     

☔ View full report in Codecov by Sentry.
📢 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.

@atzoum
atzoum force-pushed the chore.noProcErrorMarshal branch from 41b1bce to c94e5f3 Compare April 20, 2026 06:15
@atzoum
atzoum marked this pull request as ready for review April 20, 2026 06:15
Comment thread processor/processor.go
// procErrorJob wraps a jobsdb.JobT with the original parsed events,
// avoiding an expensive marshal/unmarshal round-trip through EventPayload.
type procErrorJob struct {
*jobsdb.JobT

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.

Should we also add a comment mentioning jobT will not hold eventPayload

🔒 Scanned for secrets using gitleaks 8.30.1
@atzoum
atzoum enabled auto-merge (squash) April 21, 2026 10:08
@atzoum
atzoum force-pushed the chore.noProcErrorMarshal branch from c94e5f3 to c634566 Compare April 21, 2026 10:08
@atzoum
atzoum disabled auto-merge April 21, 2026 12:09
@atzoum
atzoum merged commit 145826b into master Apr 21, 2026
56 checks passed
@atzoum
atzoum deleted the chore.noProcErrorMarshal branch April 21, 2026 12:10
mihir20 pushed a commit that referenced this pull request Apr 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.74.0-rc.1](v1.73.0...v1.74.0-rc.1)
(2026-04-27)


### Features

* add configurable batch size for bulk inserting failed rsources records
([#6873](#6873))
([d8f6ea0](d8f6ea0))
* add native deletion support for identity removal in gzip files
([#6896](#6896))
([c1e27d0](c1e27d0))
* deep job pickups when no results cache is cold
([#6850](#6850))
([03e9d88](03e9d88))
* **jobsdb:** improve migration compaction
([#6844](#6844))
([b7f2b9f](b7f2b9f))


### Bug Fixes

* add correct host for salesforceBU destination
([#6906](#6906))
([2430cb4](2430cb4))
* batch router drained events metrics
([#6898](#6898))
([c5b2927](c5b2927))
* build action failing
([#6899](#6899))
([691a812](691a812))
* snowpipe struck scenarios
([#6895](#6895))
([35b07a8](35b07a8))
* use tid instead of vid
([#6908](#6908))
([954dcf7](954dcf7))


### Miscellaneous

* avoid marshalling proc error job payloads
([#6872](#6872))
([145826b](145826b))
* bump build-scan-push-action from v2.1.0 to v2.2.0
([#6903](#6903))
([e917f9b](e917f9b))
* contract tests for dns regressions and overrides
([#6864](#6864))
([b105678](b105678))
* pin and bump action refs (SEC-171)
([#6863](#6863))
([8089953](8089953))
* pytransformer pooling contract tests
([#6883](#6883))
([0530c8c](0530c8c))
* scope workflow permissions to least privilege (SEC-167)
([#6911](#6911))
([5600dbe](5600dbe))
* update Slack notification method in scheduled release workflow
([#6879](#6879))
([3b67dcb](3b67dcb))
* **vuln:** zizmor --fix=all findings (SEC-199)
([#6905](#6905))
([d8cc34f](d8cc34f))

---
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 Apr 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.74.0](v1.73.0...v1.74.0)
(2026-04-27)


### Features

* add configurable batch size for bulk inserting failed rsources records
([#6873](#6873))
([d8f6ea0](d8f6ea0))
* add native deletion support for identity removal in gzip files
([#6896](#6896))
([c1e27d0](c1e27d0))
* deep job pickups when no results cache is cold
([#6850](#6850))
([03e9d88](03e9d88))
* **jobsdb:** improve migration compaction
([#6844](#6844))
([b7f2b9f](b7f2b9f))


### Bug Fixes

* add correct host for salesforceBU destination
([#6906](#6906))
([2430cb4](2430cb4))
* batch router drained events metrics
([#6898](#6898))
([c5b2927](c5b2927))
* build action failing
([#6899](#6899))
([691a812](691a812))
* snowpipe struck scenarios
([#6895](#6895))
([35b07a8](35b07a8))
* use tid instead of vid
([#6908](#6908))
([954dcf7](954dcf7))


### Miscellaneous

* avoid marshalling proc error job payloads
([#6872](#6872))
([145826b](145826b))
* bump build-scan-push-action from v2.1.0 to v2.2.0
([#6903](#6903))
([e917f9b](e917f9b))
* contract tests for dns regressions and overrides
([#6864](#6864))
([b105678](b105678))
* pin and bump action refs (SEC-171)
([#6863](#6863))
([8089953](8089953))
* pytransformer pooling contract tests
([#6883](#6883))
([0530c8c](0530c8c))
* scope workflow permissions to least privilege (SEC-167)
([#6911](#6911))
([5600dbe](5600dbe))
* update Slack notification method in scheduled release workflow
([#6879](#6879))
([3b67dcb](3b67dcb))
* **vuln:** zizmor --fix=all findings (SEC-199)
([#6905](#6905))
([d8cc34f](d8cc34f))

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