@@ -636,7 +636,7 @@ private boolean shouldLaunchCompanyPortal() {
636636 @ VisibleForTesting
637637 protected void loadDeviceCaUrl (@ NonNull final String originalUrl , @ NonNull final WebView view ) {
638638 final String methodTag = TAG + ":loadDeviceCaUrl" ;
639- final Span span = createWebCpFlowSpan (SpanName .ProcessWebCpRedirects .name ());
639+ final Span span = createSpanWithAttributesFromParent (SpanName .ProcessWebCpRedirects .name ());
640640 try (final Scope scope = SpanExtension .makeCurrentSpan (span )) {
641641 if (isWebCpInWebviewFeatureEnabled (originalUrl )) {
642642 Logger .info (methodTag , "Loading device CA request in WebView." );
@@ -709,7 +709,7 @@ private String getHomeTenantIdFromUrl(@NonNull final String url) {
709709 // This is a special case where the enrollment is not done in the WebView, but rather in the browser.
710710 private void processWebCpEnrollmentUrl (@ NonNull final WebView view , @ NonNull final String url ) {
711711 final String methodTag = TAG + ":processWebCpEnrollmentUrl" ;
712- final Span span = createWebCpFlowSpan (SpanName .ProcessWebCpEnrollmentRedirect .name ());
712+ final Span span = createSpanWithAttributesFromParent (SpanName .ProcessWebCpEnrollmentRedirect .name ());
713713 try (final Scope scope = SpanExtension .makeCurrentSpan (span )) {
714714 view .stopLoading ();
715715 Logger .info (methodTag , "Loading WebCP enrollment url in browser." );
@@ -1011,7 +1011,7 @@ private void processNonceAndReAttachHeaders(@NonNull final WebView view, @NonNul
10111011 private void processWebCpAuthorize (@ NonNull final WebView view , @ NonNull final String url ) {
10121012 final String methodTag = TAG + ":processWebCPAuthorize" ;
10131013 Logger .info (methodTag , "Processing WebCP authorize request." );
1014- final Span span = createWebCpFlowSpan (SpanName .ProcessWebCpAuthorizeUrlRedirect .name ());
1014+ final Span span = createSpanWithAttributesFromParent (SpanName .ProcessWebCpAuthorizeUrlRedirect .name ());
10151015 final ReAttachPrtHeaderHandler reAttachPrtHeaderHandler = new ReAttachPrtHeaderHandler (view , mRequestHeaders , span );
10161016 reAttachPrtHeader (url , reAttachPrtHeaderHandler , view , methodTag , span );
10171017 }
@@ -1136,21 +1136,23 @@ public void finalizeBeforeSendingResult(@NonNull final RawAuthorizationResult re
11361136 }
11371137
11381138 /**
1139- * Create a span for webcp flow with parent span context if available.
1139+ * Create a span for with parent span context if available.
11401140 * @param spanName Name of the span to be created.
11411141 * @return Created {@link Span}
11421142 */
1143- private Span createWebCpFlowSpan (@ NonNull final String spanName ) {
1143+ private Span createSpanWithAttributesFromParent (@ NonNull final String spanName ) {
11441144 final SpanContext spanContext = getActivity () instanceof AuthorizationActivity ? ((AuthorizationActivity ) getActivity ()).getSpanContext () : null ;
11451145 final Span span = spanContext != null ?
11461146 OTelUtility .createSpanFromParent (spanName , spanContext ) : OTelUtility .createSpan (spanName );
1147- // Populate some of parent span's attributes to current span.
1147+ if (mUtid != null ) {
1148+ span .setAttribute (AttributeName .tenant_id .name (), mUtid );
1149+ }
1150+ // Populate some of the parent span's attributes to current span.
11481151 final Context oTelContext = getActivity () instanceof AuthorizationActivity ? ((AuthorizationActivity ) getActivity ()).getOtelContext () : null ;
11491152 if (oTelContext != null ) {
11501153 final Baggage baggage = BaggageExtension .fromContext (oTelContext );
11511154 final List <AttributeName > parentAttributeNames = Arrays .asList (
11521155 AttributeName .correlation_id ,
1153- AttributeName .tenant_id ,
11541156 AttributeName .calling_package_name
11551157 );
11561158 for (AttributeName attributeName : parentAttributeNames ) {
0 commit comments