Skip to content

feat: Instrumentation#2527

Open
tusharpandey13 wants to merge 5 commits intomainfrom
feat/instrumentation
Open

feat: Instrumentation#2527
tusharpandey13 wants to merge 5 commits intomainfrom
feat/instrumentation

Conversation

@tusharpandey13
Copy link
Copy Markdown
Contributor

@tusharpandey13 tusharpandey13 commented Feb 18, 2026

This change adds configurable instrumentation support to the SDK, enabling emitting events at various critical points of the SDK flows.
These events can be consumed using a callback.

Some use-cases for this feature:

  • Event logging
  • Debugging
  • Event streaming and reactive workflows

Changes

Instrumentation infra:
These changes enable the actual instrumentation support.

  • instrumentation-emitter.ts: InstrumentationEmitter class, helper methods
  • instrumentation.flow.test.ts‎ & instrumentation.test.ts‎ : Tests
  • types/instrumentation.ts: Type definitions
  • EXAMPLES.md: Documentation

Event call sites:
These changes add call sites to existing SDK code at important points. PII data is not sent to emitter from codebase itself, removing the need for a filteration step.

  • auth-client.ts: Most of the SDK flows
  • client.ts: Configuration, one call site

Usage

1. Option1: Environment Variables

AUTH0_LOGGING_TARGET=console
AUTH0_LOGGING_LEVEL=info

Option 2: Custom callback

Configure a callback in Auth0ClientOptions:

export const auth0 = new Auth0Client({
  instrumentation: {
    logger: (event) => {
      // do what you want with the event here
      console.log(`[${event.level}] ${event.event}`, event.data);
    },
  },
});

Tests

Added unit and flow tests for complete integration.

@tusharpandey13 tusharpandey13 requested a review from a team as a code owner February 18, 2026 15:15
@tusharpandey13 tusharpandey13 marked this pull request as draft February 18, 2026 15:15
Comment thread src/server/instrumentation.flow.test.ts Dismissed
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.87%. Comparing base (6e9f186) to head (d306944).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2527      +/-   ##
==========================================
+ Coverage   90.50%   90.87%   +0.37%     
==========================================
  Files          52       54       +2     
  Lines        6632     6901     +269     
  Branches     1380     1421      +41     
==========================================
+ Hits         6002     6271     +269     
  Misses        619      619              
  Partials       11       11              

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

@tusharpandey13 tusharpandey13 marked this pull request as ready for review February 19, 2026 06:22
@tusharpandey13 tusharpandey13 changed the title feat: Add instrumentation support feat: Instrumentation Feb 19, 2026
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