Class TraceDepth
java.lang.Object
com.fayupable.logged.spring.support.TraceDepth
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intHighest depth accepted from another service; no real call chain gets close. -
Method Summary
-
Field Details
-
MAX_DEPTH
public static final int MAX_DEPTHHighest depth accepted from another service; no real call chain gets close.- See Also:
-
-
Method Details
-
parse
- Parameters:
raw- the depth as received, may benull- Returns:
- the depth clamped to
0..1000, or 0 whenrawis missing or not a whole number
-