}
@Override
- public void destroy() {
+ public void after() {
dbMigrationCompletedSteps = null;
}
}
}
@Override
- public void destroy() {
+ public void after() {
dbMigrationSuccess = null;
}
}
}
@Override
- public void destroy() {
+ public void after() {
dbMigrationTotalTime = null;
}
}
throw new IllegalStateException("Not implemented");
}
- default void destroy() {
+ /**
+ * This method will be executed for every telemetry provider after telemetry metrics are sent. This is important for some telemetry
+ * providers, more specifically, those adhoc metrics which are usually to be sent as once off values as these values are typically
+ * stored in memory. The most common use case would be to clear the data.
+ */
+ default void after() {
// this method does nothing by default it is used to perform cleanup tasks if needed
}
}
context.getMetricsToUpdate().forEach(toUpdate -> dbClient.telemetryMetricsSentDao().upsert(dbSession, toUpdate));
dbSession.commit();
}
+
+ // Finally, run after tasks for all providers
+ telemetryMetricsLoader.runProviderAfterTasks();
}
private void uploadLegacyTelemetry() throws IOException {
}
}
+ public void runProviderAfterTasks() {
+ this.providers.forEach(TelemetryDataProvider::after);
+ }
+
private Set<BaseMessage> retrieveBaseMessages(Map<Dimension, Set<Metric>> metrics) {
return metrics.entrySet().stream()
// we do not want to send payloads with zero metrics