Skip to content

feat: Add telemetry tracking via Auth0-Client header#301

Open
rax7389 wants to merge 7 commits into
mainfrom
feat/uic-telemetry-poc
Open

feat: Add telemetry tracking via Auth0-Client header#301
rax7389 wants to merge 7 commits into
mainfrom
feat/uic-telemetry-poc

Conversation

@rax7389
Copy link
Copy Markdown
Contributor

@rax7389 rax7389 commented May 25, 2026

Summary

Adds telemetry tracking to API calls via the Auth0-Client header. Block components declare their identity using useTelemetry() hook, enabling accurate tracking of which component initiated each API request.

Why

To track usage and understand which UI components are making API calls for analytics and debugging purposes.

What

Core Package (packages/core):

  • Added TelemetryComponentGetter type and buildTelemetryHeader() function in telemetry.ts
  • Updated createProxyFetcher() and createSpaFetcher() to include telemetry header
  • Added getComponent parameter threading through createCoreClient(), createMyAccountClient(), createMyOrganizationClient()

React Package (packages/react):

  • Added TelemetryProvider and useTelemetry() hook
  • Added CSS detection utility (css-detection.ts)
  • Integrated telemetry in spa-provider.tsx and proxy-provider.tsx
  • Added useTelemetry() to 6 block components

Packages

  • packages/core
  • packages/react
  • examples

Testing

  • This change adds unit test coverage
  • Tested for both SPA and RWA flows, all example apps working
  • All existing and new tests complete without errors

Checklist

  • Breaking change
  • Requires docs update
  • Backward compatible

Contributing

@rax7389 rax7389 marked this pull request as ready for review May 25, 2026 18:38
@rax7389 rax7389 closed this May 25, 2026
@rax7389 rax7389 reopened this May 25, 2026
@rax7389 rax7389 marked this pull request as draft May 27, 2026 19:15
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 28, 2026

Codecov Report

❌ Patch coverage is 98.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.58%. Comparing base (aecf241) to head (ffc715f).

Files with missing lines Patch % Lines
...src/hooks/shared/use-core-client-initialization.ts 84.61% 2 Missing ⚠️
...ackages/react/src/providers/telemetry-provider.tsx 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #301      +/-   ##
==========================================
+ Coverage   89.47%   89.58%   +0.11%     
==========================================
  Files         156      160       +4     
  Lines       13070    13246     +176     
  Branches     1419     1744     +325     
==========================================
+ Hits        11694    11867     +173     
- Misses       1376     1379       +3     

☔ 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.

@rax7389 rax7389 marked this pull request as ready for review May 28, 2026 18:31
@rax7389 rax7389 changed the title Feat/uic telemetry poc feat: Add context-based telemetry for Auth0-Client header May 28, 2026
@rax7389 rax7389 changed the title feat: Add context-based telemetry for Auth0-Client header feat: Add telemetry tracking via Auth0-Client header May 28, 2026
@NaveenChand755
Copy link
Copy Markdown
Contributor

do we have to support opt out option for customers with strict data policies ?

* @internal
*/
function DomainTable(props: DomainTableProps) {
useTelemetry('domain-management');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this be inside data layer in service hook ?

/**
* The package name used in telemetry.
*/
export const TELEMETRY_NAME = 'universal-components';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not package name itself ?

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.

3 participants