首页  

SpringBoot的指标数据     所属分类 springboot 浏览量 1124
Micrometer
actuator依赖
/actuator/metrics 端点
JVM 、进程、Tomcat、流量等监控指标

指标由 micrometer  处理 , actuator 依赖 micrometer

org.springframework.boot:spring-boot-starter-actuato

io.micrometer:micrometer-core

/actuator/metrics 
/actuator/metrics/jvm.memory.max

jmx

Micrometer   MeterBinder  

public interface MeterBinder {
    void bindTo(@NonNull MeterRegistry registry);
}

MetricsAutoConfiguration


io.micrometer.core.instrument.MeterRegistry

public class JvmThreadMetrics implements MeterBinder


private final Iterable tags;

    public JvmThreadMetrics() {
        this(emptyList());
    }

    public JvmThreadMetrics(Iterable tags) {
        this.tags = tags;
    }

    @Override
    public void bindTo(MeterRegistry registry) {
        ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();

        Gauge.builder("jvm.threads.peak", threadBean, ThreadMXBean::getPeakThreadCount)
            .tags(tags)
            .description("The peak live thread count since the Java virtual machine started or peak was reset")
            .register(registry);

        Gauge.builder("jvm.threads.daemon", threadBean, ThreadMXBean::getDaemonThreadCount)
            .tags(tags)
            .description("The current number of live daemon threads")
            .register(registry);

        Gauge.builder("jvm.threads.live", threadBean, ThreadMXBean::getThreadCount)
            .tags(tags)
            .description("The current number of live threads including both daemon and non-daemon threads")
            .register(registry);
    }
    
    
    

public class TomcatMetrics implements MeterBinder

上一篇     下一篇
arthas实战之生产环境空指针排查

java并发包JUC简介

身材就是你的名片

cron表达式实例

团队管理的1+4+7法则

springboot @Autowired 注解处理要点