Skip to content
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

👷‍♀️ [RUM-5590] Add telemetry for INP null target #2895

Merged
merged 9 commits into from
Jul 30, 2024

Conversation

cy-moi
Copy link
Contributor

@cy-moi cy-moi commented Jul 25, 2024

Motivation

Add telemetry for INP null target to get the impact.

Changes

Add telemetry debug

Testing

Screenshot 2024-07-26 at 09 20 45
  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@cy-moi cy-moi force-pushed the congyao/RUM-5590-add-telemetry-for-INP-null branch from 7fa099a to 2f089aa Compare July 25, 2024 14:33
@codecov-commenter
Copy link

codecov-commenter commented Jul 25, 2024

Codecov Report

Attention: Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 93.63%. Comparing base (e955594) to head (32dfdcf).
Report is 4 commits behind head on main.

Files Patch % Lines
...in/view/viewMetrics/trackInteractionToNextPaint.ts 66.66% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2895      +/-   ##
==========================================
- Coverage   93.67%   93.63%   -0.04%     
==========================================
  Files         268      268              
  Lines        7584     7592       +8     
  Branches     1686     1691       +5     
==========================================
+ Hits         7104     7109       +5     
- Misses        480      483       +3     

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

Copy link

cit-pr-commenter bot commented Jul 25, 2024

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 160.08 KiB 160.19 KiB 114 B +0.07%
Logs 56.83 KiB 56.83 KiB 0 B 0.00%
Rum Slim 108.70 KiB 108.81 KiB 114 B +0.10%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.002 0.002 0.000
addaction 0.054 0.034 -0.019
adderror 0.043 0.038 -0.006
addtiming 0.001 0.001 0.000
startview 1.161 1.165 0.004
startstopsessionreplayrecording 0.901 2.161 1.259
logmessage 0.026 0.034 0.008
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 21.65 KiB 21.47 KiB -182 B
addaction 74.93 KiB 75.00 KiB 70 B
adderror 88.80 KiB 87.11 KiB -1732 B
addtiming 18.43 KiB 18.51 KiB 77 B
startview 347.61 KiB 352.33 KiB 4.73 KiB
startstopsessionreplayrecording 14.47 KiB 13.57 KiB -924 B
logmessage 73.10 KiB 71.93 KiB -1195 B

🔗 RealWorld

@cy-moi cy-moi marked this pull request as ready for review July 26, 2024 07:21
@cy-moi cy-moi requested a review from a team as a code owner July 26, 2024 07:21
@@ -74,6 +73,10 @@ export function trackInteractionToNextPaint(
configuration.actionNameAttribute
)
} else {
addTelemetryDebug('INP target is null or not an element node', {
target: JSON.stringify(newInteraction.target), // if target is not an element node, log it to help debugging
Copy link
Collaborator

@amortemousque amortemousque Jul 26, 2024

Choose a reason for hiding this comment

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

🔨 warning: JSON.stringify(newInteraction.target) will always return {} for a DOM node. Maybe you could do it like so:

{
hasTarget: !!newInteraction.target
targetIsConnected: newInteraction.target?.isConnected,
...
}

Also don't you want to know if an element node is connected or nor?

@cy-moi cy-moi force-pushed the congyao/RUM-5590-add-telemetry-for-INP-null branch from 7cbc04b to 3d72169 Compare July 26, 2024 13:35
@cy-moi cy-moi force-pushed the congyao/RUM-5590-add-telemetry-for-INP-null branch from ce5e769 to c031764 Compare July 26, 2024 13:39
newInteraction.target,
configuration.actionNameAttribute
)
addTelemetryDebug('INP target is null or not an element node', {
Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 suggestion: ‏To reduce the number of telemetry, you could collect it only when there is no interactionToNextPaintTargetSelector.
Also collecting the telemetry on org2 could be enough. So you could use a feature flag.

Copy link
Contributor

@N-Boutaib N-Boutaib left a comment

Choose a reason for hiding this comment

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

LGTM

@N-Boutaib N-Boutaib requested a review from a team July 29, 2024 14:34
Comment on lines 80 to 97
if (inpTarget && isElementNode(inpTarget)) {
interactionToNextPaintTargetSelector = getSelectorFromElement(inpTarget, configuration.actionNameAttribute)
if (!interactionToNextPaintTargetSelector && isInpEnabled) {
addTelemetryDebug('INP target selector is null', {
targetIsConnected: inpTarget.isConnected,
inp: newInteraction.duration,
})
}
} else {
if (isInpEnabled) {
addTelemetryDebug('INP target is null or not an element node', {
hasTarget: !!inpTarget,
targetIsConnected: inpTarget ? inpTarget.isConnected : null,
inp: newInteraction.duration,
})
}

interactionToNextPaintTargetSelector = undefined
Copy link
Member

Choose a reason for hiding this comment

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

💬 suggestion: ‏to simplify a little bit:

      if (inpTarget && isElementNode(inpTarget)) {
        interactionToNextPaintTargetSelector = getSelectorFromElement(inpTarget, configuration.actionNameAttribute)
      } else {
        interactionToNextPaintTargetSelector = undefined
      }
      if (!interactionToNextPaintTargetSelector && isExperimentalFeatureEnabled(ExperimentalFeature.NULL_INP_TELEMETRY)) {
         addTelemetryDebug("Fail to get INP target selector", {
           hasTarget: !!inpTarget,
           targetIsConnected: inpTarget ? inpTarget.isConnected : undefined,
           targetIsElementNode: inpTarget ? isElementNode(inpTarget) : undefined,
           inp: newInteraction.duration
         })
      }

Also collect isElementNode so we cover the whole condition (inpTarget && isElementNode(inpTarget))

@cy-moi cy-moi merged commit 68d89a1 into main Jul 30, 2024
19 checks passed
@cy-moi cy-moi deleted the congyao/RUM-5590-add-telemetry-for-INP-null branch July 30, 2024 11:42
thomas-lebeau added a commit that referenced this pull request Jul 30, 2024
 pm_trace_id: 40455230
 feature_branch_pipeline_id: 40455230
 source: to-staging

* commit 'fa9bb6a410d74e6371b6d5de41b230878c2c2768':
  [RUM-5590] Add telemetry for INP null target (#2895)
  🧪 Update browser matrix for tests (#2884)
cy-moi added a commit that referenced this pull request Aug 29, 2024
cy-moi added a commit that referenced this pull request Aug 29, 2024
@cy-moi cy-moi changed the title [RUM-5590] Add telemetry for INP null target 👷‍♀️ [RUM-5590] Add telemetry for INP null target Oct 25, 2024
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.

6 participants