I do have very basic configuration of Spring Boot (3.4.0) application with opentelemetry-spring-boot-starter and otel collector.
Unfortunately when I try to send metrics and logs to local Otel collector I do get this error:
2024-12-02T13:45:37.578+01:00 ERROR 41207 --- [alhost:4318/...] i.o.exporter.internal.http.HttpExporter : Failed to export logs. The request could not be executed. Full error message: Broken pipe
java.net.SocketException: Broken pipe
at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method) ~[na:na]
at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:62) ~[na:na]
at java.base/sun.nio.ch.NioSocketImpl.tryWrite(NioSocketImpl.java:394) ~[na:na]
(...)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:na]
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) ~[okhttp-4.12.0.jar:na]
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517) ~[okhttp-4.12.0.jar:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
Suppressed: java.io.IOException: unexpected end of stream on http://localhost:4318/...
at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:210) ~[okhttp-4.12.0.jar:na]
at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:110) ~[okhttp-4.12.0.jar:na]
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:93) ~[okhttp-4.12.0.jar:na]
... 14 common frames omitted
Caused by: java.io.EOFException: \n not found: limit=0 content=…
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:335)
at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:180)
... 16 common frames omitted
2024-12-02T13:45:37.582+01:00 DEBUG 41207 --- [_WorkerThread-1] i.o.s.l.e.BatchLogRecordProcessor$Worker : Exporter failed
Gradle dependencies do contain:
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter")
application.yml does have:
management:
endpoints.web.exposure.include:
- mappings
- health
- info
- metrics
endpoint:
mappings.enabled: true
info.enabled: true
health.enabled: true
metrics.enabled: true
tracing:
sampling:
probability: 1.0
otel:
resource.attributes:
deployment.environment: dev
service:
name: my-app
namespace: my-namespace
otel collector config is:
receivers:
otlp:
protocols:
http:
exporters:
debug:
verbosity: detailed
service:
pipelines:
traces:
receivers: [otlp]
exporters: [debug]
metrics:
receivers: [otlp]
exporters: [debug]
logs:
receivers: [otlp]
exporters: [debug]
and otel docker logs are:
2024-12-02T12:43:45.877Z info service@v0.114.0/service.go:166 Setting up own telemetry...
2024-12-02T12:43:45.877Z info telemetry/metrics.go:70 Serving metrics {"address": "localhost:8888", "metrics level": "Normal"}
2024-12-02T12:43:45.877Z info builders/builders.go:26 Development component. May change in the future. {"kind": "exporter", "data_type": "traces", "name": "debug"}
2024-12-02T12:43:45.877Z info builders/builders.go:26 Development component. May change in the future. {"kind": "exporter", "data_type": "logs", "name": "debug"}
2024-12-02T12:43:45.877Z info builders/builders.go:26 Development component. May change in the future. {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-12-02T12:43:45.878Z info service@v0.114.0/service.go:238 Starting otelcol-contrib... {"Version": "0.114.0", "NumCPU": 6}
2024-12-02T12:43:45.878Z info extensions/extensions.go:39 Starting extensions...
2024-12-02T12:43:45.878Z info otlpreceiver@v0.114.0/otlp.go:169 Starting HTTP server {"kind": "receiver", "name": "otlp", "data_type": "metrics", "endpoint": "localhost:4318"}
2024-12-02T12:43:45.878Z info service@v0.114.0/service.go:261 Everything is ready. Begin running and processing data.
Do you have any idea what I'm doing wrong here?
I faced the same issue where logs weren’t exporting,the issue was resolved by adding the endpoint property to the OTLP receiver configuration:
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318