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

Micrometer trace HTTP request span propagation #33228

Closed
elefeint opened this issue Nov 16, 2022 · 8 comments
Closed

Micrometer trace HTTP request span propagation #33228

elefeint opened this issue Nov 16, 2022 · 8 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@elefeint
Copy link

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?

@elefeint
Copy link
Author

cc:/ @JoeWang1127

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 16, 2022
@wilkinsona
Copy link
Member

@marcingrzejszczak @jonatan-ivanov can you please take a look?

@jonatan-ivanov
Copy link
Member

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).

@elefeint
Copy link
Author

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.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Nov 18, 2022
@jonatan-ivanov
Copy link
Member

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?

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 18, 2022
@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Nov 21, 2022
@JoeWang1127
Copy link

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
image
Below is the old version, you can see additional span names at the red line.
Screen Shot 2022-11-21 at 22 16 56

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 22, 2022
@jonatan-ivanov
Copy link
Member

jonatan-ivanov commented Nov 22, 2022

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.

@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Nov 22, 2022
@JoeWang1127
Copy link

Hi @jonatan-ivanov, thanks for your feedback, the @Observed works for me (with extra help from here). You can close the issue, thanks.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 28, 2022
@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Nov 29, 2022
@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

5 participants