Spring boot 启动zipkin服务器时出错:普罗米修斯要求具有相同名称的所有仪表具有相同的标记密钥集

Spring boot 启动zipkin服务器时出错:普罗米修斯要求具有相同名称的所有仪表具有相同的标记密钥集,spring-boot,spring-cloud,spring-cloud-sleuth,zipkin,Spring Boot,Spring Cloud,Spring Cloud Sleuth,Zipkin,我们在其他微服务中有slueth,我们希望将数据发送到zipkin服务器以进行整合日志记录。我正在尝试启动我的zipkin服务器。我收到以下错误: 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 named 'http_server_

我们在其他微服务中有
slueth
,我们希望将数据发送到zipkin服务器以进行整合日志记录。我正在尝试启动我的zipkin服务器。我收到以下错误:

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 named 'http_server_requests_seconds' containing tag keys [exception, method, status, uri]. The meter you are attempting to register has keys [method, status, uri].
    at io.micrometer.prometheus.PrometheusMeterRegistry.lambda$collectorByName$9(PrometheusMeterRegistry.java:360) ~[micrometer-registry-prometheus-1.0.8.jar:1.0.8]
    at java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1877) ~[na:1.8.0_231]
    at io.micrometer.prometheus.PrometheusMeterRegistry.collectorByName(PrometheusMeterRegistry.java:347) ~[micrometer-registry-prometheus-1.0.8.jar:1.0.8]
    at io.micrometer.prometheus.PrometheusMeterRegistry.newTimer(PrometheusMeterRegistry.java:160) ~[micrometer-registry-prometheus-1.0.8.jar:1.0.8]
    at io.micrometer.core.instrument.MeterRegistry.lambda$timer$2(MeterRegistry.java:258) ~[micrometer-core-1.0.8.jar:1.0.8]
    at io.micrometer.core.instrument.MeterRegistry.getOrCreateMeter(MeterRegistry.java:567) ~[micrometer-core-1.0.8.jar:1.0.8]
    at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:529) ~[micrometer-core-1.0.8.jar:1.0.8]
    at io.micrometer.core.instrument.MeterRegistry.timer(MeterRegistry.java:256) ~[micrometer-core-1.0.8.jar:1.0.8]
    at io.micrometer.core.instrument.Timer$Builder.register(Timer.java:447) ~[micrometer-core-1.0.8.jar:1.0.8]
    at zipkin2.autoconfigure.prometheus.ZipkinPrometheusMetricsAutoConfiguration$HttpRequestDurationHandler.lambda$handleRequest$0(ZipkinPrometheusMetricsAutoConfiguration.java:78) ~[zipkin-autoconfigure-metrics-prometheus-2.11.7.jar:na]
    at io.undertow.server.HttpServerExchange.invokeExchangeCompleteListeners(HttpServerExchange.java:1276) ~[undertow-core-1.4.26.Final.jar:1.4.26.Final]
    at io.undertow.server.HttpServerExchange.terminateResponse(HttpServerExchange.java:1558) ~[undertow-core-1.4.26.Final.jar:1.4.26.Final]
    at io.undertow.server.Connectors.terminateResponse(Connectors.java:143) ~[undertow-core-1.4.26.Final.jar:1.4.26.Final]
    at io.undertow.server.protocol.http.ServerFixedLengthStreamSinkConduit.channelFinished(ServerFixedLengthStreamSinkConduit.java:58) ~[undertow-core-1.4.26.Final.jar:1.4.26.Final]
    at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.exitFlush(AbstractFixedLengthStreamSinkConduit.java:316) ~[undertow-core-1.4.26.Final.jar:1.4.26.Final]
    at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.flush(AbstractFixedLengthStreamSinkConduit.java:234) ~[undertow-core-1.4.26.Final.jar:1.4.26.Final]
    at org.xnio.conduits.ConduitStreamSinkChannel.flush(ConduitStreamSinkChannel.java:162) ~[xnio-api-3.3.8.Final.jar:3.3.8.Final]
    at io.undertow.channels.DetachableStreamSinkChannel.flush(DetachableStreamSinkChannel.java:119) ~[undertow-core-1.4.26.Final.jar:1.4.26.Final]
    at org.xnio.channels.Channels.flushBlocking(Channels.java:63) ~[xnio-api-3.3.8.Final.jar:3.3.8.Final]
    at io.undertow.servlet.spec.ServletOutputStreamImpl.close(ServletOutputStreamImpl.java:617) ~[undertow-servlet-1.4.26.Final.jar:1.4.26.Final]
    at io.undertow.servlet.spec.HttpServletResponseImpl.closeStreamAndWriter(HttpServletResponseImpl.java:481) ~[undertow-servlet-1.4.26.Final.jar:1.4.26.Final]
我尝试使用sleuth和zipkin的旧版本,但出现冲突,spring应用程序无法启动 我们无法看到Zipkin用户界面。 而
pom.xml
类似于:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example.zipkin.server</groupId>
    <artifactId>zipkin-server</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>zipkin-server</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.7.RELEASE</version>
        <relativePath/> 
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.zipkin.java</groupId>
            <artifactId>zipkin-server</artifactId>
            <version>2.11.7</version>
        </dependency>

        <dependency>
            <groupId>io.zipkin.java</groupId>
            <artifactId>zipkin-autoconfigure-ui</artifactId>
            <version>2.11.7</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

4.0.0
com.example.zipkin.server
zipkin服务器
0.0.1-快照
罐子
zipkin服务器
SpringBoot的演示项目
org.springframework.boot
spring启动程序父级
2.0.7.1发布
UTF-8
UTF-8
1.8
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧靴开发工具
运行时
org.springframework.boot
弹簧起动试验
测试
io.zipkin.java
zipkin服务器
2.11.7
io.zipkin.java
zipkin自动配置用户界面
2.11.7
org.springframework.boot
springbootmaven插件

任何建议都会有帮助。

您应该创建application.properties文件,然后添加以下内容

您的application.properties:

server.port:9411 // Not Required
management.metrics.web.server.auto-time-requests=false //Required
你的主要班级:

import zipkin.server.EnableZipkinServer;

@EnableZipkinServer
@SpringBootApplication
public class ZipkinServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ZipkinServerApplication.class, args);

    }

}
您的Pom.xml:

 <project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <artifactId>zipkin-server</artifactId>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.7.RELEASE</version>
        <relativePath />
    </parent>

    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.zipkin.java</groupId>
            <artifactId>zipkin-server</artifactId>
            <version>2.11.7</version>
        </dependency>

        <dependency>
            <groupId>io.zipkin.java</groupId>
            <artifactId>zipkin-autoconfigure-ui</artifactId>
            <version>2.11.7</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

你的课堂路径上没有侦探。谢谢@marcin grzejszczak。我们在项目中添加了SpringCloudStarterSleuth和SpringCloudStarterZipkin依赖项。我们还需要做什么?要在类路径中添加slueth,请阅读文档并检查参考示例,无需构建自定义zipkin服务器:
http://localhost:9411/zipkin