本文整理汇总了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"));
}