Skip to content

chore: Adapt RUM model generation to new Vital schema structure#2548

Merged
ncreated merged 5 commits into
developfrom
ncreated/chore/update-rum-schema-after-segregation
Oct 28, 2025
Merged

chore: Adapt RUM model generation to new Vital schema structure#2548
ncreated merged 5 commits into
developfrom
ncreated/chore/update-rum-schema-after-segregation

Conversation

@ncreated

@ncreated ncreated commented Oct 28, 2025

Copy link
Copy Markdown
Member

What and why?

📦 This PR updates RUM model generation following the schema changes introduced in rum-events-format#315, where:

  • The RUMVitalEvent schema was split into three distinct events:
    • RUMVitalAppLaunchEvent
    • RUMVitalDurationEvent
    • RUMVitalOperationStepEvent
  • RUMTransitionEvent was removed from the mobile schema.
  • Both RUM and Session Replay schemas were deeply restructured — model definitions remain conceptually the same, but their structure and syntax have changed significantly.

💡 The change to the RUM Vital event model impacted the Features Operations code, which required updates to align with the new model. Please pay special attention to this part during the review.

How

Because the new schema lists elements in a different order, regenerating models resulted in an extremely noisy diff. To avoid this problems in the future, the rum-models-generator now enforces alphabetical order of models in the file. This partially matches the previous order, reducing the size of diff.

Even with this mitigation, the diff remains large — GitHub struggles to compute minimal changes for large generated files and overstates the extent of the modifications.

To make the review easier:

  • 618ea09 contains only deletions of RUMVitalEvent and RUMTransitionEvent (done manually). GitHub’s diff view is messy here — I removed consecutive model definitions, but it renders them as scattered changes.
  • 7ef816a adds the new event definitions.

Actual diff summary (consecutive lines changed):

  • Previous version:
    • Swift: 10,900 LOC
    • Objective-C: 11,000 LOC
  • This PR:
    • Swift: −1,450 LOC / +1,900 LOC
    • Objective-C: −2,000 LOC / +2,900 LOC

I explored a few ways to improve diff readability (custom diff drivers in .gitattributes, alternative algorithms), but they only work locally. Marking files as linguist-generated would hide them on GitHub, which isn’t ideal since generated code still needs review.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes
  • Add Objective-C interface for public APIs (see our guidelines (internal) and run make api-surface)

@datadog-official

datadog-official Bot commented Oct 28, 2025

Copy link
Copy Markdown

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6633fc4 | Docs | Was this helpful? Give us feedback!

@ncreated
ncreated marked this pull request as ready for review October 28, 2025 09:01
@ncreated
ncreated requested review from a team as code owners October 28, 2025 09:01

@maxep maxep left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great! I wonder if the priority ordering is necessary.. I personally don't mind large diff in generated code and the alphabetical ordering is easier to navigate IMO.

@ncreated

Copy link
Copy Markdown
Member Author

Looks great! I wonder if the priority ordering is necessary.. I personally don't mind large diff in generated code and the alphabetical ordering is easier to navigate IMO.

It’s doable 👍 no problem, but it would mean merging a single, very large PR to apply this change.

simaoseica-dd
simaoseica-dd previously approved these changes Oct 28, 2025

@simaoseica-dd simaoseica-dd 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.

Great work on these two schema PRs! 🎖️
Regarding the priority, it’s subjective. The DataModels are bulky auto-generated files, so using Cmd+F is usually the most helpful approach.

@ncreated
ncreated force-pushed the ncreated/chore/update-rum-schema-after-segregation branch from 6cd4e9d to d500e47 Compare October 28, 2025 11:38
@ncreated

Copy link
Copy Markdown
Member Author

@maxep @simaoseica-dd 👌 I removed priority list. Now models are simply sorted alphabetically - this way we will avoid running into same problem in the future.

maxep
maxep previously approved these changes Oct 28, 2025

@maxep maxep left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great! thank you

simaoseica-dd
simaoseica-dd previously approved these changes Oct 28, 2025
mariedm
mariedm previously approved these changes Oct 28, 2025

@mariedm mariedm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a small renaming to avoid confusing if you don't mind, otherwise LGMT!

Comment thread TestUtilities/Sources/Matchers/RUMSessionMatcher.swift
Comment thread TestUtilities/Sources/Matchers/RUMSessionMatcher.swift Outdated
Comment thread TestUtilities/Sources/Matchers/RUMSessionMatcher.swift Outdated
Comment thread TestUtilities/Sources/Matchers/RUMSessionMatcher.swift Outdated
Comment thread TestUtilities/Sources/Matchers/RUMSessionMatcher.swift Outdated
@mariedm

mariedm commented Oct 28, 2025

Copy link
Copy Markdown
Member

Just a small renaming to avoid confusing if you don't mind

Since I need to update the RUM schema to make the view ID optional for operation steps, I can take care of it when updating the RUM models on iOS too. 👍

gonzalezreal
gonzalezreal previously approved these changes Oct 28, 2025

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

🚀

@ncreated
ncreated merged commit cba2870 into develop Oct 28, 2025
19 checks passed
@ncreated
ncreated deleted the ncreated/chore/update-rum-schema-after-segregation branch October 28, 2025 15:02
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.

5 participants