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

FR: Support for Spring WebClient #87

Open
terrificsoysauce opened this issue Mar 4, 2021 · 1 comment
Open

FR: Support for Spring WebClient #87

terrificsoysauce opened this issue Mar 4, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@terrificsoysauce
Copy link

terrificsoysauce commented Mar 4, 2021

FR: Support for Spring WebClient

In my sample application using Spring WebClient with X-Ray Java agent auto-instrumentation, the trace header is not injected into the http header.

This is the code block for the downstream http call using Spring webclient

import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@Slf4j
public class GoodbyeController {

  private final WebClient additionWebClient;

  @GetMapping("/goodbye")
  public ResponseEntity<?> goodbye() throws InterruptedException {

      MathResult addResult =
          this.additionWebClient
              .get()
              .uri(
                  uri ->
                      uri.path("/add")
                          .queryParam("x", Long.toString(x))
                          .queryParam("y", Long.toString(y))
                          .build())
              .retrieve()
              .bodyToMono(MathResult.class)
              .block();
   }
}

In the downstream http request handler, I printed out the request header and found that no trace id,

2021-03-04 16:19:18.841 INFO [Addition App,604108865e2cf420e5d967d9c6dc0ec3,e5d967d9c6dc0ec3,true] 25 --- [nio-8080-exec-8] c.g.t.s.tracingpoc.AdditionController : Starting to add... x: [100], y: [1000]. RequestHeaders: [{accept-encoding=gzip, user-agent=ReactorNetty/0.9.8.RELEASE, host=<redacted>:8080, accept=*/*}]

@terrificsoysauce terrificsoysauce changed the title TraceHeader Isn't Injected into Downsteam Http Calls with Spring WebClient FR: Support for Spring WebClient Mar 5, 2021
@willarmiros willarmiros added the enhancement New feature or request label Mar 8, 2021
@willarmiros
Copy link
Contributor

willarmiros commented Mar 8, 2021

Hi @terrificsoysauce,

As I think you've realized, the java agent currently only supports downstream HTTP Requests with Apache clients. I would suggest opening this feature request on the disco repo as well since that is where the actual ByteBuddy instrumentation lives. Alternatively, you can checkout the AWS Distro for OpenTelemetry Java agent (docs), which is a ready-to-use OpenTelemetry auto-instrumentation agent that's compatible with the X-Ray backend and supports Spring WebClient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants