-
Notifications
You must be signed in to change notification settings - Fork 106
fix(bigtable): Use a different t4t7 latencies for directpath #2902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,8 @@ class BuiltinMetricsTracer extends BigtableTracer { | |
| private final AtomicLong totalClientBlockingTime = new AtomicLong(0); | ||
|
|
||
| private final AtomicLong grpcMessageSentDelay = new AtomicLong(0); | ||
| private final AtomicLong grpcHeadersSentNanos = new AtomicLong(0); | ||
| private final AtomicLong grpcHeadersOutHeaderInLatency = new AtomicLong(0); | ||
|
|
||
| private Deadline operationDeadline = null; | ||
| private volatile Duration remainingDeadlineAtAttemptStart = Duration.ZERO; | ||
|
|
@@ -263,6 +265,18 @@ public void grpcMessageSent() { | |
| grpcMessageSentDelay.set(attemptTimer.elapsed(TimeUnit.NANOSECONDS)); | ||
| } | ||
|
|
||
| @Override | ||
| public void grpcHeadersSent() { | ||
| grpcHeadersSentNanos.set(attemptTimer.elapsed(TimeUnit.NANOSECONDS)); | ||
| } | ||
|
|
||
| @Override | ||
| public void grpcHeadersReceived() { | ||
| long receivedNanos = attemptTimer.elapsed(TimeUnit.NANOSECONDS); | ||
| long sentNanos = grpcHeadersSentNanos.get(); | ||
| grpcHeadersOutHeaderInLatency.set(receivedNanos - sentNanos); | ||
| } | ||
|
|
||
| @Override | ||
| public void setTotalTimeoutDuration(java.time.Duration totalTimeoutDuration) { | ||
| // This method is called by BigtableTracerStreamingCallable and | ||
|
|
@@ -386,7 +400,8 @@ private void recordAttemptCompletion(@Nullable Throwable throwable) { | |
| code, | ||
| Comparators.max(remainingDeadlineAtAttemptStart, Duration.ZERO)); | ||
| } | ||
|
|
||
| // if we don't have t4t7 latency from gfe, we use dur between initial metadata sent and initial | ||
| // metadata recv | ||
| if (sidebandData.getGfeTiming() != null) { | ||
| recorder.serverLatency.record( | ||
| clientInfo, | ||
|
|
@@ -395,6 +410,18 @@ private void recordAttemptCompletion(@Nullable Throwable throwable) { | |
| sidebandData.getClusterInfo(), | ||
| code, | ||
| sidebandData.getGfeTiming()); | ||
| } else { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is expanding scope to what we talked about. This was supposed to be only for DirectAccess. This implementation expands the scope to any time the header is missing. Which means that we wont be able to tell what we are actually measuring. In our original conversation scoping it only to DA, we could reason that when transport_type is DA, we measuring client headers until response headers. In all other cases we are measuring gfe latency. And if the DistributionCount() drops we know that we couldnt reach a gfe. With this approach, we muddy our ability to reason about the metric |
||
| // Fallback to header latency if GFE timing is not available | ||
| long fallbackLatencyNanos = grpcHeadersOutHeaderInLatency.get(); | ||
| if (fallbackLatencyNanos > 0) { | ||
| recorder.serverLatency.record( | ||
| clientInfo, | ||
| tableId, | ||
| methodInfo, | ||
| sidebandData.getClusterInfo(), | ||
| code, | ||
| Duration.ofNanos(fallbackLatencyNanos)); | ||
| } | ||
| } | ||
|
|
||
| boolean seenServer = | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a volatile Stopwatch? it would communicate the intent better: