-
Notifications
You must be signed in to change notification settings - Fork 102
Add CSM for batch write flow control #2685
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?
Add CSM for batch write flow control #2685
Conversation
2ca884e to
b4006a2
Compare
...rc/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java
Outdated
Show resolved
Hide resolved
...ud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracer.java
Outdated
Show resolved
Hide resolved
...ud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracer.java
Outdated
Show resolved
Hide resolved
...le/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsConstants.java
Outdated
Show resolved
Hide resolved
...le/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsConstants.java
Outdated
Show resolved
Hide resolved
b4006a2 to
e8a246f
Compare
...rc/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java
Outdated
Show resolved
Hide resolved
...ud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracer.java
Show resolved
Hide resolved
...le/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsConstants.java
Show resolved
Hide resolved
...le/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsConstants.java
Outdated
Show resolved
Hide resolved
...le/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsConstants.java
Outdated
Show resolved
Hide resolved
...le/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsConstants.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java
Outdated
Show resolved
Hide resolved
e8a246f to
ae0ed5a
Compare
7d3fdd2 to
5f07efc
Compare
...rc/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java
Show resolved
Hide resolved
...rc/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java
Outdated
Show resolved
Hide resolved
...table/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracer.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java
Outdated
Show resolved
Hide resolved
...e/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java
Outdated
Show resolved
Hide resolved
...e/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java
Outdated
Show resolved
Hide resolved
| // closing the batcher to trigger the third flush | ||
| batcher.close(); | ||
|
|
||
| MetricData applicationLatency = getMetricData(metricReader, BATCH_WRITE_FLOW_CONTROL_TARGET_QPS_NAME); |
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.
| MetricData applicationLatency = getMetricData(metricReader, BATCH_WRITE_FLOW_CONTROL_TARGET_QPS_NAME); | |
| MetricData targetQps = getMetricData(metricReader, BATCH_WRITE_FLOW_CONTROL_TARGET_QPS_NAME); |
| } | ||
| builder.addEntriesBuilder().setIndex(i); | ||
|
|
||
| com.google.protobuf.Duration duration = builder.getRateLimitInfoBuilder().getPeriodBuilder().setSeconds(10).build(); |
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.
nit: can you import com.google.bigtable.v2.RateLimitInfo so we don't need to write the full path here?
...e/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java
Show resolved
Hide resolved
6169b3c to
8e84e9f
Compare
8e84e9f to
7981240
Compare
mutianf
left a comment
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.
Thank you for adding the tests, left some more nits but otherwise looks good!
| import io.opentelemetry.sdk.metrics.InstrumentSelector; | ||
| import io.opentelemetry.sdk.metrics.InstrumentType; | ||
| import io.opentelemetry.sdk.metrics.View; | ||
| import io.opentelemetry.sdk.metrics.*; |
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.
here also, no import *
| */ | ||
| package com.google.cloud.bigtable.data.v2.stub; | ||
|
|
||
| import static com.google.cloud.bigtable.data.v2.stub.metrics.Util.extractStatus; |
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.
I don't think you need this import anymore? You can run mvn com.spotify.fmt:fmt-maven-plugin:format and that should clean up the unused imports.
|
|
||
| /** Convert an exception into a value that can be used to create an OpenCensus tag value. */ | ||
| static String extractStatus(@Nullable Throwable error) { | ||
| public static String extractStatus(@Nullable Throwable error) { |
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.
this doesn't need to be public now
| .collect(Collectors.toList()) | ||
| .get(0); | ||
| return hd.getSum() / hd.getCount(); | ||
| case LONG_SUM: |
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.
is this right? this is long_sum, how could the value be double?
| batcher.add( | ||
| RowMutationEntry.create("batch-write-flow-control-success-12").setCell("f", "q", "v")); | ||
|
|
||
| // closing the batcher to trigger the third flush |
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.
nit:
| // closing the batcher to trigger the third flush | |
| // closing the batcher to trigger the flush |
| batcher.add( | ||
| RowMutationEntry.create("batch-write-flow-control-success-08").setCell("f", "q", "v")); | ||
|
|
||
| // closing the batcher to trigger the third flush |
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.
nit:
| // closing the batcher to trigger the third flush | |
| // closing the batcher to trigger the flush |
| batcher.add( | ||
| RowMutationEntry.create("batch-write-flow-control-success-18").setCell("f", "q", "v")); | ||
|
|
||
| // closing the batcher to trigger the third flush |
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.
nit:
| // closing the batcher to trigger the third flush | |
| // closing the batcher to trigger the flush |
| batcher.add( | ||
| RowMutationEntry.create("batch-write-flow-control-success-05").setCell("f", "q", "v")); | ||
|
|
||
| // closing the batcher to trigger the third flush |
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.
| // closing the batcher to trigger the third flush | |
| // closing the batcher to trigger the flush |
| RowMutationEntry.create("batch-write-flow-control-fail-unavailable") | ||
| .setCell("f", "q", "v")); | ||
|
|
||
| // closing the batcher to trigger the third flush |
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.
| // closing the batcher to trigger the third flush | |
| // closing the batcher to trigger the flush |
|
|
||
| // Add RateLimitInfo for Batch Write Flow Control | ||
| if (receivedRowkey.equals("batch-write-flow-control-success-18")) { | ||
| com.google.protobuf.Duration duration = |
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.
nit: you can probably build the duration outside of the if statements to simplify the code
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> ☕️
If you write sample code, please follow the samples format.