当前位置: 首页>>代码示例>>Java>>正文


Java GarbageCollectorMetricSet类代码示例

本文整理汇总了Java中com.spotify.metrics.jvm.GarbageCollectorMetricSet的典型用法代码示例。如果您正苦于以下问题:Java GarbageCollectorMetricSet类的具体用法?Java GarbageCollectorMetricSet怎么用?Java GarbageCollectorMetricSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GarbageCollectorMetricSet类属于com.spotify.metrics.jvm包,在下文中一共展示了GarbageCollectorMetricSet类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.spotify.metrics.jvm.GarbageCollectorMetricSet; //导入依赖的package包/类
public static void main(final String[] args) throws Exception {
    registry.register(MetricId.build("jvm-memory"), new MemoryUsageGaugeSet());
    registry.register(MetricId.build("jvm-gc"), new GarbageCollectorMetricSet());
    registry.register(MetricId.build("jvm-threads"), new ThreadStatesMetricSet());
    registry.register(MetricId.build("jvm-cpu"), CpuGaugeSet.create());
    registry.register(MetricId.build("jvm-fd-ratio"), new FileDescriptorGaugeSet());

    final FastForwardReporter reporter = FastForwardReporter
        .forRegistry(registry)
        .prefix(APP_PREFIX)
        .schedule(TimeUnit.SECONDS, 5)
        .build();

    reporter.start();

    System.out.println("Sending jvm metrics...");
    System.in.read();

    reporter.stop();
}
 
开发者ID:spotify,项目名称:semantic-metrics,代码行数:21,代码来源:JvmExample.java

示例2: setupStatistics

import com.spotify.metrics.jvm.GarbageCollectorMetricSet; //导入依赖的package包/类
private static Statistics setupStatistics() throws IOException {
    final String key = System.getProperty("ffwd.key", "ffwd-java");

    final SemanticMetricRegistry registry = new SemanticMetricRegistry();
    final SemanticCoreStatistics statistics = new SemanticCoreStatistics(registry);

    final MetricId gauges = MetricId.build();

    registry.register(gauges, new ThreadStatesMetricSet());
    registry.register(gauges, new GarbageCollectorMetricSet());
    registry.register(gauges, new MemoryUsageGaugeSet());

    final MetricId metric = MetricId.build(key);

    final FastForwardReporter ffwd = FastForwardReporter
        .forRegistry(registry)
        .schedule(TimeUnit.SECONDS, 30)
        .prefix(metric)
        .build();

    ffwd.start();

    return new Statistics(ffwd, statistics);
}
 
开发者ID:spotify,项目名称:ffwd,代码行数:25,代码来源:FastForwardAgent.java

示例3: life

import com.spotify.metrics.jvm.GarbageCollectorMetricSet; //导入依赖的package包/类
@Provides
@SemanticStatisticsScope
public LifeCycle life(
    AsyncFramework async, SemanticMetricRegistry registry, ServiceInfo info,
    LifeCycleRegistry lifeCycleRegistry
) {
    final MetricId gauges = MetricId.build();

    registry.register(gauges, new ThreadStatesMetricSet());
    registry.register(gauges, new GarbageCollectorMetricSet());
    registry.register(gauges, new MemoryUsageGaugeSet());

    final MetricId metric =
        MetricId.build("heroic").tagged("service", "heroic", "heroic_id", info.getId());

    final FastForwardReporter reporter;

    try {
        reporter = FastForwardReporter
            .forRegistry(registry)
            .schedule(TimeUnit.SECONDS, 30)
            .prefix(metric)
            .build();
    } catch (IOException e) {
        throw new RuntimeException("Failed to configure reporter", e);
    }

    return () -> {
        final LifeCycleRegistry scope = lifeCycleRegistry.scoped("ffwd-reporter");

        scope.start(() -> async.call(() -> {
            reporter.start();
            return null;
        }));

        scope.stop(() -> async.call(() -> {
            reporter.stop();
            return null;
        }));
    };
}
 
开发者ID:spotify,项目名称:heroic,代码行数:42,代码来源:SemanticStatisticsModule.java


注:本文中的com.spotify.metrics.jvm.GarbageCollectorMetricSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。