Created
April 27, 2024 13:53
-
-
Save rsrini7/11ae1b312e08e483bfefc70b2c70fab6 to your computer and use it in GitHub Desktop.
tracability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://betterprogramming.pub/tracing-in-spring-boot-3-webflux-d432d0c78d3e | |
logging.pattern.level: "trace_id=%mdc{traceId} span_id=%mdc{spanId} trace_flags=%mdc{traceFlags} %p" | |
https://spring.academy/guides/microservices-observability-reactive-spring-boot-3 | |
---------------- | |
https://azizulhaq-ananto.medium.com/how-to-handle-logs-and-tracing-in-spring-webflux-and-microservices-a0b45adc4610 | |
@Component | |
@Slf4j | |
public class TraceIdFilter implements WebFilter { | |
@Override | |
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) { | |
Map<String, String> headers = exchange.getRequest().getHeaders().toSingleValueMap(); | |
var traceId = ""; | |
if (headers.containsKey("X-B3-TRACEID")) { | |
traceId = headers.get("X-B3-TRACEID"); | |
MDC.put("X-B3-TraceId", traceId); | |
} else if (!exchange.getRequest().getURI().getPath().contains("/actuator")) { | |
log.warn("TRACE_ID not present in header: {}", exchange.getRequest().getURI()); | |
} | |
return chain.filter(exchange); | |
} | |
} | |
https://stackoverflow.com/questions/76620276/use-both-b3-and-w3c-trace-formats-in-trace-propagation-between-spring-boot-2-3 | |
https://uptrace.dev/opentelemetry/distributed-tracing.html | |
https://github.com/wultra/lime-java-core/blob/c94df5546eda104818f9c07e0887f3887f63f04f/rest-client-base/src/main/java/com/wultra/core/rest/client/base/TraceparentFilterFunction.java#L33 | |
https://github.com/msgoat/cnj-common-observability-spring/blob/fd9032d27baf56622a772aacd465c6f12647bfaa/src/main/java/group/msg/at/cloud/common/observability/logging/mdc/LoggingMdcFilter.java#L24 | |
https://github.com/Azure-Samples/iotedge-logging-and-monitoring-solution/blob/c4fd31895b55c27bfb91064a53ff8f95fe7e0e70/Backend/javafunction/src/main/java/iotsample/function/Function.java#L53 | |
https://github.com/AyazKhuraishi/cnj-common-observability-jakarta/blob/7eaf2b5c3e21068a9e0efe4d039ac310c200ee7b/src/main/java/group/msg/at/cloud/common/observability/logging/mdc/LoggingMdcContainerRequestFilter.java#L27 | |
https://github.com/project-ncl/pnc-common/blob/3b17c91209ed3595c1936ba6bdcaaa1928849021/src/main/java/org/jboss/pnc/common/otel/OtelUtils.java#L108 | |
https://github.com/project-ncl/bacon/blob/e4110a44be70848f186cabe84c5d6801be538a31/da/src/main/java/org/jboss/bacon/da/CustomRestHeaderFilter.java#L4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment