本文整理匯總了Java中com.netflix.spectator.gc.GcLogger類的典型用法代碼示例。如果您正苦於以下問題:Java GcLogger類的具體用法?Java GcLogger怎麽用?Java GcLogger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GcLogger類屬於com.netflix.spectator.gc包,在下文中一共展示了GcLogger類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: RegistryInitializer
import com.netflix.spectator.gc.GcLogger; //導入依賴的package包/類
public RegistryInitializer(Registry registry, boolean enableJmxLogging) {
this.registry = registry;
Spectator.globalRegistry().add(registry);
if (enableJmxLogging) {
Jmx.registerStandardMXBeans(registry);
}
gcLogger = new GcLogger();
gcLogger.start(null);
}
示例2: startJvmCollection
import com.netflix.spectator.gc.GcLogger; //導入依賴的package包/類
private void startJvmCollection() {
try {
Jmx.registerStandardMXBeans(sidecarRegistry);
gcLogger = new GcLogger();
gcLogger.start(null);
} catch (Exception e) {
LOGGER.error("failed to start collection of jvm stats", e);
throw e;
}
}
示例3: premain
import com.netflix.spectator.gc.GcLogger; //導入依賴的package包/類
/** Entry point for the agent. */
public static void premain(String arg, Instrumentation instrumentation) throws Exception {
// Setup logging
Config config = loadConfig(arg);
createDependencyProperties(config);
// Setup Registry
AtlasRegistry registry = new AtlasRegistry(Clock.SYSTEM, new AgentAtlasConfig(config));
// Add to global registry for http stats and GC logger
Spectator.globalRegistry().add(registry);
// Enable GC logger
GcLogger gcLogger = new GcLogger();
if (config.getBoolean("collection.gc")) {
gcLogger.start(null);
}
// Enable JVM data collection
if (config.getBoolean("collection.jvm")) {
Jmx.registerStandardMXBeans(registry);
}
// Enable JMX query collection
if (config.getBoolean("collection.jmx")) {
for (Config cfg : config.getConfigList("jmx.mappings")) {
registry.register(new JmxMeter(registry, JmxConfig.from(cfg)));
}
}
// Start collection for the registry
registry.start();
// Shutdown registry
Runtime.getRuntime().addShutdownHook(new Thread(registry::stop, "spectator-agent-shutdown"));
}