Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tip to correlation IDs documentation referencing spring.reactor.context-propagation=auto #42054

Closed
philwebb opened this issue Aug 29, 2024 · 5 comments
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@philwebb
Copy link
Member

No description provided.

@philwebb philwebb added the type: task A general task label Aug 29, 2024
@philwebb philwebb added this to the 3.4.x milestone Aug 29, 2024
@mhalbritter
Copy link
Contributor

mhalbritter commented Aug 29, 2024

In a servlet application, the logs look like this:

{"@timestamp":"2024-08-29T06:48:50.886628003Z","log.level":"INFO","process.pid":66723,"process.thread.name":"http-nio-9000-exec-1","service.name":"tracing-service-1","log.logger":"com.example.tracing_service_1.MyController","message":"index()","traceId":"66d019d24f3c84880516a1c3aa2368c5","spanId":"0516a1c3aa2368c5","ecs.version":"8.11"}

This is using Brave as a tracer. The traceId and the spanId are in the MDC and are automatically included in the log message.

@mhalbritter
Copy link
Contributor

mhalbritter commented Aug 29, 2024

In a webflux application, the traceId and spanId is missing from the log message:

{"@timestamp":"2024-08-29T06:58:19.344283535Z","log.level":"INFO","process.pid":72293,"process.thread.name":"reactor-http-epoll-3","service.name":"tracing-service-1","log.logger":"com.example.tracing_service_1.MyController","message":"index()","ecs.version":"8.11"}

When switching on the automatic context propagation with

spring.reactor.context-propagation=auto

then the trace id and span id appear (because they are now in the MDC):

{"@timestamp":"2024-08-29T07:01:42.393234306Z","log.level":"INFO","process.pid":74038,"process.thread.name":"reactor-http-epoll-3","service.name":"tracing-service-1","log.logger":"com.example.tracing_service_1.MyController","message":"index()","traceId":"66d01cd6899c9f52af89cde7e016d4f6","spanId":"af89cde7e016d4f6","ecs.version":"8.11"}

@mhalbritter
Copy link
Contributor

Same behavior with Otel instead of Brave.

@philwebb
Copy link
Member Author

Seems like it generally works. I wonder if we should add a note in the docs about spring.reactor.context-propagation=auto?

@philwebb philwebb added the for: team-meeting An issue we'd like to discuss as a team to make progress label Aug 29, 2024
@philwebb
Copy link
Member Author

philwebb commented Sep 5, 2024

There is a note already at https://docs.spring.io/spring-boot/reference/actuator/observability.html. We can extract a small section and add a TIP next to the correlation IDs section.

@philwebb philwebb changed the title Investigate how log correlation IDs work with structured logging Add tip to correlation IDs documentation referencing spring.reactor.context-propagation=auto Sep 5, 2024
@philwebb philwebb added type: documentation A documentation update and removed type: task A general task for: team-meeting An issue we'd like to discuss as a team to make progress labels Sep 5, 2024
@mhalbritter mhalbritter self-assigned this Sep 6, 2024
@mhalbritter mhalbritter modified the milestones: 3.4.x, 3.4.0-M3 Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

2 participants