-
Notifications
You must be signed in to change notification settings - Fork 1.1k
jvm.gc.live.data.size and max not updating for optavgpause/optthruput collectors
#2874
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,6 @@ | |
| import static org.assertj.core.api.Assertions.assertThat; | ||
| import static org.assertj.core.api.Assertions.within; | ||
| import static org.awaitility.Awaitility.await; | ||
| import static org.junit.jupiter.api.Assumptions.assumeTrue; | ||
|
|
||
| /** | ||
| * Tests for {@link JvmGcMetrics}. | ||
|
|
@@ -65,13 +64,18 @@ void noJvmImplementationSpecificApiSignatures() { | |
| } | ||
|
|
||
| @Test | ||
| void metersAreBound() { | ||
| assertThat(registry.find("jvm.gc.live.data.size").gauge()).isNotNull(); | ||
| assertThat(registry.find("jvm.gc.memory.allocated").counter()).isNotNull(); | ||
| assertThat(registry.find("jvm.gc.max.data.size").gauge().value()).isGreaterThan(0); | ||
| void gcMetricsAvailableAfterGc() { | ||
| System.gc(); | ||
| await().timeout(200, TimeUnit.MILLISECONDS).alias("NotificationListener takes time after GC") | ||
| .untilAsserted(() -> | ||
| assertThat(registry.find("jvm.gc.live.data.size").gauge().value()).isPositive()); | ||
| assertThat(registry.find("jvm.gc.memory.allocated").counter().count()).isPositive(); | ||
|
||
| assertThat(registry.find("jvm.gc.max.data.size").gauge().value()).isPositive(); | ||
|
|
||
| assumeTrue(binder.isGenerationalGc); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When the condition failed, the whole test was marked as skipped, but if we want to use this same test for generational and non-generational collectors, we should run the part of this test before here for both and report it as passed (not skipped) for non-generational collectors if all assertions passed before here. |
||
| assertThat(registry.find("jvm.gc.memory.promoted").counter()).isNotNull(); | ||
| if (!binder.isGenerationalGc) { | ||
| return; | ||
| } | ||
| assertThat(registry.find("jvm.gc.memory.promoted").counter().count()).isPositive(); | ||
| } | ||
|
|
||
| @Test | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By forcing a GC and waiting for the notification listener to update metrics, this test does a much better job of ensuring expected metrics are available for the configured collector.