Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch all thrown stuff in AsyncUpdater #36

Merged
merged 4 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ This software includes third party software subject to the following licenses:
Prometheus Metrics Exposition Formats under The Apache Software License, Version 2.0
Prometheus Metrics Model under The Apache Software License, Version 2.0
Prometheus Metrics Tracer Common under The Apache Software License, Version 2.0
Shaded Protobuf under The Apache Software License, Version 2.0

40 changes: 23 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,36 @@

<properties>
<maven.compiler.release>11</maven.compiler.release>
<logback.version>1.4.14</logback.version>
<logback.version>1.5.17</logback.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-bom</artifactId>
<version>1.13.1</version>
<version>1.14.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-bom</artifactId>
<version>2.0.17</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.11.0-M2</version>
<version>5.12.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-bom</artifactId>
<version>5.12.0</version>
<version>5.16.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -103,7 +110,6 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.13</version>
<optional>true</optional>
</dependency>

Expand All @@ -125,7 +131,7 @@
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -148,7 +154,7 @@
<dependency>
<groupId>no.digipost</groupId>
<artifactId>digg</artifactId>
<version>0.34</version>
<version>0.36</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -158,15 +164,15 @@
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.3.2</version>
<version>3.4.1</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<version>3.14.0</version>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
Expand All @@ -190,31 +196,31 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<version>3.5.2</version>
<configuration>
<argLine>-Djava.util.logging.config.file=/logging.properties</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
<version>3.8.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.2</version>
<version>3.1.4</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
<version>3.1.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.16.2</version>
<version>2.18.0</version>
</plugin>
<plugin>
<groupId>org.jasig.maven</groupId>
Expand All @@ -224,12 +230,12 @@
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>4.5</version>
<version>4.6</version>
</plugin>
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
<version>0.21.2</version>
<version>0.23.1</version>
<configuration>
<parameter>
<includes>
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/no/digipost/monitoring/async/AsyncUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.util.logging.Level;
import java.util.logging.Logger;

import static java.util.logging.Level.WARNING;

class AsyncUpdater implements Runnable {

private static final Logger LOG = Logger.getLogger(AsyncUpdater.class.getName());
Expand All @@ -46,8 +47,10 @@ public void run() {
updateNewValues.run();
lastUpdate = clock.instant();
lastUpdateSuccessful = true;
} catch (Exception e) {
LOG.log(Level.WARNING, "Unexpected exception in updater '" + updaterName + "' while updating metrics.", e);
} catch (Throwable e) {
LOG.log(WARNING,
"Unexpected exception in updater '" + updaterName + "' while updating metrics: " +
e.getClass().getSimpleName() + " " + e.getMessage(), e);
lastUpdateSuccessful = false;
}
}
Expand Down
Loading