英文:
OpenTelemetry SDK: Failed to export spans. The request could not be executed. Full error message: FRAME_SIZE_ERROR: 4740180
问题
我尝试通过Otel-Collector
将跨度导出到HoneyComb
。
使用下面的Otel-collector配置,我可以将测试Trace
以POST
的方式发送到HoneyComb UI
,如下所示:
curl -i http://localhost:4318/v1/traces -X POST -H "Content-Type: application/json" -d @span.json
我尝试过的Otel-Collector
版本如下:
receivers:
otlp:
protocols:
grpc:
http:
exporters:
logging:
loglevel: debug
otlphttp:
endpoint: "https://api.honeycomb.io"
headers:
"x-honeycomb-team": "YOUR_API_KEY"
"x-honeycomb-dataset": "YOUR_DATASET"
processors:
batch:
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [logging, otlphttp]
或者
receivers:
otlp:
protocols:
grpc:
http:
exporters:
logging:
loglevel: debug
otlp:
endpoint: "http://api.honeycomb.io:443" # 甚至只需 api.honeycomb.io:443
headers:
"x-honeycomb-team": "YOUR_API_KEY"
"x-honeycomb-dataset": "YOUR_DATASET"
processors:
batch:
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [logging, otlp]
docker-compose.yaml如下:
version: "2"
services:
# Collector
otel-collector:
image: otel/opentelemetry-collector-contrib:latest
restart: always
command: ["--config=/etc/otel-collector-config.yaml", "${OTELCOL_ARGS}"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- "1888:1888" # pprof extension
- "8888:8888" # Prometheus metrics exposed by the collector
- "8889:8889" # Prometheus exporter metrics
- "13133:13133" # health_check extension
- "4343:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP http receiver
OpenTelemetry实现如下:
Resource resource = Resource.getDefault().merge(Resource.builder().put(SERVICE_NAME, MY_SERVICE_NAME).build());
OtlpGrpcSpanExporter otlpGrpcSpanExporter = OtlpGrpcSpanExporter.builder().setEndpoint("http://localhost:4318").build();
SdkTracerProvider sdkTracerProvider = SdkTracerProvider.builder()
.addSpanProcessor(BatchSpanProcessor.builder(otlpGrpcSpanExporter).build())
.setResource(resource)
.build();
openTelemetry = OpenTelemetrySdk.builder().
.setTracerProvider(sdkTracerProvider)
.buildAndRegisterGlobal();
Tracer tracer = openTelemetry.getTracer("My Tracer");
span = tracer.spanBuilder(messageType + " handler span").startSpan();
span.setAttribute("messageType", messageType);
//some logic
span.end();
我在我的应用程序中看到下面的错误。不确定我漏掉了什么?
Jul 06, 2023 12:52:04 PM io.opentelemetry.exporter.internal.grpc.GrpcExporterUtil logUnimplemented
SEVERE: Failed to export metrics. Server responded with UNIMPLEMENTED. This usually means that your collector is not configured with an otlp receiver in the "pipelines" section of the configuration. If export is not desired and you are using OpenTelemetry autoconfiguration or the javaagent, disable export by setting OTEL_METRICS_EXPORTER=none. Full error message: unknown service opentelemetry.proto.collector.metrics.v1.MetricsService
Jul 06, 2023 12:52:08 PM io.opentelemetry.sdk.internal.ThrottlingLogger doLog
SEVERE: Failed to export spans. The request could not be executed. Full error message: FRAME_SIZE_ERROR: 4740180
英文:
I'm trying to export the spans to HoneyComb
through Otel-Collector
Using below Otel-collector configs I'm able to POST
test Trace
to HoneyComb UI
as below
curl -i http://localhost:4318/v1/traces -X POST -H "Content-Type: application/json" -d @span.json
My Otel-Collector
versions that I tried are as below
receivers:
otlp:
protocols:
grpc:
http:
exporters:
logging:
loglevel: debug
otlphttp:
endpoint: "https://api.honeycomb.io"
headers:
"x-honeycomb-team": "YOUR_API_KEY"
"x-honeycomb-dataset": "YOUR_DATASET"
processors:
batch:
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [logging, otlphttp]
OR
receivers:
otlp:
protocols:
grpc:
http:
exporters:
logging:
loglevel: debug
otlp:
endpoint: "http://api.honeycomb.io:443" # even simply api.honeycomb.io:443
headers:
"x-honeycomb-team": "YOUR_API_KEY"
"x-honeycomb-dataset": "YOUR_DATASET"
processors:
batch:
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [logging, otlp]
docker-compose.yaml is as below
version: "2"
services:
# Collector
otel-collector:
image: otel/opentelemetry-collector-contrib:latest
restart: always
command: ["--config=/etc/otel-collector-config.yaml", "${OTELCOL_ARGS}"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- "1888:1888" # pprof extension
- "8888:8888" # Prometheus metrics exposed by the collector
- "8889:8889" # Prometheus exporter metrics
- "13133:13133" # health_check extension
- "4343:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP http receiver
OpenTelemetry implementation is
Resource resource = Resource.getDefault().merge(Resource.builder().put(SERVICE_NAME, MY_SERVICE_NAME).build());
OtlpGrpcSpanExporter otlpGrpcSpanExporter = OtlpGrpcSpanExporter.builder().setEndpoint("http://localhost:4318").build();
SdkTracerProvider sdkTracerProvider = SdkTracerProvider.builder()
.addSpanProcessor(BatchSpanProcessor.builder(otlpGrpcSpanExporter).build())
.setResource(resource)
.build();
openTelemetry = OpenTelemetrySdk.builder().
.setTracerProvider(sdkTracerProvider)
.buildAndRegisterGlobal();
Tracer tracer = openTelemetry.getTracer("My Tracer");
span = tracer.spanBuilder(messageType + " handler span").startSpan();
span.setAttribute("messageType", messageType);
//some logic
span.end();
I'm seeing below error in my application. Not sure what is I'm missing here?
Jul 06, 2023 12:52:04 PM io.opentelemetry.exporter.internal.grpc.GrpcExporterUtil logUnimplemented
SEVERE: Failed to export metrics. Server responded with UNIMPLEMENTED. This usually means that your collector is not configured with an otlp receiver in the "pipelines" section of the configuration. If export is not desired and you are using OpenTelemetry autoconfiguration or the javaagent, disable export by setting OTEL_METRICS_EXPORTER=none. Full error message: unknown service opentelemetry.proto.collector.metrics.v1.MetricsService
Jul 06, 2023 12:52:08 PM io.opentelemetry.sdk.internal.ThrottlingLogger doLog
SEVERE: Failed to export spans. The request could not be executed. Full error message: FRAME_SIZE_ERROR: 4740180
答案1
得分: 1
有两个错误报告来自你的应用程序,我可以看到。第一个错误是Server responded with UNIMPLEMENTED
,当你尝试使用gRPC导出器与一个期望HTTP的服务器时发生。请在应用程序中将收集器端点更改为使用端口4317
以使用gRPC。
第二个错误表示你尝试发送到收集器的消息太大。要么调整应用程序中批处理跨度处理器的设置以更频繁地发送,要么调整你的收集器的OTLP接收器配置以增加max_recv_msg_size_mib
,或者启用导出器上的压缩以减小导出负载的大小。
英文:
There are two errors reported by your application that I can see. The first: Server responded with UNIMPLEMENTED
happens when you attempt to use the gRPC exporter with a server expecting HTTP. Change your collector endpoint in the application to use port 4317
to use gRPC.
The second error indicates that the message you are attempting to send to the collector is too large. Either adjust the settings of your batch span processor in the application to send more frequently, adjust your collector's OTLP receiver configuration to increase max_recv_msg_size_mib
, or enable compression on the exporter to reduce the size of the exported payload.
答案2
得分: 0
我觉得我指向了错误的端口,即4317(这是内部容器端口,但外部端口在docker-compose.yaml
中我提到的是4343)
OtlpGrpcSpanExporter otlpGrpcSpanExporter =
OtlpGrpcSpanExporter.builder().setEndpoint("http://localhost:4343").build();
附注:http协议之前也能正常工作。
英文:
I think I was pointing to wrong port no. i.e. 4317 (which is internal container port but external port was 4343 that I've mentioned in docker-compose.yaml
OtlpGrpcSpanExporter otlpGrpcSpanExporter =
OtlpGrpcSpanExporter.builder().setEndpoint("http://localhost:4343").build();
P.S.: http protocol was working previously as well.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论