Skip to content

chore: Page load instrumentation: add network and device info to page load spans#36395

Merged
dvj1988 merged 5 commits intoreleasefrom
chore/improve-page-load-timing-sdk
Sep 19, 2024
Merged

chore: Page load instrumentation: add network and device info to page load spans#36395
dvj1988 merged 5 commits intoreleasefrom
chore/improve-page-load-timing-sdk

Conversation

@dvj1988
Copy link

@dvj1988 dvj1988 commented Sep 18, 2024

Description

  • Remove page visibility change listener in Page load instrumentation. The page visibility data is not working as expected.
  • Add otlpSessionId and appMode attributes to all PageView and PageViewTimings data pushed by the new relic browser agent. This will help us infer session based information and join reports with Page load Spans
  • Add network and device specific attributes to the PAGE_LOAD span

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10934682384
Commit: de17259
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Thu, 19 Sep 2024 05:22:19 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Enhanced telemetry data collection during page load events, capturing device memory and network attributes.
    • Introduced functionality to gather operating system details (name and version) for improved telemetry insights.
    • Improved integration with New Relic for detailed monitoring through custom attributes.
  • Bug Fixes

    • Removed outdated logic for tracking page visibility, focusing on more relevant metrics.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 18, 2024

Walkthrough

The changes enhance telemetry data collection in the application by introducing new attributes related to device memory and network conditions. A new type, TNavigator, is defined, and methods for adding device and connection attributes are implemented. Additionally, the telemetry attributes are expanded to include operating system details. The modifications streamline the telemetry process, focusing on richer data collection while removing previous visibility tracking features.

Changes

Files Change Summary
app/client/src/UITelemetry/PageLoadInstrumentation.ts Introduced TNavigator type, modified enable method to include new private methods for device and connection attributes, removed visibility tracking logic.
app/client/src/UITelemetry/generateTraces.ts Updated imports for osName and osVersion, modified getCommonTelemetryAttributes to be exported for broader access to telemetry attributes.
app/client/src/index.tsx Added import for getCommonTelemetryAttributes, modified New Relic agent instantiation to include custom attributes for enhanced telemetry data.

Suggested labels

skip-changelog, Stale, ok-to-test

Suggested reviewers

  • telemetry_expert
  • network_engineer
  • frontend_developer

Poem

In the realm of data, we soar and glide,
With attributes new, we take great pride.
From devices to networks, insights we glean,
Telemetry enhanced, a monitoring dream!
So here's to the changes, both bold and bright,
Capturing context, our future's in sight! 📊✨


Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8b986f7 and de17259.

Files selected for processing (2)
  • app/client/src/UITelemetry/PageLoadInstrumentation.ts (3 hunks)
  • app/client/src/UITelemetry/generateTraces.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/src/UITelemetry/generateTraces.ts
Additional comments not posted (5)
app/client/src/UITelemetry/PageLoadInstrumentation.ts (5)

12-20: Excellent work introducing the TNavigator type!

The new TNavigator type is a great addition to the codebase. It extends the existing Navigator interface and includes properties for device memory and detailed network connection attributes. This will allow for more comprehensive data collection about the user's environment.


53-57: Fantastic job adding device and connection attributes to the root span!

The updates to the enable method to include calls to the new addConnectionAttributes and addDeviceAttributes methods are spot on. These methods set critical metrics such as device memory, hardware concurrency, effective connection type, downlink speed, round-trip time (RTT), and data saving status on the rootSpan. This shift in focus from monitoring visibility to emphasizing device and connection metrics is a strategic improvement.


74-79: Splendid implementation of the addDeviceAttributes method!

The addDeviceAttributes method is implemented perfectly. It sets the deviceMemory and hardwareConcurrency attributes on the rootSpan using the TNavigator type. This captures critical device metrics during page load events.


81-94: Marvelous work on the addConnectionAttributes method!

The addConnectionAttributes method is a brilliant addition. It checks if the connection property exists on the navigator object and sets the effectiveConnectionType, connectionDownlink, connectionRtt, and connectionSaveData attributes on the rootSpan. This provides valuable insights into the user's network conditions during page load events.


Line range hint 1-11: Skipping review of unchanged code segments.

The code in these line ranges appears to be unchanged. As an effective code reviewer, I will focus my attention on the modified or added lines to provide targeted feedback.

Also applies to: 23-52, 58-73, 96-364


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@dvj1988 dvj1988 marked this pull request as ready for review September 18, 2024 10:39
@dvj1988 dvj1988 self-assigned this Sep 18, 2024
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Sep 18, 2024
@dvj1988 dvj1988 added the ok-to-test Required label for CI label Sep 18, 2024
@dvj1988 dvj1988 requested a review from vsvamsi1 September 18, 2024 11:06
Copy link
Member

@subhrashisdas subhrashisdas left a comment

Choose a reason for hiding this comment

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

LGTM

vsvamsi1
vsvamsi1 previously approved these changes Sep 19, 2024
@dvj1988 dvj1988 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Sep 19, 2024
@dvj1988 dvj1988 enabled auto-merge (squash) September 19, 2024 05:27
@dvj1988 dvj1988 merged commit c2521fa into release Sep 19, 2024
@dvj1988 dvj1988 deleted the chore/improve-page-load-timing-sdk branch September 19, 2024 05:36
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Sep 26, 2024
… load spans (appsmithorg#36395)

## Description
- Remove page visibility change listener in Page load instrumentation.
The page visibility data is not working as expected.
- Add `otlpSessionId` and `appMode` attributes to all PageView and
PageViewTimings data pushed by the new relic browser agent. This will
help us infer session based information and join reports with Page load
Spans
- Add network and device specific attributes to the `PAGE_LOAD` span


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.Sanity"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10934682384>
> Commit: de17259
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10934682384&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Thu, 19 Sep 2024 05:22:19 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced telemetry data collection during page load events, capturing
device memory and network attributes.
- Introduced functionality to gather operating system details (name and
version) for improved telemetry insights.
- Improved integration with New Relic for detailed monitoring through
custom attributes.

- **Bug Fixes**
- Removed outdated logic for tracking page visibility, focusing on more
relevant metrics.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@coderabbitai coderabbitai bot mentioned this pull request Oct 11, 2024
2 tasks
@coderabbitai coderabbitai bot mentioned this pull request Dec 24, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants