aws / aws-xray-java-agent

The official AWS X-Ray Auto Instrumentation Agent for Java.
Apache License 2.0
42 stars 18 forks source link

Added handler for new SQL preparation events #92

Closed willarmiros closed 3 years ago

willarmiros commented 3 years ago

Description of changes: This change, along with https://github.com/awslabs/disco/pull/16, will enable SQL query strings to be recorded even when they are sent outside of the actual query execution, e.g. with prepareStatement. We maintain a map of statements to their stored query strings internally to accomplish this.

The integ test is commented because we are dependent on the above disco PR and https://github.com/aws/aws-xray-sdk-java/pull/270 to be released for them to pass, but I've verified they pass locally and will uncomment when other changes are released. Also, I had to implement an entire Connection class (in MyConnectionImpl) because of a limitation in Disco where a method cannot be stubbed with Mockito and intercepted by Disco at once, so we have to implement a full class. Disco is working to remove that limitation and we can refactor when they do.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.