我在 Spring Boot java 应用程序中使用 Open Telemetry,并且对于每个请求,Open Telemetry 代理正在记录我想要抑制的额外日志行。由于客户端试图不断轮询 kafka 服务器状态,因此日志过多。io.opentelemetry.exporter.logging: ERROR
好像没有效果。
[opentelemetry.auto.trace 2021-03-30 09:20:12:470 -0700] [http-nio-9090-exec-1] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'PSFPublishAPIController.publish' : 785a452cf9bc6f901374af3c24491fc3 c3b50425ffd5090f INTERNAL [tracer: io.opentelemetry.javaagent.spring-webmvc-3.1:1.0.1] AttributesMap{data={thread.name=http-nio-9090-exec-1, thread.id=44}, capacity=128, totalAddedValues=2}
[opentelemetry.auto.trace 2021-03-30 09:20:12:476 -0700] [http-nio-9090-exec-1] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - '/sidhpsf/v1/psfpublish' : 785a452cf9bc6f901374af3c24491fc3 a4a3c3581efd9a24 SERVER [tracer: io.opentelemetry.javaagent.tomcat-7.0:1.0.1] AttributesMap{data={http.user_agent=PostmanRuntime/7.26.5, http.flavor=1.1, http.status_code=200, net.peer.port=54971, http.client_ip=0:0:0:0:0:0:0:1, thread.name=http-nio-9090-exec-1, net.peer.ip=0:0:0:0:0:0:0:1, http.method=POST, thread.id=44, http.url=http://localhost:9090/sidhpsf/v1/psfpublish}, capacity=128, totalAddedValues=10}
[opentelemetry.auto.trace 2021-03-30 09:20:12:741 -0700] [kafka-producer-network-thread | producer-1] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'Xorg-Data-Sharing-Input-Topic send' : 785a452cf9bc6f901374af3c24491fc3 b1deb386583762f2 PRODUCER [tracer: io.opentelemetry.javaagent.kafka-clients-0.11:1.0.1] AttributesMap{data={messaging.destination_kind=topic, messaging.system=kafka, thread.name=http-nio-9090-exec-1, thread.id=44}, capacity=128, totalAddedValues=5}
yml 中的日志配置:
logging:
level:
root: ERROR
com.org: DEBUG
org.springframework: INFO
io.opentelemetry.exporter.logging: ERROR
pattern:
console: '%d{HH:mm:ss.SSS} [%t,%X{trace_id}-%X{span_id}-%X{trace_flags}] %highlight{%-5level} %c{2.} - %msg%n'
启动器命令:
java -javaagent:/Users/rshar248/Documents/Softwares/opentelemetry-javaagent-all.jar \
-Dotel.resource.attributes=service.name=psf-service \
-Dotel.traces.exporter=logging -Dotel.metrics.exporter=none \
-Dspring.profiles.active=local app.jar
任何如何抑制遥测内部日志行的建议都会有很大帮助。