Class TraceDepth

java.lang.Object
com.fayupable.logged.spring.support.TraceDepth

public final class TraceDepth extends Object
Parses the call-chain depth received from another service (an HTTP header, a Kafka or RabbitMQ message header), shared by every trace carrier so they apply exactly the same rule.

The value comes from outside this process and is only trusted as far as keeping it in a sensible range: anything missing, malformed or negative starts a new chain at depth 0, and anything above 1000 is capped there, so a forged header can neither produce a negative depth nor overflow when a nested call increments it.

This class is used internally by this library's trace carriers. It is public only because they live in different packages; it is not part of the supported API and may change without notice.

  • Field Details

    • MAX_DEPTH

      public static final int MAX_DEPTH
      Highest depth accepted from another service; no real call chain gets close.
      See Also:
  • Method Details

    • parse

      public static int parse(String raw)
      Parameters:
      raw - the depth as received, may be null
      Returns:
      the depth clamped to 0..1000, or 0 when raw is missing or not a whole number