Skip to content

Commit

Permalink
Document which JVM metric names have changed with 1.x
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Stäber <fabian@fstab.de>
  • Loading branch information
fstab committed Mar 8, 2024
1 parent 3fdba97 commit 8bb7544
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/content/migration/simpleclient.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,35 @@ counter.labelValues("/hello-world").inc();
Reasons why we changed the API: Changing the package names was a necessity because the previous package names were incompatible with the Java module system. However, renaming packages requires changing code anyway, so we decided to clean up some things. For example, the name `builder()` for a builder method is very common in the Java ecosystem, it's used in Spring, Lombok, and so on. So naming the method `builder()` makes the Prometheus library more aligned with the broader Java ecosystem.

If you are using the low level `Collector` API directly, you should have a look at the new callback metric types, see [/getting-started/callbacks/](../../getting-started/callbacks/). Chances are good that the new callback metrics have an easier way to achieve what you need than the old 0.16.0 code.

JVM Metrics
-----------

Version 0.16.0 provided the `simpleclient_hotspot` module for exposing built-in JVM metrics:

```java
DefaultExports.initialize();
```

With version 1.0.0 these metrics moved to the `prometheus-metrics-instrumentation-jvm` module and are initialized as follows:

```java
JvmMetrics.builder().register();
```

A full list of the available JVM metrics can be found on [/instrumentation/jvm](../../instrumentation/jvm/).

Most JVM metric names remained the same, except for a few cases where the old 0.16.0 metric names were not compliant with the [OpenMetrics](https://openmetrics.io) specification. OpenMetrics requires the unit to be a suffix, so we renamed metrics where the unit was in the middle of the metric name and moved the unit to the end of the metric name. The following metric names changed:

* `jvm_memory_bytes_committed` -> `jvm_memory_committed_bytes`
* `jvm_memory_bytes_init` -> `jvm_memory_init_bytes`
* `jvm_memory_bytes_max` -> `jvm_memory_max_bytes`
* `jvm_memory_pool_bytes_committed` -> `jvm_memory_pool_committed_bytes`
* `jvm_memory_pool_bytes_init` -> `jvm_memory_pool_init_bytes`
* `jvm_memory_pool_bytes_max` -> `jvm_memory_pool_max_bytes`
* `jvm_memory_pool_bytes_used` -> `jvm_memory_pool_used_bytes`
* `jvm_memory_pool_collection_bytes_committed` -> `jvm_memory_pool_collection_committed_bytes`
* `jvm_memory_pool_collection_bytes_init` -> `jvm_memory_pool_collection_init_bytes`
* `jvm_memory_pool_collection_bytes_max` -> `jvm_memory_pool_collection_max_bytes`
* `jvm_memory_pool_collection_bytes_used` -> `jvm_memory_pool_collection_used_bytes`
* `jvm_info` -> `jvm_runtime_info`

0 comments on commit 8bb7544

Please sign in to comment.