Skip to content

Commit 1f39032

Browse files
fix: ensure that per attempt metrics tracer is below the retries (#2793)
Change-Id: Idc58fa55bdb34a1e85fff6685c043bf559655e84
1 parent 54fee08 commit 1f39032

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -695,10 +695,10 @@ public ApiFuture<List<KeyOffset>> futureCall(String s, ApiCallContext apiCallCon
695695
withStatsHeaders = new StatsHeadersUnaryCallable<>(spoolable);
696696

697697
UnaryCallable<com.google.bigtable.v2.SampleRowKeysRequest, List<SampleRowKeysResponse>>
698-
withBigtableTracer = new BigtableTracerUnaryCallable<>(withStatsHeaders);
698+
withAttemptTracer = new BigtableTracerUnaryCallable<>(withStatsHeaders);
699699

700700
UnaryCallable<com.google.bigtable.v2.SampleRowKeysRequest, List<SampleRowKeysResponse>>
701-
retryable = withRetries(withBigtableTracer, settings.sampleRowKeysSettings());
701+
retryable = withRetries(withAttemptTracer, settings.sampleRowKeysSettings());
702702

703703
return createUserFacingUnaryCallable(
704704
methodName,
@@ -774,7 +774,7 @@ private UnaryCallable<BulkMutation, MutateRowsAttemptResult> createMutateRowsBas
774774
ServerStreamingCallable<MutateRowsRequest, MutateRowsResponse> convertException =
775775
new ConvertExceptionCallable<>(callable);
776776

777-
ServerStreamingCallable<MutateRowsRequest, MutateRowsResponse> withBigtableTracer =
777+
ServerStreamingCallable<MutateRowsRequest, MutateRowsResponse> withAttemptTracer =
778778
new BigtableTracerStreamingCallable<>(convertException);
779779

780780
BasicResultRetryAlgorithm<MutateRowsAttemptResult> resultRetryAlgorithm;
@@ -797,7 +797,7 @@ private UnaryCallable<BulkMutation, MutateRowsAttemptResult> createMutateRowsBas
797797
UnaryCallable<MutateRowsRequest, MutateRowsAttemptResult> baseCallable =
798798
new MutateRowsRetryingCallable(
799799
clientContext.getDefaultCallContext(),
800-
withBigtableTracer,
800+
withAttemptTracer,
801801
retryingExecutor,
802802
settings.bulkMutateRowsSettings().getRetryableCodes(),
803803
retryAlgorithm);
@@ -1033,11 +1033,11 @@ private UnaryCallable<ReadModifyWriteRow, Row> createReadModifyWriteRowCallable(
10331033
ServerStreamingCallable<String, ByteStringRange> watched =
10341034
Callables.watched(convertException, innerSettings, clientContext);
10351035

1036-
ServerStreamingCallable<String, ByteStringRange> withBigtableTracer =
1036+
ServerStreamingCallable<String, ByteStringRange> withAttemptTracer =
10371037
new BigtableTracerStreamingCallable<>(watched);
10381038

10391039
ServerStreamingCallable<String, ByteStringRange> retrying =
1040-
withRetries(withBigtableTracer, innerSettings);
1040+
withRetries(withAttemptTracer, innerSettings);
10411041

10421042
SpanName span = getSpanName("GenerateInitialChangeStreamPartitions");
10431043
ServerStreamingCallable<String, ByteStringRange> traced =
@@ -1105,11 +1105,11 @@ private UnaryCallable<ReadModifyWriteRow, Row> createReadModifyWriteRowCallable(
11051105
ServerStreamingCallable<ReadChangeStreamRequest, ChangeStreamRecordT> watched =
11061106
Callables.watched(merging, innerSettings, clientContext);
11071107

1108-
ServerStreamingCallable<ReadChangeStreamRequest, ChangeStreamRecordT> withBigtableTracer =
1108+
ServerStreamingCallable<ReadChangeStreamRequest, ChangeStreamRecordT> withAttemptTracer =
11091109
new BigtableTracerStreamingCallable<>(watched);
11101110

11111111
ServerStreamingCallable<ReadChangeStreamRequest, ChangeStreamRecordT> readChangeStreamCallable =
1112-
withRetries(withBigtableTracer, innerSettings);
1112+
withRetries(withAttemptTracer, innerSettings);
11131113

11141114
ServerStreamingCallable<ReadChangeStreamQuery, ChangeStreamRecordT>
11151115
readChangeStreamUserCallable =
@@ -1175,6 +1175,9 @@ public Map<String, String> extract(ExecuteQueryRequest executeQueryRequest) {
11751175
ServerStreamingCallable<ExecuteQueryCallContext, ExecuteQueryResponse> convertException =
11761176
new ConvertExceptionCallable<>(withPlanRefresh);
11771177

1178+
ServerStreamingCallable<ExecuteQueryCallContext, ExecuteQueryResponse> withAttemptTracer =
1179+
new BigtableTracerStreamingCallable<>(convertException);
1180+
11781181
ServerStreamingCallSettings<ExecuteQueryCallContext, ExecuteQueryResponse> retrySettings =
11791182
ServerStreamingCallSettings.<ExecuteQueryCallContext, ExecuteQueryResponse>newBuilder()
11801183
.setResumptionStrategy(new ExecuteQueryResumptionStrategy())
@@ -1189,7 +1192,7 @@ public Map<String, String> extract(ExecuteQueryRequest executeQueryRequest) {
11891192
// attempt stream will have reset set to true, so any unyielded data from the previous
11901193
// attempt will be reset properly
11911194
ServerStreamingCallable<ExecuteQueryCallContext, ExecuteQueryResponse> retries =
1192-
withRetries(convertException, retrySettings);
1195+
withRetries(withAttemptTracer, retrySettings);
11931196

11941197
ServerStreamingCallable<ExecuteQueryCallContext, SqlRow> merging =
11951198
new SqlRowMergingCallable(retries);
@@ -1208,13 +1211,10 @@ public Map<String, String> extract(ExecuteQueryRequest executeQueryRequest) {
12081211
ServerStreamingCallable<ExecuteQueryCallContext, SqlRow> passingThroughErrorsToMetadata =
12091212
new MetadataErrorHandlingCallable(watched);
12101213

1211-
ServerStreamingCallable<ExecuteQueryCallContext, SqlRow> withBigtableTracer =
1212-
new BigtableTracerStreamingCallable<>(passingThroughErrorsToMetadata);
1213-
12141214
SpanName span = getSpanName("ExecuteQuery");
12151215
ServerStreamingCallable<ExecuteQueryCallContext, SqlRow> traced =
12161216
new TracedServerStreamingCallable<>(
1217-
withBigtableTracer, clientContext.getTracerFactory(), span);
1217+
passingThroughErrorsToMetadata, clientContext.getTracerFactory(), span);
12181218

12191219
return new ExecuteQueryCallable(
12201220
traced.withDefaultCallContext(

0 commit comments

Comments
 (0)