Skip to content

Commit

Permalink
fix: BaseApiTracer to noop on attemptFailed via overloaded method c…
Browse files Browse the repository at this point in the history
…all (#3016)

Fixes #3015
Fixes #3014

Gax tracing internally works with `attemptFailedDuration`, which
defaults to a no-op. Downstream libraries use `attemptFailed`, which has
a custom behavior. What happens when an attempt-failed event occurs is
that `attemptFailedDuration` is called instead (in favor of using
java.time methods internally). This fix makes `attemptFailedDuration`'s
behavior to delegate the logic to `attemptFailed`.

The downstreams will keep failing because the repos haven't got adapted
to the new change in gax. See the follow ups below.

### Fixes in `java-spanner`

![image](https://github.com/googleapis/sdk-platform-java/assets/22083784/85e50341-fe8b-46c8-9743-8de1ca300058)

### Fixes in `java-bigtable`

![image](https://github.com/googleapis/sdk-platform-java/assets/22083784/026af401-1607-4465-abd5-1ee5ddc353d0)


### Follow ups in `java-bigtable`
More failures in java-bigtable to be addressed in that repo:
```
Error:    BigtableTableAdminSettingsTest.testToString:175 expected to contain: totalTimeout=PT13H32M
but was            : BigtableTableAdminSettings{projectId=our-project-85, instanceId=our-instance-06, 
...
```

Fixed in googleapis/java-bigtable#2274

### Follow ups in `java-spanner`
```
Error:  Failures: 
Error:    CompositeTracerTest.testMethodsOverrideMetricsTracer:238 Method not found in compositeTracerMethods: public void com.google.api.gax.tracing.MetricsTracer.attemptFailedDuration(java.lang.Throwable,java.time.Duration)
```
Fixed in googleapis/java-spanner#3200
  • Loading branch information
diegomarquezp authored Jul 8, 2024
1 parent 99bb2b3 commit 2fc938a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
*/
package com.google.api.gax.tracing;

import static com.google.api.gax.util.TimeConversionUtils.toThreetenDuration;

import com.google.api.core.InternalApi;
import com.google.api.core.ObsoleteApi;

Expand Down Expand Up @@ -105,15 +107,16 @@ public void attemptCancelled() {

@Override
public void attemptFailedDuration(Throwable error, java.time.Duration delay) {
// noop
// noop via attemptFailed(Throwable error, org.threeten.Duration)
attemptFailed(error, toThreetenDuration(delay));
}

/**
* This method is obsolete. Use {@link #attemptFailedDuration(Throwable, java.time.Duration)}
* instead.
*/
@Override
@ObsoleteApi("Use attemptFailed(Throwable, java.time.Duration) instead")
@ObsoleteApi("Use attemptFailedDuration(Throwable, java.time.Duration) instead")
public void attemptFailed(Throwable error, org.threeten.bp.Duration delay) {
// noop
}
Expand Down

0 comments on commit 2fc938a

Please sign in to comment.