Skip to content

Commit

Permalink
Check whether ScheduledReporter ist started before reporting metrics …
Browse files Browse the repository at this point in the history
…one last time
  • Loading branch information
ummels authored Jun 16, 2024
1 parent 1e165e1 commit 0f9a4f0
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,13 @@ public void stop() {
executor.shutdown(); // Disable new tasks from being submitted
}

try {
report(); // Report metrics one last time
} catch (Exception e) {
LOG.warn("Final reporting of metrics failed.", e);
if (this.scheduledFuture != null) {
// Reporter started, try to report metrics one last time
try {
report();
} catch (Exception e) {
LOG.warn("Final reporting of metrics failed.", e);
}
}

if (shutdownExecutorOnStop) {
Expand Down

0 comments on commit 0f9a4f0

Please sign in to comment.