File tree Expand file tree Collapse file tree
sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/tracing Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030
3131package com .google .api .gax .tracing ;
3232
33+ import com .google .api .client .util .Strings ;
3334import com .google .api .core .BetaApi ;
3435import com .google .api .core .InternalApi ;
3536import com .google .api .gax .rpc .LibraryMetadata ;
@@ -106,15 +107,12 @@ public ApiTracerFactory withContext(ApiTracerContext context) {
106107 if (context == null ) {
107108 return new BaseApiTracerFactory ();
108109 }
109- ApiTracerContext mergedContext = this .apiTracerContext .merge (context );
110- LibraryMetadata metadata = mergedContext .libraryMetadata ();
111- if (metadata == null || metadata .isEmpty ()) {
110+ LibraryMetadata metadata = context .libraryMetadata ();
111+ if (metadata == null || metadata .isEmpty () || Strings .isNullOrEmpty (metadata .artifactName ())) {
112112 return new BaseApiTracerFactory ();
113113 }
114114 Tracer newTracer = openTelemetry .getTracer (metadata .artifactName (), metadata .version ());
115- if (newTracer == null ) {
116- return new BaseApiTracerFactory ();
117- }
115+ ApiTracerContext mergedContext = this .apiTracerContext .merge (context );
118116 return new SpanTracerFactory (openTelemetry , newTracer , mergedContext );
119117 }
120118}
You can’t perform that action at this time.
0 commit comments