public class ConnectionInterceptor
extends java.lang.Object
implements software.amazon.disco.agent.interception.Installable
| Modifier and Type | Field and Description |
|---|---|
static software.amazon.disco.agent.logging.Logger |
log |
static java.lang.String |
SQL_PREPARE_ORIGIN |
| Constructor and Description |
|---|
ConnectionInterceptor() |
| Modifier and Type | Method and Description |
|---|---|
static software.amazon.disco.agent.event.ServiceRequestEvent |
enter(java.lang.String queryString,
java.lang.String origin,
java.sql.Connection conn)
This method is inlined before any calls to prepareStatement or prepareCall, and its
purpose is to capture the query string provided as the first argument.
|
static void |
exit(software.amazon.disco.agent.event.ServiceRequestEvent requestEvent,
java.sql.PreparedStatement response,
java.lang.Throwable thrown)
This method is inlined with a preparation method at the moment it would return or throw a
Throwable. |
net.bytebuddy.agent.builder.AgentBuilder |
install(net.bytebuddy.agent.builder.AgentBuilder agentBuilder)
Installs part of the Disco SQL interception library into a Java program.
|
public static final software.amazon.disco.agent.logging.Logger log
public static final java.lang.String SQL_PREPARE_ORIGIN
@Advice.OnMethodEnter
public static software.amazon.disco.agent.event.ServiceRequestEvent enter(@Advice.Argument(value=0)
java.lang.String queryString,
@Advice.Origin
java.lang.String origin,
@Advice.This
java.sql.Connection conn)
queryString - The (potentially parameterized) query string provided by userorigin - Identifier of the intercepted method, for debugging/loggingconn - Connection object being used to prepare the statement/callServiceDownstreamRequestEvent, with fields filled out
on a best-effort basis, including the Connection as the request object.@Advice.OnMethodExit(onThrowable=java.lang.Throwable.class)
public static void exit(@Advice.Enter
software.amazon.disco.agent.event.ServiceRequestEvent requestEvent,
@Advice.Return
java.sql.PreparedStatement response,
@Advice.Thrown
java.lang.Throwable thrown)
Throwable.
It extracts the created statement and throwable if any and publishes a ServiceDownstreamResponseEvent.requestEvent - the disco event generated when this prepare request was maderesponse - the PreparedStatement returned by the Connectionthrown - the Throwable thrown by the connection, or null if preparation was successful.
Typically a SQLException.public net.bytebuddy.agent.builder.AgentBuilder install(net.bytebuddy.agent.builder.AgentBuilder agentBuilder)
install in interface software.amazon.disco.agent.interception.InstallableagentBuilder - - an AgentBuilder to append instructions toAgentBuilder object for chaining