mlbiscoc commented on code in PR #4907:
URL: https://github.com/apache/solr/pull/4907#discussion_r4030718979
##########
solr/core/src/test/org/apache/solr/metrics/JvmMetricsTest.java:
##########
@@ -138,6 +142,32 @@ public void testSystemMemoryMetrics() {
metricNames.contains("jvm_system_memory_bytes"));
}
+ @Test
+ public void testNoDuplicateJvmMemoryMetrics() {
+ // Guards against the java8/java17 RuntimeMetrics split emitting the same
series twice (each
+ // scope reporting e.g. jvm.memory.committed with identical labels), which
is what motivated
+ // migrating to the unified opentelemetry-runtime-telemetry module.
+ FilterablePrometheusMetricReader reader =
+ solrTestRule
+ .getJetty()
+ .getCoreContainer()
+ .getMetricManager()
+ .getPrometheusMetricReader("solr.jvm");
+ MetricSnapshots snapshots = reader.collect();
+
+ for (MetricSnapshot snapshot : snapshots) {
+ Set<Labels> seen = new HashSet<>();
+ for (DataPointSnapshot dataPoint : snapshot.getDataPoints()) {
+ assertTrue(
+ "Duplicate series for metric "
+ + snapshot.getMetadata().getPrometheusName()
+ + " with labels "
+ + dataPoint.getLabels(),
+ seen.add(dataPoint.getLabels()));
+ }
Review Comment:
I don't think this test is actually testing to catch the bug. I recommend
doing TDD for this then make the change to confirm we actually fix it. This is
a sample what the duplicate looks like:
```
jvm_memory_used_bytes{...,otel_scope_name="io.opentelemetry.runtime-telemetry-java8"}
jvm_memory_used_bytes{...,otel_scope_name="io.opentelemetry.runtime-telemetry-java17"}
```
The reason is that otel_scope_name is part of the label set that makes it a
"duplicate".
##########
solr/core/src/test/org/apache/solr/metrics/JvmMetricsTest.java:
##########
@@ -138,6 +142,32 @@ public void testSystemMemoryMetrics() {
metricNames.contains("jvm_system_memory_bytes"));
}
+ @Test
+ public void testNoDuplicateJvmMemoryMetrics() {
+ // Guards against the java8/java17 RuntimeMetrics split emitting the same
series twice (each
+ // scope reporting e.g. jvm.memory.committed with identical labels), which
is what motivated
+ // migrating to the unified opentelemetry-runtime-telemetry module.
Review Comment:
This comment looks unnecessary. We are just testing no duplicates. No need
to reference past dependency.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]