Skip to content

Comments

frontend: Add ApplicationInsights to the frontend#236

Open
sniok wants to merge 3 commits intoAzure:headlamp-downstreamfrom
sniok:analytics
Open

frontend: Add ApplicationInsights to the frontend#236
sniok wants to merge 3 commits intoAzure:headlamp-downstreamfrom
sniok:analytics

Conversation

@sniok
Copy link
Collaborator

@sniok sniok commented Feb 11, 2026

Basic setup for the analytics

  1. Sets up AppInsights instance, runs before the app to capture as much as possible
  2. Sets up custom trackEvent trackException functions
  3. Integrates into our existing headlamp event to automatically track those
  4. Integrates into out ErrorBoundaries to report those errors
  5. Provides trackEvent trackException functions to plugins

(CI fails as expected)

How to test

  1. Open the app, perform some actions
  2. Validate /track network requests
  3. Validate that events are showing up in the app insights

Copilot AI review requested due to automatic review settings February 11, 2026 16:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a basic Microsoft Application Insights (AppInsights) integration to the frontend, wiring telemetry into existing Headlamp events, error boundaries, and the plugin API surface.

Changes:

  • Initialize AppInsights early via a new analyticsSetup.ts module loaded from index.html.
  • Add trackEvent / trackException helpers and invoke them from Headlamp event middleware and ErrorBoundary.
  • Expose analytics helpers through window.pluginLib for plugins; add required npm dependencies.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontend/src/redux/headlampEventSlice.ts Sends a telemetry event for each headlamp/event dispatch.
frontend/src/plugin/index.ts Exposes analytics helpers to plugins via window.pluginLib.analytics.
frontend/src/plugin/snapshots/pluginLib.snapshot Updates snapshot to include the new analytics export.
frontend/src/lib/analytics.tsx Adds wrapper helpers around AppInsights trackEvent / trackException.
frontend/src/components/common/ErrorBoundary/ErrorBoundary.tsx Reports errors to AppInsights when an error boundary triggers.
frontend/src/analyticsSetup.ts Initializes the AppInsights SDK early using an env-provided connection string.
frontend/index.html Loads analyticsSetup.ts before the main app entrypoint.
frontend/make-env.js Adds a default AppInsights connection string into generated .env.
frontend/package.json Adds AppInsights SDK dependencies.
frontend/package-lock.json Locks AppInsights SDK transitive dependencies.
Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sniok sniok requested review from skoeva and tejhan February 11, 2026 16:19
Copilot AI review requested due to automatic review settings February 11, 2026 16:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@skoeva skoeva left a comment

Choose a reason for hiding this comment

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

this could use a rebase since the CI fixes were merged

Copilot AI review requested due to automatic review settings February 20, 2026 18:11
@sniok sniok review requested due to automatic review settings February 20, 2026 18:14
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.

2 participants