Skip to content

chore: refactor processor to move archival in a preprocess stage - #6470

Merged
mihir20 merged 3 commits into
masterfrom
mihir/pipe-2486
Oct 29, 2025
Merged

mihir20 merged 3 commits into
masterfrom
mihir/pipe-2486

Conversation

@mihir20

@mihir20 mihir20 commented Oct 27, 2025 •

Copy link
Copy Markdown
Contributor

Description

Refactor the processor to move archival operation to a preprocess stage.

New Configuration Option

  • Added a new boolean configuration archiveInPreProcess that controls when archival jobs are stored
  • When enabled, archival jobs are stored during the preprocess stage rather than the pretransform stage

Modified Flow

  • Previously, both event schema jobs and archival jobs were processed in the pretransformStage
  • With the new configuration enabled, archival jobs are now processed in the preprocessStage
  • This change allows for earlier archival of events in the processing pipeline

Context Handling

  • Improved context propagation in the pretransform stage
  • Uses the proper context for error groups when archiving in pretransform stage

Error Handling

  • Maintains consistent error handling patterns throughout the archival process
  • Preserves retry logic with notification for storage operations

Testing

  • Comprehensive test coverage for both modes of operation
  • Ensures backward compatibility when the feature is disabled

Linear Ticket

pipe-2484

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 force-pushed the mihir/pipe-2486 branch 2 times, most recently from 676c543 to baa0cb0 Compare October 27, 2025 10:40
🔒 Scanned for secrets using gitleaks 8.28.0
@codecov

codecov Bot commented Oct 27, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.13208% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.32%. Comparing base (3d2026c) to head (a8a6a7c).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
processor/processor.go 81.13% 5 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6470      +/-   ##
==========================================
+ Coverage   79.23%   79.32%   +0.09%     
==========================================
  Files         529      529              
  Lines       59350    59365      +15     
==========================================
+ Hits        47026    47092      +66     
+ Misses       9507     9454      -53     
- Partials     2817     2819       +2     

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

@mihir20
mihir20 marked this pull request as ready for review October 27, 2025 12:07
@mihir20
mihir20 requested review from atzoum and ktgowtham October 27, 2025 12:08
@ktgowtham
ktgowtham requested a review from itsmihir October 28, 2025 11:04
Comment thread processor/processor.go
}

if proc.config.archiveInPreProcess {
if err := proc.storeArchiveJobs(ctx, archivalJobs); err != nil {

@atzoum atzoum Oct 29, 2025 •

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 verify whether my understanding is correct, with respect to what is and what is not getting archived:

  • We are not archiving:
    • bot events we are dropping
    • blocked events
    • duplicate events
    • events we receive from rudder-sources
    • events from transient sources
  • Archived event mutations:
    • their context is enriched (add geolocation & bot info)
    • events with at least one available destination have the following additional mutations, others still get archived but without these mutations:
      • request_ip field
      • time fields (receivedAt, originalTimestamp, sentAt, timestamp)

cc @ktgowtham for visibility

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.

yes

@itsmihir itsmihir 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.

LGTM, added some small comment

Comment thread processor/processor.go Outdated
proc.config.userTransformationMirroringFireAndForget = proc.conf.GetReloadableBoolVar(false, "Processor.userTransformationMirroring.fireAndForget")
proc.config.storeSamplerEnabled = proc.conf.GetReloadableBoolVar(false, "Processor.storeSamplerEnabled")

proc.config.archiveInPreProcess = proc.conf.GetBoolVar(false, "Processor.archiveInPreProcess")

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.

we should move this to loadConfig, loadReloadableConfig is only for Reloadable config

Comment thread processor/processor.go Outdated
if err != nil {
return fmt.Errorf("store into archival table failed with error: %v", err)
} else {
if err := proc.storeEventSchemaJobs(preTrans.subJobs.ctx, preTrans.eventSchemaJobs); err != nil {

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 are we using preTrans.subJobs.ctx and not ctx?

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.

yeah, it should be ctx as it is traced one

🔒 Scanned for secrets using gitleaks 8.28.0
@mihir20
mihir20 merged commit 8634c3f into master Oct 29, 2025
@mihir20
mihir20 deleted the mihir/pipe-2486 branch October 29, 2025 11:39
achettyiitr pushed a commit that referenced this pull request Nov 5, 2025
# Description

Refactor the processor to move archival operation to a preprocess stage.

### New Configuration Option
- Added a new boolean configuration `archiveInPreProcess` that controls
when archival jobs are stored
- When enabled, archival jobs are stored during the preprocess stage
rather than the pretransform stage

### Modified Flow
- Previously, both event schema jobs and archival jobs were processed in
the `pretransformStage`
- With the new configuration enabled, archival jobs are now processed in
the `preprocessStage`
- This change allows for earlier archival of events in the processing
pipeline

### Context Handling
- Improved context propagation in the pretransform stage
- Uses the proper context for error groups when archiving in
pretransform stage

### Error Handling
- Maintains consistent error handling patterns throughout the archival
process
- Preserves retry logic with notification for storage operations

### Testing
- Comprehensive test coverage for both modes of operation
- Ensures backward compatibility when the feature is disabled

## Linear Ticket

pipe-2484

## Security

- [ ] The code changed/added as part of this pull request won't create
any security issues with how the software is being used.
This was referenced Nov 11, 2025
itsmihir pushed a commit that referenced this pull request Nov 11, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.63.0-rc.1](v1.62.0...v1.63.0-rc.1)
(2025-11-11)


### Features

* **router:** dynamic sizing of worker job buffers
([#6463](#6463))
([5b2e519](5b2e519))


### Bug Fixes

* max procs defaults
([#6473](#6473))
([48f9cfd](48f9cfd))
* max procs defaults
([#6473](#6473))
([3d2026c](3d2026c))
* pending batch router jobs for disabled destinations are not being
aborted
([#6477](#6477))
([8effa78](8effa78))
* remove source labels in repo query stats
([#6483](#6483))
([48f9cfd](48f9cfd))
* use type field from payload to check if event is blocked
([#6487](#6487))
([5ba053f](5ba053f))


### Miscellaneous

* apply security best practices from step security
([#6462](#6462))
([a860128](a860128))
* emit filtered metrics from all non-ut stages and clean up diff metrics
([#6485](#6485))
([399c4c6](399c4c6))
* refactor processor to move archival in a preprocess stage
([#6470](#6470))
([8634c3f](8634c3f))
* remove oauth status toggling
([#6492](#6492))
([45e5dba](45e5dba))
* sync release v1.62.0 to main branch
([#6472](#6472))
([65db4ee](65db4ee))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
itsmihir pushed a commit that referenced this pull request Nov 12, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.63.0](v1.62.0...v1.63.0)
(2025-11-11)


### Features

* **router:** dynamic sizing of worker job buffers
([#6463](#6463))
([5b2e519](5b2e519))


### Bug Fixes

* max procs defaults
([#6473](#6473))
([48f9cfd](48f9cfd))
* max procs defaults
([#6473](#6473))
([3d2026c](3d2026c))
* pending batch router jobs for disabled destinations are not being
aborted
([#6477](#6477))
([8effa78](8effa78))
* remove source labels in repo query stats
([#6483](#6483))
([48f9cfd](48f9cfd))
* use type field from payload to check if event is blocked
([#6487](#6487))
([5ba053f](5ba053f))


### Miscellaneous

* apply security best practices from step security
([#6462](#6462))
([a860128](a860128))
* emit filtered metrics from all non-ut stages and clean up diff metrics
([#6485](#6485))
([399c4c6](399c4c6))
* refactor processor to move archival in a preprocess stage
([#6470](#6470))
([8634c3f](8634c3f))
* remove oauth status toggling
([#6492](#6492))
([45e5dba](45e5dba))
* sync release v1.62.0 to main branch
([#6472](#6472))
([65db4ee](65db4ee))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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