Skip to content

✨ [RUM-10223] Add locale and timezone data to view event #3598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

mormubis
Copy link
Contributor

@mormubis mormubis commented Jun 5, 2025

Motivation

Adding locale and time_zone out of the box for all customers.

Changes

Pulling changes in the git submodule from DataDog/rum-events-format#272.

Add device fields to viewCollection.

Test instructions

  • Checkout this branch
  • Run yarn dev
  • Go to http://localhost:8080/
  • Verify that the View Page event contains the device field populated with locale, locales and time_zone

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.

@codecov-commenter
Copy link

codecov-commenter commented Jun 5, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.43%. Comparing base (a4f17b2) to head (55d0f00).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/core/src/tools/utils/timezone.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3598      +/-   ##
==========================================
- Coverage   92.44%   92.43%   -0.01%     
==========================================
  Files         322      323       +1     
  Lines        8127     8132       +5     
  Branches     1838     1838              
==========================================
+ Hits         7513     7517       +4     
- Misses        614      615       +1     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

cit-pr-commenter bot commented Jun 5, 2025

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 0 B 147.48 KiB 147.48 KiB N/A%
Rum Recorder 0 B 18.02 KiB 18.02 KiB N/A%
Rum Profiler 0 B 4.63 KiB 4.63 KiB N/A%
Logs 0 B 51.86 KiB 51.86 KiB N/A%
Flagging 0 B 935 B 935 B N/A%
Rum Slim 0 B 107.07 KiB 107.07 KiB N/A%
Worker 0 B 23.59 KiB 23.59 KiB N/A%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext N/A 0.007 0.007
addaction N/A 0.020 0.020
addtiming N/A 0.004 0.004
adderror N/A 0.019 0.019
startstopsessionreplayrecording N/A 0.001 0.001
startview N/A 0.005 0.005
logmessage N/A 0.022 0.022
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext NaN KiB 28.19 KiB NaN KiB
addaction NaN KiB 55.29 KiB NaN KiB
addtiming NaN KiB 26.23 KiB NaN KiB
adderror NaN KiB 57.78 KiB NaN KiB
startstopsessionreplayrecording NaN KiB 24.95 KiB NaN KiB
startview NaN KiB 430.47 KiB NaN KiB
logmessage NaN KiB 62.74 KiB NaN KiB

🔗 RealWorld

@mormubis mormubis changed the title adlrb/rum 10223 locale ootb ✨ [RUM-10223] Add locale and timezone data to view event Jun 5, 2025
@mormubis mormubis force-pushed the adlrb/rum-10223-locale-ootb branch 2 times, most recently from 41ef52c to c220cd0 Compare June 16, 2025 09:30
@mormubis mormubis marked this pull request as ready for review June 16, 2025 13:50
@mormubis mormubis requested a review from a team as a code owner June 16, 2025 13:50
@@ -137,6 +137,11 @@ export interface RawRumViewEvent {
start_session_replay_recording_manually: boolean
}
}
device?: {
locale?: string
locales?: string[] | readonly string[]
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: mentioning both types seems superfluous

Suggested change
locales?: string[] | readonly string[]
locales?: string[]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

navigator.languages is just readonly string[] and cannot be assigned to mutable array.

At the same time, if we want to test it out, it's fine to have a regular array ['a', 'b'] vs ['a', 'b'] as const.

What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

I see! Yeah, I think we could just keep readonly string[] then

@mormubis mormubis force-pushed the adlrb/rum-10223-locale-ootb branch from 7713b14 to 5e35369 Compare June 17, 2025 08:07
@mormubis
Copy link
Contributor Author

/to-staging

@dd-devflow
Copy link
Contributor

dd-devflow bot commented Jun 17, 2025

View all feedbacks in Devflow UI.

2025-06-17 08:09:33 UTC ℹ️ Start processing command /to-staging


2025-06-17 08:09:39 UTC ℹ️ Branch Integration: starting soon, merge expected in approximately 19m53s (p90)

Commit 5e35369be2 will soon be integrated into staging-25.


2025-06-17 08:12:13 UTC 🚨 Branch Integration: an error occurred while merging 5e35369be2 into staging-25

Gitlab pipeline didn't start on its own and we were unable to create it... Please retry.

Error: POST https://gitlab.ddbuild.io/api/v4/projects/DataDog/browser-sdk/pipeline: 400 {message: {base: [Reference not found]}} (type: ErrorResponse, retryable: true)

@mormubis
Copy link
Contributor Author

/to-staging

@dd-devflow
Copy link
Contributor

dd-devflow bot commented Jun 17, 2025

View all feedbacks in Devflow UI.

2025-06-17 08:50:32 UTC ℹ️ Start processing command /to-staging


2025-06-17 08:50:41 UTC ℹ️ Branch Integration: starting soon, merge expected in approximately 19m53s (p90)

Commit 5e35369be2 will soon be integrated into staging-25.


2025-06-17 09:10:31 UTC ℹ️ Branch Integration: This commit was successfully integrated

Commit 5e35369be2 has been merged into staging-25 in merge commit bea48bbdca.

Check out the triggered pipeline on Gitlab 🦊

If you need to revert this integration, you can use the following command: /code revert-integration -b staging-25

dd-mergequeue bot added a commit that referenced this pull request Jun 17, 2025
@@ -137,6 +137,11 @@ export interface RawRumViewEvent {
start_session_replay_recording_manually: boolean
}
}
device?: {
locale?: string
locales?: string[] | readonly string[]
Copy link
Member

Choose a reason for hiding this comment

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

I see! Yeah, I think we could just keep readonly string[] then

Copy link
Contributor

@rgaignault rgaignault left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants