|
29 | 29 | */
|
30 | 30 | package com.google.api.gax.httpjson.testing;
|
31 | 31 |
|
32 |
| -import com.google.api.gax.tracing.BaseApiTracer; |
| 32 | +import com.google.api.gax.tracing.ApiTracer; |
33 | 33 | import java.util.concurrent.atomic.AtomicBoolean;
|
34 | 34 | import java.util.concurrent.atomic.AtomicInteger;
|
35 | 35 | import org.threeten.bp.Duration;
|
|
38 | 38 | * Test tracer that keeps count of different events. See {@link TestApiTracerFactory} for more
|
39 | 39 | * details.
|
40 | 40 | */
|
41 |
| -public class TestApiTracer extends BaseApiTracer { |
| 41 | +public class TestApiTracer implements ApiTracer { |
42 | 42 |
|
43 |
| - private final AtomicInteger tracerAttempts; |
44 |
| - private final AtomicInteger tracerAttemptsFailed; |
45 |
| - private final AtomicBoolean tracerOperationFailed; |
46 |
| - private final AtomicBoolean tracerFailedRetriesExhausted; |
| 43 | + private final AtomicInteger attemptsStarted; |
| 44 | + private final AtomicInteger attemptsFailed; |
| 45 | + private final AtomicBoolean operationFailed; |
| 46 | + private final AtomicBoolean retriesExhausted; |
47 | 47 |
|
48 | 48 | public TestApiTracer(
|
49 | 49 | AtomicInteger tracerAttempts,
|
50 | 50 | AtomicInteger tracerAttemptsFailed,
|
51 | 51 | AtomicBoolean tracerOperationFailed,
|
52 | 52 | AtomicBoolean tracerFailedRetriesExhausted) {
|
53 |
| - this.tracerAttempts = tracerAttempts; |
54 |
| - this.tracerAttemptsFailed = tracerAttemptsFailed; |
55 |
| - this.tracerOperationFailed = tracerOperationFailed; |
56 |
| - this.tracerFailedRetriesExhausted = tracerFailedRetriesExhausted; |
| 53 | + this.attemptsStarted = tracerAttempts; |
| 54 | + this.attemptsFailed = tracerAttemptsFailed; |
| 55 | + this.operationFailed = tracerOperationFailed; |
| 56 | + this.retriesExhausted = tracerFailedRetriesExhausted; |
57 | 57 | }
|
58 | 58 |
|
59 | 59 | @Override
|
60 | 60 | public void attemptFailed(Throwable error, Duration delay) {
|
61 |
| - tracerAttemptsFailed.incrementAndGet(); |
62 |
| - super.attemptFailed(error, delay); |
| 61 | + attemptsFailed.incrementAndGet(); |
63 | 62 | }
|
64 | 63 |
|
65 | 64 | @Override
|
66 | 65 | public void attemptStarted(int attemptNumber) {
|
67 |
| - tracerAttempts.incrementAndGet(); |
68 |
| - super.attemptStarted(attemptNumber); |
| 66 | + attemptsStarted.incrementAndGet(); |
69 | 67 | }
|
70 | 68 |
|
71 | 69 | @Override
|
72 | 70 | public void operationFailed(Throwable error) {
|
73 |
| - tracerOperationFailed.set(true); |
74 |
| - super.operationFailed(error); |
| 71 | + operationFailed.set(true); |
75 | 72 | }
|
76 | 73 |
|
77 | 74 | @Override
|
78 | 75 | public void attemptFailedRetriesExhausted(Throwable error) {
|
79 |
| - tracerFailedRetriesExhausted.set(true); |
80 |
| - super.attemptFailedRetriesExhausted(error); |
| 76 | + retriesExhausted.set(true); |
81 | 77 | }
|
82 | 78 | };
|
0 commit comments