diff --git a/prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmMemoryPoolAllocationMetricsTest.java b/prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmMemoryPoolAllocationMetricsTest.java
index 3a8138baf..2f681ce89 100644
--- a/prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmMemoryPoolAllocationMetricsTest.java
+++ b/prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmMemoryPoolAllocationMetricsTest.java
@@ -47,6 +47,10 @@ void testListenerLogic() {
// Decrease to 17, then increase by 3
listener.handleMemoryPool("TestPool", 17, 20);
assertThat(getCountByPool("test", "TestPool", registry.scrape())).isEqualTo(153);
+
+ // Edge case: before < last (tests diff1 < 0 branch)
+ listener.handleMemoryPool("TestPool", 10, 15);
+ assertThat(getCountByPool("test", "TestPool", registry.scrape())).isEqualTo(158);
}
private double getCountByPool(String metricName, String poolName, MetricSnapshots snapshots) {
diff --git a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/Collector.java b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/Collector.java
index dbd7c36f5..beca6001e 100644
--- a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/Collector.java
+++ b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/Collector.java
@@ -67,8 +67,8 @@ default MetricSnapshot collect(
* and the metric name is excluded.
*
*
- * Returning {@code null} means checks are omitted (registration the metric always succeeds), and
- * the collector is always scraped (the result is dropped after scraping if a name filter is
+ * Returning {@code null} means checks are omitted (registration the metric always succeeds),
+ * and the collector is always scraped (the result is dropped after scraping if a name filter is
* present and the metric name is excluded).
*
*
If your metric has a name that does not change at runtime it is a good idea to overwrite
diff --git a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/MultiCollector.java b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/MultiCollector.java
index e4a224bdf..27ac3e10c 100644
--- a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/MultiCollector.java
+++ b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/MultiCollector.java
@@ -62,9 +62,9 @@ default MetricSnapshots collect(
* and all names are excluded.
*
*
- * Returning an empty list means checks are omitted (registration metric always succeeds), and the
- * collector is always scraped (if a name filter is present and all names are excluded the result
- * is dropped).
+ *
Returning an empty list means checks are omitted (registration metric always succeeds), and
+ * the collector is always scraped (if a name filter is present and all names are excluded the
+ * result is dropped).
*
*
If your collector returns a constant list of metrics that have names that do not change at
* runtime it is a good idea to overwrite this and return the names.
diff --git a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/PrometheusNaming.java b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/PrometheusNaming.java
index 71de5d0b4..4f766fdad 100644
--- a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/PrometheusNaming.java
+++ b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/PrometheusNaming.java
@@ -27,7 +27,7 @@ public class PrometheusNaming {
*
OpenTelemetry: {@code process_runtime_jvm_buffer_count}
*
*
- * We do not treat {@code _count} and {@code _sum} as reserved suffixes here for compatibility
+ * We do not treat {@code _count} and {@code _sum} as reserved suffixes here for compatibility
* with these libraries. However, there is a risk of name conflict if someone creates a gauge
* named {@code my_data_count} and a histogram or summary named {@code my_data}, because the
* histogram or summary will implicitly have a sample named {@code my_data_count}.
@@ -47,9 +47,9 @@ public class PrometheusNaming {
*
The name MUST NOT end with one of the {@link #RESERVED_METRIC_NAME_SUFFIXES}.
*
*
- * If a metric has a {@link Unit}, the metric name SHOULD end with the unit as a suffix. Note that
- * OpenMetrics requires metric names to have their unit as
- * suffix, and we implement this in {@code prometheus-metrics-core}. However, {@code
+ * If a metric has a {@link Unit}, the metric name SHOULD end with the unit as a suffix. Note
+ * that OpenMetrics requires metric names to have their unit
+ * as suffix, and we implement this in {@code prometheus-metrics-core}. However, {@code
* prometheus-metrics-model} does not enforce Unit suffixes.
*
*
Example: If you create a Counter for a processing time with Unit {@link Unit#SECONDS
diff --git a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Unit.java b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Unit.java
index 31a9524e7..6e652af13 100644
--- a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Unit.java
+++ b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Unit.java
@@ -9,8 +9,8 @@
* new Unit("myUnit");
*
*
- * Note that in Prometheus, units are largely based on SI base units (seconds, bytes, joules, grams,
- * meters, ratio, volts, amperes, and Celsius).
+ *
Note that in Prometheus, units are largely based on SI base units (seconds, bytes, joules,
+ * grams, meters, ratio, volts, amperes, and Celsius).
*/
public final class Unit {