Prometheus启动异常
1.问题表现
日志报错:java.lang.IllegalArgumentException: Prometheus requires that all meters with the same name have the same set of tag keys. There is already an existing meter containing tag keys [method, status, uri]. The meter you are attempting to register has keys [exception, method, status, uri].
2.分析原因
根据错误描述,Prometheus要求相同的meters 具有相同的标记键集,目前具有了两种标记键集方式( [method, status, uri],[exception, method, status, uri] ),所以会报出异常。
3.查询原因
如果配置文件中没有添加“management.metrics.web.server.auto-time-requests=false”,默认为 开启自动检测所有请求。
源码MetricsProperties类中的内部类:
4. 解决方案
方案一:
配置文件中增加management.metrics.web.server.auto-time-requests=false设置为false(默认为true)