Skip to content

rts: add activity logging to give context for resource usage reports - #4061

Open
marksvc wants to merge 2 commits into
task/rts-connectfrom
task/rts-logging
Open

rts: add activity logging to give context for resource usage reports#4061
marksvc wants to merge 2 commits into
task/rts-connectfrom
task/rts-logging

Conversation

@marksvc

@marksvc marksvc commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Open in Devin Review


This change is Reviewable

@marksvc
marksvc marked this pull request as draft August 19, 2026 22:44
@marksvc
marksvc changed the base branch from master to task/rts-connect August 19, 2026 22:46
@marksvc marksvc changed the title rts: clarify connect method rts: add activity logging to give context for resource usage reports Aug 19, 2026
@marksvc

marksvc commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator Author

This branch has task/rts-connect as the merge target, as it is built no that branch. That branch will need to be merged before this PR can be.

@marksvc
marksvc deployed to screenshot_diff August 19, 2026 22:51 — with GitHub Actions Active
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.00000% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.11%. Comparing base (f6c872f) to head (2dff5e5).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/RealtimeServer/common/realtime-server.ts 85.71% 7 Missing ⚠️
src/RealtimeServer/common/activity-logger.ts 92.42% 5 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                  @@
##           task/rts-connect    #4061      +/-   ##
====================================================
+ Coverage             81.10%   81.11%   +0.01%     
====================================================
  Files                   661      664       +3     
  Lines                 43061    43192     +131     
  Branches               7054     7094      +40     
====================================================
+ Hits                  34925    35036     +111     
- Misses                 6963     6984      +21     
+ Partials               1173     1172       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

No screenshot differences — all stories are identical.

View the diff page at: https://pr-4061--sf-screenshot-diffs.netlify.app

@marksvc

marksvc commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator Author

src/RealtimeServer/common/index.ts line 343 at r1 (raw file):

    }
    const conn = connections.get(handle);
    conn?.fetchSnapshotByTimestamp(collection, id, timestamp, (err, snapshot) => {

Devin posted a concern about this. The main problem is pre-existing, and I am drafting a fix for it to go into a separate PR. (null conn never calls callback)

@marksvc

marksvc commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator Author

src/RealtimeServer/common/realtime-server.ts line 428 at r1 (raw file):

        opsCount = 0;
      }
      ActivityLogger.instance.log('opSubmitted', {

Devin has expressed some concern about incompleteness of the logging, such as if an op submission is later rejected for permission reasons. In practice, the activity logger needs to show where the heavy or frequent activity is happening, rather than infrequent or special situations.

There may be some logging that is missing that would be relevant for identifying heavy activity. So that's something to keep an eye out for.

@marksvc

marksvc commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator Author

src/RealtimeServer/common/activity-logger.ts line 19 at r1 (raw file):

}

const DEFAULT_LOG_LEVEL: RtsLogLevel = 'none';

Devin mentions that there is no log bound or rotation. I had a look at this and it looks like it shouldn't be too challenging to set up if we need it. We can do it at the system level; it looks like the application doesn't need additional changes to make that possible.

@marksvc

marksvc commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator Author

src/RealtimeServer/common/activity-logger.ts line 112 at r1 (raw file):

          .map(batchEntry => JSON.stringify(batchEntry) + '\n')
          .join('');
        await appendFile(this.logPath, lines, { flag: 'a' });

Devin is concerned about multiple processes writing to the log at the same time. We only run one RealtimeServer at a time.

@marksvc marksvc added testing not required e2e Run e2e tests for this pull request labels Aug 20, 2026
@marksvc
marksvc marked this pull request as ready for review August 20, 2026 16:17
@marksvc
marksvc deployed to screenshot_diff August 20, 2026 16:22 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e Run e2e tests for this pull request testing not required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant