Class RequestIdHeaders
AuditContext.getRequestIdHeaderNames().
Most such headers carry nothing but the id, so the header value is the id. The exception is
the B3 single header, which
packs the trace id, the span id and the sampling state into one value -- and the span id differs
between the two ends of a transaction, so only its trace id correlates them. Taking that trace id also
makes the single-header and the multi-header flavour of B3 interchangeable: both then yield the same
id, which is what X_B3_TRACE_ID carries on its own.
TRACEPARENT is deliberately not reduced to its trace id: it is recorded whole, which
is how IPF has always recorded it. Both ends of a transaction see the same header value on the wire,
so it correlates them either way.
Which header an id came from is kept in the audit record, as the participant object ID type the id is
recorded under -- see participantObjectIdType(String). A deployment that would rather record
one type whatever the propagation format can fix it with AuditContext.getRequestIdType().
- Since:
- 5.3
- Author:
- Christian Ohr
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractRequestId(String headerName, String headerValue) Reads the correlation id out of a header value.static ParticipantObjectIdTypeparticipantObjectIdType(String headerName) The participant object ID type a correlation id from the given header is conventionally recorded under.
-
Field Details
-
X_REQUEST_ID
The header IHE BALP asks for. Carries the correlation id and nothing else.- See Also:
-
TRACEPARENT
-
B3
B3 single header,{TraceId}-{SpanId}[-{SamplingState}[-{ParentSpanId}]]or0.- See Also:
-
X_B3_TRACE_ID
Trace id of the B3 multi-header flavour. Carries the correlation id and nothing else.- See Also:
-
-
Constructor Details
-
RequestIdHeaders
public RequestIdHeaders()
-
-
Method Details
-
participantObjectIdType
The participant object ID type a correlation id from the given header is conventionally recorded under. It names the propagation format the id was taken from, which is what tells a reader how to line the id up against the traces it has.- Parameters:
headerName- name of the header the id came from, matched case-insensitively- Returns:
- the type for it, or
ParticipantObjectIdTypeCode.XRequestIdfor a header without a code of its own
-
extractRequestId
Reads the correlation id out of a header value.- Parameters:
headerName- name of the header the value came from, matched case-insensitivelyheaderValue- value of the header, may be null or blank- Returns:
- the correlation id, or empty if the header carries none
-