-
Notifications
You must be signed in to change notification settings - Fork 46
Use baggage for spans, Fixes AB#3385536 #2770
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
Conversation
|
❌ Work item link check failed. Description does not contain AB#{ID}. Click here to Learn more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modifies the telemetry implementation to use OpenTelemetry baggage for propagating parent span attributes to child spans created during WebView redirects. The change addresses the limitation where parent span attributes cannot be directly accessed from immutable contexts passed to activities.
- Introduces baggage-based attribute propagation for correlation_id and calling_package_name from parent spans
- Refactors span creation to use a centralized method that extracts attributes from baggage
- Removes redundant WebCP-specific attribute names that are no longer needed
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| SpanName.java | Adds new span names for WebCP enrollment and authorize URL redirects |
| AttributeName.java | Removes deprecated WebCP-specific attribute names |
| AzureActiveDirectoryWebViewClient.java | Implements baggage-based attribute propagation and refactors span creation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
common4j/src/main/com/microsoft/identity/common/java/opentelemetry/SpanName.java
Show resolved
Hide resolved
...ava/com/microsoft/identity/common/internal/ui/webview/AzureActiveDirectoryWebViewClient.java
Outdated
Show resolved
Hide resolved
...ava/com/microsoft/identity/common/internal/ui/webview/AzureActiveDirectoryWebViewClient.java
Show resolved
Hide resolved
|
✅ Work item link check complete. Description contains link AB#3385536 to an Azure Boards work item. |
8a87e4a to
fde86eb
Compare
| final boolean isWebCpFlightEnabled = CommonFlightsManager.INSTANCE.getFlightsProviderForTenant(homeTenantId, waitForFlightsTimeOut).isFlightEnabled(CommonFlight.ENABLE_WEB_CP_IN_WEBVIEW); | ||
| SpanExtension.current().setAttribute(AttributeName.web_cp_flight_get_time.name(), (System.currentTimeMillis() - webCpGetFlightStartTime)); | ||
|
|
||
| SpanExtension.current().setAttribute(AttributeName.tenant_id.name(), homeTenantId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems you are adding tenant id here, which is good
Using baggage to get parent span's (AcquireTokenInteractive) correlationId, calling app package name and setting them on the child spans created during webcp redirects in webview.
Why this needed?
Related broker PR to remove the redundant attributes : https://github.com/AzureAD/ad-accounts-for-android/pull/3230
Fixes AB#3385536