private void registerMetrics( Application application, MetricRegistry metrics )
{
Config config = application.config().atKey( "metrics" );
// JVM Meters
if( config.bool( "jvm.bufferpools.enabled" ) )
{
metrics.register( "jvm.bufferpools", new BufferPoolMetricSet( getPlatformMBeanServer() ) );
}
if( config.bool( "jvm.threadstates.enabled" ) )
{
metrics.register( "jvm.threadstates", new ThreadStatesGaugeSet() );
}
if( config.bool( "jvm.classloading.enabled" ) )
{
metrics.register( "jvm.classloading", new ClassLoadingGaugeSet() );
}
if( config.bool( "jvm.garbagecollection.enabled" ) )
{
metrics.register( "jvm.garbagecollection", new GarbageCollectorMetricSet() );
}
if( config.bool( "jvm.memory.enabled" ) )
{
metrics.register( "jvm.memory", new MemoryUsageGaugeSet() );
}
if( config.bool( "jvm.filedescriptors.enabled" ) )
{
metrics.register( "jvm.filedescriptors.ratio", new FileDescriptorRatioGauge() );
}
// Connection & HTTP Metrics
requestTimers = new ConcurrentHashMap<>();
eventRegistration = application.events().registerListener(
new EventListener(
metrics,
requestTimers,
config.bool( "http.connections.enabled" ),
config.bool( "http.requests.enabled" ),
config.bool( "http.success.enabled" ),
config.bool( "http.redirections.enabled" ),
config.bool( "http.client_errors.enabled" ),
config.bool( "http.server_errors.enabled" ),
config.bool( "http.unknown.enabled" )
)
);
}
MetricsPlugin.java 文件源码
java
阅读 40
收藏 0
点赞 0
评论 0
项目:werval
作者:
评论列表
文章目录