Skip to content

Commit

Permalink
remove status from application latency
Browse files Browse the repository at this point in the history
  • Loading branch information
mutianf committed May 11, 2022
1 parent 24cd525 commit c5b312e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,22 @@ public void recordRetryCount(int attemptCount) {
operationLevelNoStreaming.put(BuiltinMeasureConstants.RETRY_COUNT, attemptCount);
}

public void recordApplicationLatency(long applicationLatency) {
operationLevelWithStreaming.put(
BuiltinMeasureConstants.APPLICATION_LATENCIES, applicationLatency);
public void recordApplicationLatency(
long applicationLatency, String tableId, String zone, String cluster) {
MeasureMap measures =
statsRecorder
.newMeasureMap()
.put(BuiltinMeasureConstants.APPLICATION_LATENCIES, applicationLatency);

TagContextBuilder tagCtx = newTagContextBuilder(tableId, zone, cluster);
if (operationType == OperationType.ServerStreaming
&& spanName.getMethodName().equals("ReadRows")) {
tagCtx.putLocal(BuiltinMeasureConstants.STREAMING, TagValue.create("true"));
} else {
tagCtx.putLocal(BuiltinMeasureConstants.STREAMING, TagValue.create("false"));
}

measures.record(tagCtx.build());
}

public void recordFirstResponseLatency(long firstResponseLatency) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void testStreamingOperation() throws InterruptedException {
tracer.recordOperationLatencies(operationLatency);
tracer.recordRetryCount(attemptCount);
tracer.recordAttemptLatency(attemptLatency);
tracer.recordApplicationLatency(applicationLatency);
tracer.recordApplicationLatency(applicationLatency, TABLE_ID, ZONE, CLUSTER);
tracer.recordGfeLatencies(serverLatency);
tracer.recordGfeMissingHeaders(connectivityErrorCount);
tracer.recordFirstResponseLatency(firstResponseLatency);
Expand Down Expand Up @@ -261,7 +261,7 @@ public void testUnaryOperations() throws InterruptedException {
tracer.recordOperationLatencies(operationLatency);
tracer.recordRetryCount(attemptCount);
tracer.recordAttemptLatency(attemptLatency);
tracer.recordApplicationLatency(applicationLatency);
tracer.recordApplicationLatency(applicationLatency, TABLE_ID, ZONE, CLUSTER);
tracer.recordGfeLatencies(serverLatency);
tracer.recordGfeMissingHeaders(connectivityErrorCount);
tracer.recordFirstResponseLatency(firstResponseLatency);
Expand Down

0 comments on commit c5b312e

Please sign in to comment.