首页  

springboot应用 micrometer-core 版本升级     所属分类 springboot 浏览量 797

private static Map<String,Object> buildTimerInfoMapOne(Timer timer){
		Map<String,Object>  map = new LinkedHashMap<>();
		map.put("count", timer.count());
		map.put("mean", timer.mean(TimeUnit.MILLISECONDS));
		map.put("max", timer.max(TimeUnit.MILLISECONDS));

		map.put("p99", timer.percentile(0.99, TimeUnit.MILLISECONDS));
		map.put("p999", timer.percentile(0.999, TimeUnit.MILLISECONDS));
		map.put("p9999", timer.percentile(0.9999, TimeUnit.MILLISECONDS));
		try {
		    map.put("snapshot", timer.takeSnapshot().toString());
		}catch(Throwable e) {
			map.put("takeSnapshotError", e+"");
		}
		
		return map;
	}


调用报错
java.lang.NoSuchMethodError: io.micrometer.core.instrument.Timer.takeSnapshot()Lio/micrometer/core/instrument/distribution/HistogramSnapshot

arthas 查看类加载信息
sc -d io.micrometer.core.instrument.Timer
micrometer-core-1.0.1.jar

watch xxx.MicrometerUtil buildTimerInfoMapOne  "{params[0],returnObj}"
ts=2021-09-01 18:27:08; [cost=0.116296ms] result=@ArrayList[
    @CompositeTimer[io.micrometer.core.instrument.composite.CompositeTimer@7bdb5ced],
    @LinkedHashMap[isEmpty=false;size=7],
]


CompositeTimer
micrometer-core-1.0.1
micrometer-core-1.7.1

pom.xml

<dependency>
		<groupId>io.micrometer</groupId>
		<artifactId>micrometer-core</artifactId>
		<version>1.7.1</version>
	</dependency>
提示
Overriding managed version 1.0.1 for micrometer-core

在父pom里强制指定版本 ,升级到 1.7.1

    <dependencyManagement>
        <dependencies>
            <dependency>
              <groupId>io.micrometer</groupId>
              <artifactId>micrometer-core</artifactId>
              <version>1.7.1</version>
            </dependency>
    
            <dependency>
                <groupId>cn.tongdun</groupId>
                <artifactId>salaxy-dependencies-bom</artifactId>
                <version>${revision}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>


            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.0.0.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>





上一篇     下一篇
移动通信发展简史

农商银行社保卡及银行卡

躺平那些事

新能源汽车动力电池

银行卡分类

linux启动过程