Skip to content

RUM-6171: FileOrchestrator improvements#3151

Open
kikoveiga wants to merge 1 commit intodevelopfrom
kikoveiga/RUM-6171/file-observer
Open

RUM-6171: FileOrchestrator improvements#3151
kikoveiga wants to merge 1 commit intodevelopfrom
kikoveiga/RUM-6171/file-observer

Conversation

@kikoveiga
Copy link
Contributor

@kikoveiga kikoveiga commented Jan 23, 2026

What does this PR do?

This is the follow-up on #2720, which was rolled back in #3124.

The original approach relied on FileObserver to detect file deletions asynchronously. Now, instead of relying on async file system notifications, we use synchronousonFileDeleted callbacks, and validate file existence in disk as a safeguard before returning files.

This is much better than running rootDir.listFilesSafe() everytime.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@datadog-official
Copy link

datadog-official bot commented Jan 23, 2026

🎯 Code Coverage
Patch Coverage: 86.67%
Overall Coverage: 82.29%

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 52ea5c3 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.97%. Comparing base (39d8b4a) to head (e34c0d7).
⚠️ Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
...al/persistence/file/batch/BatchFileOrchestrator.kt 93.24% 1 Missing and 4 partials ⚠️
...ence/file/advanced/ConsentAwareFileOrchestrator.kt 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3151      +/-   ##
===========================================
+ Coverage    70.96%   70.97%   +0.02%     
===========================================
  Files          912      912              
  Lines        33548    33576      +28     
  Branches      5640     5645       +5     
===========================================
+ Hits         23804    23830      +26     
+ Misses        8173     8167       -6     
- Partials      1571     1579       +8     
Files with missing lines Coverage Δ
...d/core/internal/persistence/ConsentAwareStorage.kt 94.12% <100.00%> (+0.14%) ⬆️
...sistence/file/advanced/ConsentAwareFileMigrator.kt 83.33% <100.00%> (+0.35%) ⬆️
.../persistence/file/single/SingleFileOrchestrator.kt 73.33% <ø> (ø)
...ence/file/advanced/ConsentAwareFileOrchestrator.kt 79.41% <0.00%> (-7.69%) ⬇️
...al/persistence/file/batch/BatchFileOrchestrator.kt 92.35% <93.24%> (-0.55%) ⬇️

... and 40 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kikoveiga kikoveiga changed the title RUM-6171: FileObserver improvements RUM-6171: FileOrchestrator improvements Jan 28, 2026
@kikoveiga kikoveiga force-pushed the kikoveiga/RUM-6171/file-observer branch 16 times, most recently from 9296fe8 to 3bcf9e9 Compare January 30, 2026 15:02
@kikoveiga
Copy link
Contributor Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3bcf9e9328

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kikoveiga kikoveiga force-pushed the kikoveiga/RUM-6171/file-observer branch 3 times, most recently from 0acf4c7 to 4adc9f2 Compare January 30, 2026 15:53
@kikoveiga kikoveiga self-assigned this Jan 30, 2026
@kikoveiga kikoveiga marked this pull request as ready for review February 2, 2026 10:00
@kikoveiga kikoveiga requested a review from a team as a code owner February 2, 2026 10:00
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4adc9f267e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kikoveiga kikoveiga force-pushed the kikoveiga/RUM-6171/file-observer branch from 4adc9f2 to e34c0d7 Compare February 2, 2026 10:48
val isOldFile = (it.name.toLongOrNull() ?: 0) < threshold
if (isOldFile) {
if (it.deleteSafe(internalLogger)) {
onFileDeleted(it)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we need some sort of private method that calls onFileDeleted after deleteSafe(internalLogger). This pattern is present in the code in multiple places.

private var previousFileItemCount: Long = 0
private var lastFileAccessTimestamp: Long = 0L
private var lastCleanupTimestamp: Long = 0L
private var currentBatchState = CurrentBatchState(null, 0L, 0L)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please double-check access to this currentBatchState doesn't need to be done in synchronized block?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm this class runs on a persistenceExecutorService with pool size 1.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm this class runs on a persistenceExecutorService with pool size 1.

This may change at some point though.

@kikoveiga kikoveiga force-pushed the kikoveiga/RUM-6171/file-observer branch from e34c0d7 to 52ea5c3 Compare February 3, 2026 16:35
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.

4 participants