使用 Zipkin 导出器的 Opentelemetry 未按预期工作抛出 StatusRuntimeException: UNAVAILABLE: io 异常

问题描述

@H_502_0@我对使用 OpenTelemetry 非常陌生,刚刚尝试将其配置为将跟踪发送到我的 Zipkin 服务器。不幸的是,通过指定 zipkin exporter details 配置代理后,我可以在控制台中看到异常。我使用 Petclic 作为示例弹簧靴并遵循此处的文档 https://github.com/open-telemetry/opentelemetry-java-instrumentation

@H_502_0@这是我用来启动 spring-boot 应用程序的命令(我的 zipkin 服务器在 localhost:9411 上运行):

@H_502_0@java -javaagent:opentelemetry-javaagent-all.jar -Dotel.exporter=zipkin -Dotel.exporter.zipkin.endpoint=localhost:9411 -jar spring-petclinic-2.4.2.jar

@H_502_0@控制台中的异常(它正在尝试连接到 gRpc 导出器而不是 Zipkins):

[opentelemetry.auto.trace 2021-03-07 20:24:15:582 +0530] [IntervalMetricReader-1] WARN io.opentelemetry.expor**ter.otlp.metrics.OtlpGrpcmetricExporter - Failed to export metrics
io.grpc.StatusRuntimeException: UNAVAILABLE: io exception**
        at io.grpc.Status.asRuntimeException(Status.java:534)
        at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:533)
        at io.grpc.internal.ClientCallImpl.cloSEObserver(ClientCallImpl.java:617)
        at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:803)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:782)
        at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
        at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(UnkNown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(UnkNown Source)
        at java.lang.Thread.run(UnkNown Source)
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further @R_227_4045@ion: **localhost/0:0:0:0:0:0:0:1:4317**
Caused by: java.net.ConnectException: Connection refused: no further @R_227_4045@ion
@H_502_0@请你告诉我这有什么问题。

@H_502_0@编辑: 我已经尝试通过 -Dotel.traces.exporter=zipkin 而不是 -Dotel.exporter=zipkin 但没有成功。我只是想通过将这些参数作为 jvm 参数传递来通过 Eclipse 启动我的 Spring Boot 应用程序。 OpenTelemetery 上的每个教程似乎都在使用 Docker 设置。请有人帮忙

解决方法

我有同样的问题,但我用这个 jvm 参数解决了:

-Dotel.traces.exporter=zipkin -Dotel.metrics.exporter=none -Dotel.exporter.zipkin.endpoint=http://localhost:9411/api/v2/spans 可能错误出在 zipkin.endpoint 上,尝试写出整个 url。

问候, 马可

,

在您的命令中,请尝试以下 -Dotel.traces.exporter=zipkin 而不是 -Dotel.exporter=zipkin