File tree Expand file tree Collapse file tree
main/java/com/google/api/gax
test/java/com/google/api/gax/rpc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -281,13 +281,11 @@ public static ClientContext create(StubSettings settings) throws IOException {
281281 if (apiTracerFactory instanceof SpanTracerFactory ) {
282282 apiTracerFactory = apiTracerFactory .withContext (apiTracerContext );
283283 }
284- if (com .google .api .gax .logging .LoggingUtils .isLoggingEnabled ()) {
285- com .google .api .gax .tracing .ApiTracerFactory loggingTracerFactory =
286- new com .google .api .gax .tracing .LoggingTracerFactory ().withContext (apiTracerContext );
287- apiTracerFactory =
288- new com .google .api .gax .tracing .CompositeTracerFactory (
289- apiTracerFactory , loggingTracerFactory );
290- }
284+ com .google .api .gax .tracing .ApiTracerFactory loggingTracerFactory =
285+ new com .google .api .gax .tracing .LoggingTracerFactory ().withContext (apiTracerContext );
286+ apiTracerFactory =
287+ new com .google .api .gax .tracing .CompositeTracerFactory (
288+ apiTracerFactory , loggingTracerFactory );
291289
292290 return newBuilder ()
293291 .setBackgroundResources (backgroundResources .build ())
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ public Scope inScope() {
5252 scopes [i ] = tracers .get (i ).inScope ();
5353 }
5454 return () -> {
55- for (Scope scope : scopes ) {
55+ for (int i = scopes .length - 1 ; i >= 0 ; i --) {
56+ Scope scope = scopes [i ];
5657 if (scope != null ) {
5758 scope .close ();
5859 }
@@ -62,22 +63,22 @@ public Scope inScope() {
6263
6364 @ Override
6465 public void operationSucceeded () {
65- for (ApiTracer tracer : tracers ) {
66- tracer .operationSucceeded ();
66+ for (int i = tracers . size () - 1 ; i >= 0 ; i -- ) {
67+ tracers . get ( i ) .operationSucceeded ();
6768 }
6869 }
6970
7071 @ Override
7172 public void operationCancelled () {
72- for (ApiTracer tracer : tracers ) {
73- tracer .operationCancelled ();
73+ for (int i = tracers . size () - 1 ; i >= 0 ; i -- ) {
74+ tracers . get ( i ) .operationCancelled ();
7475 }
7576 }
7677
7778 @ Override
7879 public void operationFailed (Throwable error ) {
79- for (ApiTracer tracer : tracers ) {
80- tracer .operationFailed (error );
80+ for (int i = tracers . size () - 1 ; i >= 0 ; i -- ) {
81+ tracers . get ( i ) .operationFailed (error );
8182 }
8283 }
8384
Original file line number Diff line number Diff line change @@ -116,7 +116,10 @@ private void recordActionableError(Throwable error) {
116116 }
117117 }
118118
119- String message = error .getMessage () != null ? error .getMessage () : error .getClass ().getName ();
119+ String message = "Unknown Error" ;
120+ if (error != null ) {
121+ message = error .getMessage () != null ? error .getMessage () : error .getClass ().getName ();
122+ }
120123 LoggingUtils .logActionableError (logContext , LOGGER_PROVIDER , message );
121124 }
122125}
Original file line number Diff line number Diff line change @@ -1304,7 +1304,8 @@ void testCreate_withTracerFactoryReturningNullWithContext() throws IOException {
13041304 Mockito .doReturn (apiTracerFactory ).when (settings ).getTracerFactory ();
13051305
13061306 ClientContext context = ClientContext .create (settings );
1307- assertThat (context .getTracerFactory ()).isSameInstanceAs (apiTracerFactory );
1307+ assertThat (context .getTracerFactory ())
1308+ .isInstanceOf (com .google .api .gax .tracing .CompositeTracerFactory .class );
13081309 verify (apiTracerFactory , times (1 )).withContext (Mockito .any ());
13091310 }
13101311}
You can’t perform that action at this time.
0 commit comments