Skip to content

Commit

Permalink
Add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
kathy-t committed Jan 19, 2024
1 parent c66bb0d commit 125f9d7
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicInteger;
import org.slf4j.Logger;
Expand Down Expand Up @@ -110,12 +111,16 @@ private void aggregateMetricsForDirectory(S3DirectoryInfo directoryInfo, Extende
}

try {
getAggregatedMetrics(allSubmissions).ifPresent(metrics -> {
extendedGa4GhApi.aggregatedMetricsPut(metrics, platform, toolId, versionName);
LOG.info("Aggregated metrics for tool ID {}, version {}, platform {} from directory {}", toolId, versionName, platform, versionS3KeyPrefix);
allMetrics.add(metrics);
Optional<Metrics> aggregatedPlatformMetric = getAggregatedMetrics(allSubmissions);
if (aggregatedPlatformMetric.isPresent()) {
extendedGa4GhApi.aggregatedMetricsPut(aggregatedPlatformMetric.get(), platform, toolId, versionName);
LOG.info("Aggregated metrics for tool ID {}, version {}, platform {} from directory {}", toolId, versionName, platform,
versionS3KeyPrefix);
allMetrics.add(aggregatedPlatformMetric.get());
numberOfMetricsSubmitted.incrementAndGet();
});
} else {
LOG.error("Error aggregating metrics for tool ID {}, version {}, platform {} from directory {}", toolId, versionName, platform, versionS3KeyPrefix);

Check warning on line 122 in metricsaggregator/src/main/java/io/dockstore/metricsaggregator/MetricsAggregatorS3Client.java

View check run for this annotation

Codecov / codecov/patch

metricsaggregator/src/main/java/io/dockstore/metricsaggregator/MetricsAggregatorS3Client.java#L122

Added line #L122 was not covered by tests
}
} catch (Exception e) {
LOG.error("Error aggregating metrics: Could not put all executions from directory {}", versionS3KeyPrefix, e);
numberOfMetricsSkipped.incrementAndGet();

Check warning on line 126 in metricsaggregator/src/main/java/io/dockstore/metricsaggregator/MetricsAggregatorS3Client.java

View check run for this annotation

Codecov / codecov/patch

metricsaggregator/src/main/java/io/dockstore/metricsaggregator/MetricsAggregatorS3Client.java#L124-L126

Added lines #L124 - L126 were not covered by tests
Expand All @@ -139,6 +144,7 @@ private void aggregateMetricsForDirectory(S3DirectoryInfo directoryInfo, Extende
// Continue aggregating metrics for other directories
}
} else {
LOG.error("Error aggregating metrics for directory {}: no platform metrics aggregated", versionS3KeyPrefix);
numberOfMetricsSkipped.incrementAndGet();

Check warning on line 148 in metricsaggregator/src/main/java/io/dockstore/metricsaggregator/MetricsAggregatorS3Client.java

View check run for this annotation

Codecov / codecov/patch

metricsaggregator/src/main/java/io/dockstore/metricsaggregator/MetricsAggregatorS3Client.java#L147-L148

Added lines #L147 - L148 were not covered by tests
}
numberOfDirectoriesProcessed.incrementAndGet();
Expand Down Expand Up @@ -170,7 +176,7 @@ private ExecutionsRequestBody getExecutions(String toolId, String versionName, S
try {
executionsFromOneSubmission = GSON.fromJson(fileContent, ExecutionsRequestBody.class);
} catch (JsonSyntaxException e) {
LOG.error("Could not read execution(s) from S3 key {}, ignoring file", metricsData.s3Key());
LOG.error("Could not read execution(s) from S3 key {}, ignoring file", metricsData.s3Key(), e);

Check warning on line 179 in metricsaggregator/src/main/java/io/dockstore/metricsaggregator/MetricsAggregatorS3Client.java

View check run for this annotation

Codecov / codecov/patch

metricsaggregator/src/main/java/io/dockstore/metricsaggregator/MetricsAggregatorS3Client.java#L179

Added line #L179 was not covered by tests
continue;
}

Expand Down

0 comments on commit 125f9d7

Please sign in to comment.