use of com.datastax.fallout.cassandra.shaded.com.google.common.annotations.VisibleForTesting in project fallout by datastax.
the class MetricsCollectionConfigurationManager method createMetricsArtifactDirectory.
@VisibleForTesting
void createMetricsArtifactDirectory() {
Path metricsArtifactsPath = StableMetricsThresholdArtifactChecker.getMetricsArtifactsPath(getNodeGroup());
FileUtils.createDirs(metricsArtifactsPath);
}
use of com.datastax.fallout.cassandra.shaded.com.google.common.annotations.VisibleForTesting in project fallout by datastax.
the class StableMetricsThresholdArtifactChecker method validateIfMetricValuesAreWithinRange.
@VisibleForTesting
boolean validateIfMetricValuesAreWithinRange(RangeQueryResult rangeQueryResult, Duration warmupOffset, Long lowerThreshold, Long upperThreshold) {
for (Result result : rangeQueryResult.data().result()) {
// this is executed per-node
Metric metric = result.metric();
Instant metricStartTime = null;
for (Value value : result.values()) {
// if it is not present, take the first timestamp and use it as the first one.
if (metricStartTime == null) {
metricStartTime = value.timestamp();
}
if (metricIsAfterWarmup(metricStartTime, warmupOffset, value.timestamp()) && (value.value() < lowerThreshold || value.value() > upperThreshold)) {
logger().error("The value: {} for metric: {} is not within threshold ({}-{})", value.value(), metric, lowerThreshold, upperThreshold);
return false;
}
}
}
return true;
}
use of com.datastax.fallout.cassandra.shaded.com.google.common.annotations.VisibleForTesting in project fallout by datastax.
the class TestRunReaper method checkForTestRunsPastTTL.
@VisibleForTesting
public static void checkForTestRunsPastTTL(TestRunDAO testRunDAO, PerformanceReportDAO reportDAO, TestDAO testDAO, UserMessenger httpMessenger, UserMessenger slackUserMessenger, String externalUrl, BooleanSupplier isPaused) {
logger.withScopedInfo("Checking for test runs older than three years").run(() -> {
final Instant lowerBound = Instant.now().minus(THREE_YEARS);
Map<String, List<TestRun>> testRunsByUser = new HashMap<>();
testRunDAO.getAll().takeWhile(ignored -> !isPaused.getAsBoolean()).filter(testRun -> testRunCanBeDeleted(testRun, lowerBound, reportDAO)).forEach(testRun -> testRunsByUser.computeIfAbsent(testRun.getOwner(), k -> new ArrayList<>()).add(testRun));
testRunsByUser.forEach((owner, testRuns) -> deleteTestRunsAndNotifyOwner(owner, testRuns, testDAO, httpMessenger, slackUserMessenger, externalUrl));
});
}
Aggregations