Skip to content

Commit

Permalink
also update roundtripNanos prior to attemptEnded()
Browse files Browse the repository at this point in the history
  • Loading branch information
dapengzhang0 committed Nov 17, 2021
1 parent 32fdeef commit 4b0c91b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions census/src/main/java/io/grpc/census/CensusStatsModule.java
Expand Up @@ -342,6 +342,8 @@ public void outboundMessage(int seqNo) {

@Override
public void streamClosed(Status status) {
stopwatch.stop();
roundtripNanos = stopwatch.elapsed(TimeUnit.NANOSECONDS);
Deadline deadline = info.getCallOptions().getDeadline();
statusCode = status.getCode();
if (statusCode == Status.Code.CANCELLED && deadline != null) {
Expand All @@ -353,8 +355,6 @@ public void streamClosed(Status status) {
}
}
attemptsState.attemptEnded();
stopwatch.stop();
roundtripNanos = stopwatch.elapsed(TimeUnit.NANOSECONDS);
if (inboundReceivedOrClosed.compareAndSet(false, true)) {
if (module.recordFinishedRpcs) {
// Stream is closed early. So no need to record metrics for any inbound events after this
Expand Down

0 comments on commit 4b0c91b

Please sign in to comment.