feat: add Auth0-Client telemetry header#103
Merged
kishore7snehil merged 4 commits intomainfrom Apr 24, 2026
Merged
Conversation
64f0491 to
34973e3
Compare
nandan-bhat
reviewed
Apr 24, 2026
nandan-bhat
reviewed
Apr 24, 2026
c253e3d to
5a7290d
Compare
Send an Auth0-Client header (base64-encoded JSON with SDK name, version, and Python runtime) on every request to Auth0 endpoints. This follows the standard Auth0 SDK telemetry convention. - Add Telemetry class in telemetry.py for building and caching headers - Add _get_http_client() helper to ServerClient, MyAccountClient, and MfaClient to inject telemetry headers into all httpx requests - Pass telemetry headers to AsyncOAuth2Client for token exchange calls - Add unit tests for telemetry header format and integration
Replace `from __future__ import annotations` with `Optional[dict[str, str]]` syntax for the headers parameter in telemetry.py, mfa_client.py, and my_account_client.py. This avoids triggering lint warnings on existing Optional[X] annotations while maintaining Python 3.9 compatibility.
- Build headers eagerly in Telemetry.__init__ instead of lazy caching - Narrow exception catch to PackageNotFoundError in Telemetry.default() - Reverse header merge order so telemetry headers cannot be overwritten - Fix resource leak in test by closing httpx.AsyncClient - Replace mock-based OIDC test with direct header assertion - Add test for AsyncOAuth2Client telemetry header propagation - Add tests for MFA client header propagation and merge behavior
5a7290d to
8173621
Compare
nandan-bhat
approved these changes
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Telemetryclass (telemetry.py) that builds and caches theAuth0-Clientheader - a base64-encoded JSON payload with SDK name, version, and Python runtime environment_get_http_client()helper toServerClient,MyAccountClient, andMfaClientto inject telemetry headers into allhttpxrequests (17 call sites)AsyncOAuth2Clientfor token exchange calls