We've noticed that child spans of HTTP requests were showing up as independent root traces after migrating Spring Cloud GCP to Spring Boot 3.0 (RC2).
In old Spring Cloud Sleuth, HttpTracing bean was enriched with HTTP request parsing. While in Micrometer BraveHttpRequestParser exists, it does not seem to be instantiated or injected into HttpTracing bean in Spring Boot autoconfiguration. In fact, HttpTracing bean configured in Spring Boot looks very minimalistic.
Is there a new mechanism through which we should be extracting existing trace information from HTTP headers?
Comment From: elefeint
cc:/ @joewang1127
Comment From: wilkinsona
@marcingrzejszczak @jonatan-ivanov can you please take a look?
Comment From: jonatan-ivanov
Yes, the new mechanism is through the instrumented HTTP clients: it's not Brave who provides these details anymore but the instrumentation.
What HTTP client are you using? Are you trying to instrument it on your own?
Could you please try a client that is supported out of the box like RestTemplate or WebClient?
(You can also set-up okhttp or, once-it is released, OpenFeign).
Comment From: elefeint
The sample that's surfacing this issue is using RestTemplate, but the autoconfugured HttpRequestParser does not seem to be used.
At first, I thought that brave.http.HttpRequestParser bean needed to change over to io.micrometer.tracing.http.HttpRequestParser, but since I could not find a place in Boot where this could be customized at all, I figured I'd ask.
@meltsufin you 'll probably have to look into this, too, since I am out.
Comment From: jonatan-ivanov
We have a working sample for resttemplate: https://github.com/micrometer-metrics/micrometer-samples/ Could you please try to register it as a bean as you see in the sample?
Comment From: JoeWang1127
Hi @jonatan-ivanov, thanks for your advice.
I modified our sample (in boot3.0-update-dependency branch), in which a RestTemplate bean is created in Application.java. The requests have the same root trace now.
However, compared with sleuth, the default span name is not the annotated method's name, even change the name or value parameter doesn't change the span name.
Below is the new version
Below is the old version, you can see additional span names at the red line.
Comment From: jonatan-ivanov
There are a few issues with the sample: 1. It is quite big, I'm not 100% sure what you are talking about 2. You are using Sleuth (Sleuth is for Boot 2, if you are using Boot 3 please use Micrometer Tracing) 3. You are using Brave's API for things that you should be able to do with the Observation API (also with Micrometer Tracing)
However, compared with sleuth, the default span name is not the annotated method's name, even change the name or value parameter doesn't change the span name.
If you mean @NewSpan by this, that won't work, that annotation is from Sleuth, it should not even be on your classpath (see the second point above). On the first screenshot, everything looks ok to me, if you want an additional span, you can use @Observed.
Comment From: JoeWang1127
Hi @jonatan-ivanov, thanks for your feedback, the @Observed works for me (with extra help from here). You can close the issue, thanks.