-
Notifications
You must be signed in to change notification settings - Fork 99
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
Using Spring Boot RestTemplate with X-Ray #220
Comments
Hi @KentonParton, Thanks for reporting this issue. It seems like there are 2 problems. The first problem is that the Agent should not be recording an NPE, even during unexpected behavior like not having a segment available to close, so I'll try and make that more graceful. The second, deeper issue is that there wasn't a segment available in this method. I'm a little confused by which of your code snippets work since you said "app works as expected when using code snippet 2" but also said code snippet 2 had the NPE. Do you see any segment for this As for tracing the |
Thanks for your response @willarmiros and addressing the NPE. Regarding the confusion, code snippet 2 works as expected on Spring Boot 2.0 + but errors on Spring Boot 1.5.4. I believe there was no segment to begin with as it was not picked up in the console. |
Is there an ETA for this fix by any chance? It would allow my team and I to plan accordingly. Thank you. |
Hi @KentonParton, If you could post your raw trace data from the tests that work as expected, and also the raw trace data from the Spring 1.5.4 tests (if there is any) to compare it to that would be very helpful. |
Hi @willarmiros, I have created a repo here which has the two Spring services. To run them you will just need to set the following -javaagent:./disco/disco-java-agent.jar=pluginPath=./disco/disco-plugins and run the xray agent. I am making the request as follows: localhost:8080/demo/requestOne (PostMan) --> http://localhost:8084/demo1/demo1 (bi-tracing-1) --> (bi-tracing-2) As mentioned before, if you change from Spring Boot 1.5.4.RELEASE to 2.3.4.RELEASE the tracing works as expected. Please let me know if you need further info. |
Hi @KentonParton, |
Hi @willarmiros, just wanted to check if there has been any progress on this? |
@KentonParton sorry for not following up yet, have been all over the place recently. This will be the next issue I investigate and will post an update when I do. |
@KentonParton I've just gotten around to testing this. I cloned your repo and, as it is provided (using Spring Boot 1.5.4.RELEASE), tracing worked just fine for me. Here's what I did: git clone https://github.com/KentonParton/xray-tracing-demo.git
cd xray-tracing-demo/bi-tracing-1
./mvnw package
java -javaagent:./disco/disco-java-agent.jar=pluginPath=./disco/disco-plugins -Dlogging.level.com.amazonaws.xray=DEBUG -jar target/bi-tracing-demo-0.0.1-SNAPSHOT.jar
# Separate shell
cd xray-tracing-demo/bi-tracing-2
./mvnw package
java -javaagent:./disco/disco-java-agent.jar=pluginPath=./disco/disco-plugins -Dlogging.level.com.amazonaws.xray=DEBUG -jar target/bi-tracing-demo-0.0.1-SNAPSHOT.jar Then, I went to http://localhost:8080/demo/requestOne in my browser and the request was served successfully and logs showed no errors. My computer is not cooperating but I will post a picture of the trace too. |
@willarmiros Thank you for trying to replicate the issue. When I run the application from the terminal it works for me too. I must have something set incorrectly in Intellij as I still get the error. I will dig a bit deeper tomorrow. Thanks again. |
I am using the AWS X-Ray auto-instrumentation agent for a Spring Boot 1.5 app but get a Segment not found error. When I change the Spring Boot version from 1.5.4.RELEASE to 2.3.4.RELEASE the app works as expected when using code snippet 2.
I ran into this issue while trying to use the SpringFramework RestTemplate as follows:
Code Snippet 1
but noticed the same error occurred when trying the following:
Code Snippet 2
I get the following stack trace:
Stack Trace
The text was updated successfully, but these errors were encountered: