Search code examples
loggingwildflycorrelationkeycloakspring-cloud-sleuth

How to make Wildfly behave similar to spring-cloud-sleuth


As our internal IDP we are using Keycloak 6.0.1, which relies on Wildfly 16.

The majority of our components are spring boot thingies, in which we use spring cloud sleuth + some gelf configuration to send logs to our ELK stack.

That works like a charm, but the problem resides in losing track of the requests that get to keycloak, since it does not propagate nor take into account the traceId/spanId headers that sleuth uses.

Sending log statements is solved, since we configured the logging subsystem in keycloak to send log statements though gelf to our ELK.

Now, here is the question, is there any way of configuring Wildfly to behave as if it was using spring-cloud-sleuth?

We want:

  1. Wildfly log statements have a SpanID and a TraceId.
  2. Wildfly incoming requests containing correlation information are propagated.
  3. Wildfly generates new correlation information for requests not containing it.

Thanks!


Solution

  • You'd have to use projects like https://github.com/apache/incubator-zipkin-brave within your Wildfly project to ensure that the tracing context gets propagated accordingly. So without using Spring, you have to ensure manually that all of your components are getting wrapped in their tracing representations.