admin管理员组

文章数量:1220790

Environment

  • Spring Boot 3.4
  • ECS Structured Logging (logging.structured.format.console=ecs)
  • Micrometer Tracing with Brave (io.micrometer:micrometer-tracing-bridge-brave)

Issue Description

I've noticed an inconsistency in trace IDs when using ECS structured logging alongside Micrometer tracing:

  1. The ECS logging creates a trace.id field using MDC
  2. Micrometer generates a traceId field in the logs

Observed Behavior

  • Single API Call: trace.id and traceId have different values
  • Inter-service Communication: Both IDs align correctly

Attaching screenshots: Normal request Interacting between microservices

Questions

  1. What causes this difference in behavior between single API calls and service-to-service interactions?
  2. Is there a way to ensure consistent trace ID values between MDC and Micrometer in all scenarios?

Any insights or solutions would be greatly appreciated.

本文标签: Spring Boot 34 ECS Logging and Micrometer Tracing DiscrepancyStack Overflow