Skip to content

Conversation

KarstenSchnitter
Copy link
Contributor

The contents of the HTTP header "traceparent" is extracted and logged
with every log event in field "w3c_traceparent". This is done for regular
application log messages and request logs. The feature allows correlation
of log messages with requests and possible traces.

Signed-off-by: Karsten Schnitter [email protected]

The contents of the HTTP header "traceparent" is extracted and logged
with every log event in field "w3c_traceparent". This is done for regular
application log messages and request logs. The feature allows correlation
of log messages with requests and possible traces.

Signed-off-by: Karsten Schnitter <[email protected]>
When no X-CorrelationId header is found, the CorrelationIdFilter now searches
for a traceparent header. It will take the trace-id as correlation-id, if the header
value follows the W3C definition. This filter can be configured with customisable
http header configurations but keeps the old interface for compatibility.

Signed-off-by: Karsten Schnitter <[email protected]>
Copy link
Contributor

@nicklas-dohrn nicklas-dohrn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be correct.
Double checked every naming, and seems to be as we defined it to be.

String correlationId = HttpHeaderUtilities.getHeaderValue(request, correlationHeader);
if (correlationId == null || correlationId.isEmpty() || correlationId.equals(Defaults.UNKNOWN)) {
if (isBlankOrDefault(correlationId)) {
correlationId = getCorrelationIdFromTraceparent(request);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this works, because correlationId is nullable, so the parsing can fail, and still work as expected.

@KarstenSchnitter KarstenSchnitter merged commit 57e8638 into master Feb 15, 2022
@KarstenSchnitter KarstenSchnitter deleted the w3c_traceparent branch February 15, 2022 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants