BenWhitehead commented on a change in pull request #14261:
URL: https://github.com/apache/beam/pull/14261#discussion_r627821682
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/RpcQosImpl.java
##########
@@ -83,48 +81,60 @@
private final WriteRampUp writeRampUp;
private final FluentBackoff fb;
- private final WeakHashMap<Context, Counters> counters;
+ private final WeakHashMap<Context, O11y> counters;
private final Random random;
private final Sleeper sleeper;
- private final Function<Context, Counters> computeCounters;
+ private final Function<Context, O11y> computeCounters;
+ private final DistributionFactory distributionFactory;
RpcQosImpl(
RpcQosOptions options,
Random random,
Sleeper sleeper,
- CounterFactory counterFactory
- ) {
+ CounterFactory counterFactory,
+ DistributionFactory distributionFactory) {
this.options = options;
this.random = random;
this.sleeper = sleeper;
- at = new AdaptiveThrottler();
- wb = new WriteBatcher();
- writeRampUp = new WriteRampUp(
- Math.max(1, 500 / options.getHintMaxNumWorkers())
- );
- fb = FluentBackoff.DEFAULT
- .withMaxRetries(options.getMaxAttempts() - 1) // maxRetries is an
inclusive value, we want exclusive since we are tracking all attempts
- .withInitialBackoff(options.getInitialBackoff());
+ DistributionFactory filteringDistributionFactory =
+ new DiagnosticOnlyFilteringDistributionFactory(
+ !options.isShouldReportDiagnosticMetrics(), distributionFactory);
+ this.distributionFactory = filteringDistributionFactory;
+ at =
+ new AdaptiveThrottler(
+ options.getSamplePeriod(),
+ options.getSamplePeriodBucketSize(),
+ options.getThrottleDuration(),
+ options.getOverloadRatio());
+ wb =
+ new WriteBatcher(
+ options.getSamplePeriod(),
+ options.getSamplePeriodBucketSize(),
+ options.getBatchInitialCount(),
+ options.getBatchTargetLatency(),
+ filteringDistributionFactory);
+ writeRampUp =
+ new WriteRampUp(
+ Math.max(1, 500 / options.getHintMaxNumWorkers()),
filteringDistributionFactory);
Review comment:
I'll push a commit with this change
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]