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

Gateway traceid broken generation #3375

Closed
ArtyomKazlanzhi opened this issue Mar 6, 2023 · 6 comments
Closed

Gateway traceid broken generation #3375

ArtyomKazlanzhi opened this issue Mar 6, 2023 · 6 comments
Labels
area/observability for/other-project This issue belongs to another project

Comments

@ArtyomKazlanzhi
Copy link

I'm working with Spring boot 3.01, micrometer tracing, bridge brave, spring cloud gateway
Found on the web that I can populate logs with traceId and spanId if to add reactor-core 3.5.3
and by adding
Hooks.enableAutomaticContextPropagation();

It really helps, but for some reason it breaks generating the trace id, for the first request to the gateway it generates a new one, then with every new request TraceContext using the same trace id over and over, except the span id, it's a new one every time (like it should be)

@reactorbot reactorbot added the ❓need-triage This issue needs triage, hasn't been looked at by a team member yet label Mar 6, 2023
@chemicL
Copy link
Member

chemicL commented Mar 7, 2023

@ArtyomKazlanzhi can you please try using the latest versions of the libraries and retry? Usually, it's a matter of updating Spring Boot to 3.0.4. It carries the latest of Micrometer and Reactor unless you specify the versions on your own, in which case you also should bump.

If using the latest versions you still see the issue, it's best if you prepare an isolated reproducer that we can work with.

@chemicL chemicL added status/need-user-input This needs user input to proceed for/user-attention This issue needs user attention (feedback, rework, etc...) and removed ❓need-triage This issue needs triage, hasn't been looked at by a team member yet labels Mar 7, 2023
@ArtyomKazlanzhi
Copy link
Author

@chemicL I have tried to update the dependencies to the latests, trace id and span id are no more the same, they are generated correct, but they no more displayed in the logs
created a sample with same configuration
https://github.com/ArtyomKazlanzhi/spring-gateway-micrometer-tracing

@github4sanjay
Copy link

github4sanjay commented Mar 11, 2023

its very unpredictable after upgrading to spring boot 3, same code produces traceId sometimes and sometimes not, not sure wats issue, this code issue i faced in spring cloud gateway where in a gateway filter i m trying to log something

2023-03-11 18:13:19 2023-03-11 10:13:19,081 [parallel-2] INFO [gateway,640c543eda23fff1f4dc85ea58b5f171,1b0e2dd80b1de2ad,,] com.example.gateway.AddAuthHeaderGatewayFilter - API /api/v1/devices request by f0343220-73fb-4db2-98fa-853638423fa7 from device f00639ed-d457-49e9-b05d-891d4e984c8a
2023-03-11 18:13:36 2023-03-11 10:13:36,193 [parallel-1] INFO [gateway,00000000000000000000000000000000,0000000000000000,,] com.example.gateway.AddAuthHeaderGatewayFilter - API /api/v1/devices request by f0343220-73fb-4db2-98fa-853638423fa7 from device f00639ed-d457-49e9-b05d-891d4e984c8a

@chemicL
Copy link
Member

chemicL commented Apr 5, 2023

@ArtyomKazlanzhi the README in the repository you provided mentions HttpWebHandlerAdapter - in my understanding this is called on a level before Spring's ServerHttpObservationFilter. Therefore, the Observation is not available at that point. Please reach out to the Spring team in this relevant issue: spring-projects/spring-framework#30013

@chemicL
Copy link
Member

chemicL commented Apr 5, 2023

@github4sanjay without a reproducer it won't be possible to help. I would consider reporting this to the relevant Spring portfolio project if it is a functionality of that project.

@chemicL chemicL closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2023
@chemicL chemicL added for/other-project This issue belongs to another project area/observability and removed for/user-attention This issue needs user attention (feedback, rework, etc...) status/need-user-input This needs user input to proceed labels Apr 5, 2023
@kzander91
Copy link
Contributor

This problem re-appeared for me, I created #3584 with a simple reproducer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/observability for/other-project This issue belongs to another project
Projects
None yet
Development

No branches or pull requests

5 participants