Skip to content

Commit 8bdd81f

Browse files
authored
JAVA-2944: Upgrade MicroProfile Metrics to 3.0 (#1551)
1 parent 7157f53 commit 8bdd81f

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

changelog/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
<!-- Note: contrary to 3.x, insert new entries *first* in their section -->
44

5+
### 4.12.0 (in progress)
6+
7+
- [improvement] JAVA-2944: Upgrade MicroProfile Metrics to 3.0
8+
59
### 4.11.2 (in progress)
610

711
- [bug] JAVA-2945: Reinstate InternalDriverContext.getNodeFilter method

metrics/microprofile/src/main/java/com/datastax/oss/driver/internal/metrics/microprofile/MicroProfileMetricUpdater.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.datastax.oss.driver.internal.core.metrics.AbstractMetricUpdater;
2121
import com.datastax.oss.driver.internal.core.metrics.MetricId;
2222
import edu.umd.cs.findbugs.annotations.Nullable;
23+
import java.time.Duration;
2324
import java.util.Set;
2425
import java.util.concurrent.ConcurrentHashMap;
2526
import java.util.concurrent.ConcurrentMap;
@@ -75,7 +76,7 @@ public void markMeter(MetricT metric, @Nullable String profileName, long amount)
7576
public void updateTimer(
7677
MetricT metric, @Nullable String profileName, long duration, TimeUnit unit) {
7778
if (isEnabled(metric, profileName)) {
78-
getOrCreateTimerFor(metric).update(duration, unit);
79+
getOrCreateTimerFor(metric).update(Duration.ofNanos(unit.toNanos(duration)));
7980
}
8081
}
8182

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,12 @@
416416
<dependency>
417417
<groupId>org.eclipse.microprofile.metrics</groupId>
418418
<artifactId>microprofile-metrics-api</artifactId>
419-
<version>2.3.3</version>
419+
<version>3.0</version>
420420
</dependency>
421421
<dependency>
422422
<groupId>io.smallrye</groupId>
423423
<artifactId>smallrye-metrics</artifactId>
424-
<version>2.4.6</version>
424+
<version>3.0.3</version>
425425
</dependency>
426426
<dependency>
427427
<groupId>io.projectreactor</groupId>

upgrade_guide/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
## Upgrade guide
22

3+
### 4.12.0
4+
5+
#### MicroProfile Metrics upgraded to 3.0
6+
7+
The MicroProfile Metrics library has been upgraded from version 2.4 to 3.0. Since this upgrade
8+
involves backwards-incompatible binary changes, users of this library and of the
9+
`java-driver-metrics-microprofile` module are required to take the appropriate action:
10+
11+
* If your application is still using MicroProfile Metrics < 3.0, you can still upgrade the core
12+
driver to 4.12, but you now must keep `java-driver-metrics-microprofile` in version 4.11 or lower,
13+
as newer versions will not work.
14+
15+
* If your application is using MicroProfile Metrics >= 3.0, then you must upgrade to driver 4.12 or
16+
higher, as previous versions of `java-driver-metrics-microprofile` will not work.
17+
318
### 4.11.0
419

520
#### Native protocol V5 is now production-ready

0 commit comments

Comments
 (0)