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

📈 App Router - added app insights telemetry for app components #3151

Merged
merged 25 commits into from
Sep 25, 2024

Conversation

Calinator444
Copy link
Member

@Calinator444 Calinator444 commented Sep 23, 2024

Description

This PR adds app insights telemetry to all existing App Router pages. Because the code has been added to layout.tsx the telemetry should be sent from all future pages to use app routing as well.

@Calinator444 Calinator444 changed the title 📈 Added app insights telemetry for app components 📈 App Router - added app insights telemetry for app components Sep 23, 2024
Copy link
Contributor

github-actions bot commented Sep 23, 2024

Coverage report

St.
Category Percentage Covered / Total
🔴 Statements 0.22% 69/31231
🔴 Branches 7.55% 24/318
🔴 Functions 1.01% 3/297
🔴 Lines 0.22% 69/31231

Test suite run success

13 tests passing in 1 suite.

Report generated by 🧪jest coverage report action from e0e3e58

Copy link
Contributor

Deployed changes to https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

Copy link
Contributor

PageSpeed Insights

Category Score
Accessibility 95
Best practices 96
Performance 65
SEO 69

View the full report https://pagespeed.web.dev/report?url=https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

@Calinator444
Copy link
Member Author

Calinator444 commented Sep 23, 2024

No longer relevant - I've made changes following these tests

I have the requests being logged to app insights in staging

image

Copy link
Contributor

Deployed changes to https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

Copy link
Contributor

PageSpeed Insights

Category Score
Accessibility 95
Best practices 96
Performance 64
SEO 69

View the full report https://pagespeed.web.dev/report?url=https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

@amankumarrr
Copy link
Member

amankumarrr commented Sep 23, 2024

We should avoid using <Suspense> to wrap this component. Ideally, it should be a server-side component. Telemetry and App Insights should only wrap the child components. Perhaps we can try using template.ts for client-side rendering, which might allow us to send telemetry from the client-side.

@amankumarrr
Copy link
Member

amankumarrr commented Sep 23, 2024

maybe something like this:

"use client";
import { AppInsightsProvider } from "@/context/app-insight-client";
import { TelemetryProvider } from "./components/TelemetryProvider";

export default function Template({ children }: { children: React.ReactNode }) {
  return (
    <AppInsightsProvider>
      <TelemetryProvider>{children}</TelemetryProvider>
    </AppInsightsProvider>
  );
}

@Calinator444 Calinator444 marked this pull request as ready for review September 24, 2024 00:52
Copy link
Contributor

Deployed changes to https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

Copy link
Contributor

PageSpeed Insights

Category Score
Accessibility 95
Best practices 96
Performance 64
SEO 69

View the full report https://pagespeed.web.dev/report?url=https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

Copy link
Contributor

Deployed changes to https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

Copy link
Contributor

PageSpeed Insights

Category Score
Accessibility 95
Best practices 96
Performance 63
SEO 69

View the full report https://pagespeed.web.dev/report?url=https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

Copy link
Contributor

Deployed changes to https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

Copy link
Contributor

PageSpeed Insights

Category Score
Accessibility 95
Best practices 96
Performance 65
SEO 69

View the full report https://pagespeed.web.dev/report?url=https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

@amankumarrr
Copy link
Member

WebVitals are being logged correctly!
image

@amankumarrr
Copy link
Member

Note: The red arrow denotes the point in time when the page was migrated to app routing
Image

Figure: Page views over time for /products

@amankumarrr
Copy link
Member

Tested with upcoming UG, seems to be working fine!
image

Copy link
Contributor

Deployed changes to https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

Copy link
Contributor

PageSpeed Insights

Category Score
Accessibility 95
Best practices 96
Performance 66
SEO 69

View the full report https://pagespeed.web.dev/report?url=https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

@Calinator444
Copy link
Member Author

Worried about the missing Suspense boundary around the LiveStream component but Aman has confirmed with me that this issue does not result in errors when building the website locally.

@Calinator444
Copy link
Member Author

@wicksipedia @bradystroud

I tested this to ensure it was sending requests to app insights in staging.

image

Copy link
Contributor

Deployed changes to https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

Copy link
Contributor

PageSpeed Insights

Category Score
Accessibility 95
Best practices 96
Performance 61
SEO 69

View the full report https://pagespeed.web.dev/report?url=https://app-sswwebsite-9eb3-pr-3151.azurewebsites.net

@amankumarrr
Copy link
Member

amankumarrr commented Sep 25, 2024

@bradystroud
Fixed the issue for web vitals, as it was being called outside the AppInsight provider.
image

Copy link
Member

@bradystroud bradystroud left a comment

Choose a reason for hiding this comment

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

LGTM - Aman and I checked out the results in app insights

@amankumarrr amankumarrr merged commit a03d292 into main Sep 25, 2024
11 checks passed
@amankumarrr amankumarrr deleted the fix-app-insights branch September 25, 2024 01:51
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.

✨ App Routing - 📈Add telemetry for app router pages
3 participants