spring boot 2.x 是通过management.endpoints.web.exposure.include=health,info,env,metrics,prometheus
方式暴露,需要去掉启动类上的@EnablePrometheusEndpoint注解,应用启动后,ActivitySimulator线程类中模拟的请求不起作用,在应用的/actuator/prometheus端点无法看到ActivitySimulator线程类模拟请求的一些指标,请问老师这个线程请求模拟器必须得配合启动类上的@EnablePrometheusEndpoint注解才生效么?
作者回复: 我实验用spring boot版本是1.5,建议也用这个版本完成实验。spring boot 2.x我认为运行实验也没有问题,只是配置可能需要调整,建议参考官方文档。ActivitySimulator没有特别要求,就是一个线程,很简单,无论你用哪种方法,只要让它异步跑起来就好(注控制器里对它有引用)。