Skip to content
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

Remove internal Hotspot metrics #1156

Merged
merged 9 commits into from
Sep 4, 2024

This file was deleted.

29 changes: 0 additions & 29 deletions spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/Jmx.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import com.netflix.spectator.api.Gauge;
import com.netflix.spectator.api.Registry;
import com.netflix.spectator.api.Statistic;
import com.netflix.spectator.api.patterns.PolledMeter;
import com.typesafe.config.Config;

Expand Down Expand Up @@ -57,7 +56,6 @@ public static void registerStandardMXBeans(Registry registry) {
monitorThreadMXBean(registry);
monitorCompilationMXBean(registry);
}
maybeRegisterHotspotInternal(registry);

for (MemoryPoolMXBean mbean : ManagementFactory.getMemoryPoolMXBeans()) {
registry.register(new MemoryPoolMeter(registry, mbean));
Expand Down Expand Up @@ -103,33 +101,6 @@ private static void monitorCompilationMXBean(Registry registry) {
}
}

private static void maybeRegisterHotspotInternal(Registry registry) {
if (HotspotRuntime.isSupported()) {
// The safepointCount is reported as the count for both the safepointTime and
// safepointSyncTime. This should allow the metrics to work as normal timers and
// for the user to compute the average time spent per operation.
Object mbean = HotspotRuntime.getRuntimeMBean();

PolledMeter.using(registry)
.withName("jvm.hotspot.safepointTime")
.withTag(Statistic.count)
.monitorMonotonicCounter(mbean, b -> HotspotRuntime.getSafepointCount());
PolledMeter.using(registry)
.withName("jvm.hotspot.safepointTime")
.withTag(Statistic.totalTime)
.monitorMonotonicCounterDouble(mbean, b -> HotspotRuntime.getSafepointTime() / 1000.0);

PolledMeter.using(registry)
.withName("jvm.hotspot.safepointSyncTime")
.withTag(Statistic.count)
.monitorMonotonicCounter(mbean, b -> HotspotRuntime.getSafepointCount());
PolledMeter.using(registry)
.withName("jvm.hotspot.safepointSyncTime")
.withTag(Statistic.totalTime)
.monitorMonotonicCounterDouble(mbean, b -> HotspotRuntime.getSafepointSyncTime() / 1000.0);
}
}

/**
* Add meters based on configured JMX queries. See the {@link JmxConfig} class for more
* details.
Expand Down

This file was deleted.

Loading