Class DistributedTracingContext

java.lang.Object
com.symphony.bdk.http.api.tracing.DistributedTracingContext

@API(status=STABLE) public final class DistributedTracingContext extends Object
Helper class that manipulates underlying logger MDC for distributed tracing purpose. The Symphony platform internally relies on header X-Trace-Id value that is printed at server side logs. This is especially useful when debugging issues across multiple distributed systems.
  • Field Details

  • Method Details

    • setTraceId

      public static void setTraceId()
      Inits MDC X-Trace-Id entry with a generated random alphanumeric value.
    • setTraceId

      public static void setTraceId(String traceId)
      Inits MDC X-Trace-Id entry with a given value.
    • setBaseTraceId

      public static void setBaseTraceId(String baseTraceId)
      Inits MDC X-Trace-Id entry with a given traceId followed by a generated random alphanumeric value.
    • getTraceId

      public static String getTraceId()
    • hasTraceId

      public static boolean hasTraceId()
    • clear

      public static void clear()
    • doWithTraceId

      public static void doWithTraceId(String traceId, Runnable runnable)
      Processes any custom Runnable using a given traceId. Then backup the original
      Parameters:
      traceId - a given traceId
      runnable - the logic to be executed