@Test public void metricsAreNotRegisteredIfSweepStrategyNotTracked() { MetricsManager anotherManager = MetricsManagers.createForTests(); TargetedSweepMetrics.createWithClock(anotherManager, kvs, () -> clockTime, TargetedSweepMetrics.MetricsConfiguration.builder() .addTrackedSweeperStrategies(SweepStrategy.SweeperStrategy.THOROUGH) .millisBetweenRecomputingMetrics(RECOMPUTE_MILLIS) .build()); assertThat(anotherManager).hasNotRegisteredEnqueuedWritesConservativeMetric(); assertThat(anotherManager).hasEnqueuedWritesThoroughEqualTo(0); }
public static TargetedSweepMetrics createWithClock( MetricsManager metricsManager, KeyValueService kvs, Clock clock, MetricsConfiguration metricsConfiguration) { return new TargetedSweepMetrics( metricsManager, ts -> getMillisForTimestampBoundedAtOneWeek(kvs, ts, clock), clock, metricsConfiguration); }
TargetedSweepMetrics { public static TargetedSweepMetrics createWithClock( MetricsManager metricsManager, KeyValueService kvs, Clock clock, MetricsConfiguration metricsConfiguration) { return new TargetedSweepMetrics( metricsManager, ts -> getMillisForTimestampBoundedAtOneWeek(kvs, ts, clock), clock, metricsConfiguration); } }
TargetedSweepMetrics { public static TargetedSweepMetrics createWithClock( MetricsManager metricsManager, KeyValueService kvs, Clock clock, MetricsConfiguration metricsConfiguration) { return new TargetedSweepMetrics( metricsManager, ts -> getMillisForTimestampBoundedAtOneWeek(kvs, ts, clock), clock, metricsConfiguration); } private  TargetedSweepMetrics(
            MetricsManager metricsManager,
            Function<Long, Long> tsToMillis,
            Clock clock,
            MetricsConfiguration metricsConfiguration); }
TargetedSweepMetrics { public static TargetedSweepMetrics createWithClock( MetricsManager metricsManager, KeyValueService kvs, Clock clock, MetricsConfiguration metricsConfiguration) { return new TargetedSweepMetrics( metricsManager, ts -> getMillisForTimestampBoundedAtOneWeek(kvs, ts, clock), clock, metricsConfiguration); } private  TargetedSweepMetrics(
            MetricsManager metricsManager,
            Function<Long, Long> tsToMillis,
            Clock clock,
            MetricsConfiguration metricsConfiguration); static TargetedSweepMetrics create(
            MetricsManager metricsManager,
            TimelockService timelock,
            KeyValueService kvs,
            MetricsConfiguration metricsConfiguration); static TargetedSweepMetrics createWithClock(
            MetricsManager metricsManager,
            KeyValueService kvs,
            Clock clock,
            MetricsConfiguration metricsConfiguration); void updateEnqueuedWrites(ShardAndStrategy shardStrategy, long writes); void updateEntriesRead(ShardAndStrategy shardStrategy, long reads); void updateNumberOfTombstones(ShardAndStrategy shardStrategy, long tombstones); void updateAbortedWritesDeleted(ShardAndStrategy shardStrategy, long deletes); void updateSweepTimestamp(ShardAndStrategy shardStrategy, long value); void updateProgressForShard(ShardAndStrategy shardStrategy, long lastSweptTs); void registerOccurrenceOf(ShardAndStrategy shardStrategy, SweepOutcome outcome); void registerOccurrenceOf(SweeperStrategy strategy, SweepOutcome outcome); void registerEntriesReadInBatch(ShardAndStrategy shardStrategy, long batchSize); }
TargetedSweepMetrics { public static TargetedSweepMetrics createWithClock( MetricsManager metricsManager, KeyValueService kvs, Clock clock, MetricsConfiguration metricsConfiguration) { return new TargetedSweepMetrics( metricsManager, ts -> getMillisForTimestampBoundedAtOneWeek(kvs, ts, clock), clock, metricsConfiguration); } private  TargetedSweepMetrics(
            MetricsManager metricsManager,
            Function<Long, Long> tsToMillis,
            Clock clock,
            MetricsConfiguration metricsConfiguration); static TargetedSweepMetrics create(
            MetricsManager metricsManager,
            TimelockService timelock,
            KeyValueService kvs,
            MetricsConfiguration metricsConfiguration); static TargetedSweepMetrics createWithClock(
            MetricsManager metricsManager,
            KeyValueService kvs,
            Clock clock,
            MetricsConfiguration metricsConfiguration); void updateEnqueuedWrites(ShardAndStrategy shardStrategy, long writes); void updateEntriesRead(ShardAndStrategy shardStrategy, long reads); void updateNumberOfTombstones(ShardAndStrategy shardStrategy, long tombstones); void updateAbortedWritesDeleted(ShardAndStrategy shardStrategy, long deletes); void updateSweepTimestamp(ShardAndStrategy shardStrategy, long value); void updateProgressForShard(ShardAndStrategy shardStrategy, long lastSweptTs); void registerOccurrenceOf(ShardAndStrategy shardStrategy, SweepOutcome outcome); void registerOccurrenceOf(SweeperStrategy strategy, SweepOutcome outcome); void registerEntriesReadInBatch(ShardAndStrategy shardStrategy, long batchSize);  }