Skip to content

Conversation

@marksvc
Copy link
Collaborator

@marksvc marksvc commented Oct 16, 2025

Records SF request id to help find related events.

Drafting event metrics that are associated with the same NMT draft
generation request have a 'tags.draftGenerationRequestId' written to
them with an SF-specific id. This id is transferred around by
Activity.Current.Tags, by method arguments, and looked up by finding a
BuildProjectAsync event with a Serval build id.

When SMT is used, null is passed for draftGenerationRequestId method
arguments.

This change is Reviewable

@codecov
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

❌ Patch coverage is 89.41176% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.48%. Comparing base (f4314c3) to head (7b8295d).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...SIL.XForge.Scripture/Services/MachineApiService.cs 86.27% 0 Missing and 7 partials ⚠️
...XForge.Scripture/Services/MachineProjectService.cs 77.77% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3521      +/-   ##
==========================================
+ Coverage   82.47%   82.48%   +0.01%     
==========================================
  Files         615      615              
  Lines       36935    37009      +74     
  Branches     6014     6031      +17     
==========================================
+ Hits        30463    30528      +65     
  Misses       5585     5585              
- Partials      887      896       +9     

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

@marksvc marksvc changed the title drafting metrics: record SF draft generation request id to ease matching drafting metrics: record SF request id to help find related events Oct 23, 2025
@marksvc marksvc requested a review from Copilot October 23, 2025 21:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements tracking of draft generation requests across related NMT drafting events by adding a draftGenerationRequestId tag. This SF-specific identifier is generated at the start of pre-translation builds and propagated through the system using Activity.Current.Tags, method parameters, and event metric lookups.

Key Changes:

  • Added Tags field to EventMetric model to store Activity tags
  • Modified EventMetricService to collect and save tags from Activity chain (child overrides parent)
  • Updated MachineProjectService and MachineApiService to propagate draftGenerationRequestId through method signatures and Activity tags
  • For SMT builds, null is passed for draftGenerationRequestId

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
EventMetric.cs Added Tags dictionary property to store Activity metadata
event-metric.ts Added optional tags field to TypeScript interface
EventMetricService.cs Implemented Activity tag collection from parent/child chain with child override logic
EventMetricLogger.cs Created Activity instances to enable tag propagation through intercepted methods
MachineApiService.cs Generated draftGenerationRequestId for NMT builds and looked up IDs from BuildProjectAsync events
MachineProjectService.cs Added draftGenerationRequestId parameter and Activity tag setting for build methods
IMachineProjectService.cs Updated interface signature with new optional parameter
SyncService.cs Passed null for draftGenerationRequestId when triggering SMT builds
EventMetricServiceTests.cs Added tests for Activity tag collection and parent/child override behavior
MachineProjectServiceTests.cs Updated all test calls with draftGenerationRequestId: null and added Activity tag verification test
MachineApiServiceTests.cs Added mocks for GetDraftGenerationRequestIdForBuildAsync and tests for tag propagation

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

@marksvc marksvc requested a review from Copilot October 23, 2025 22:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

@marksvc marksvc requested a review from Copilot October 24, 2025 18:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

@marksvc marksvc changed the title drafting metrics: record SF request id to help find related events SF-3622 Definitively associate draft generation metrics Oct 24, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Records SF request id to help find related events.

Drafting event metrics that are associated with the same NMT draft
generation request have a 'tags.draftGenerationRequestId' written to
them with an SF-specific id. This id is transferred around by
Activity.Current.Tags, by method arguments, and looked up by finding a
BuildProjectAsync event with a Serval build id.

When SMT is used, `null` is passed for draftGenerationRequestId method
arguments.
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.

1 participant