public class DefaultSqlTracer extends DefaultTracer implements SqlTracer, java.lang.Comparable<DefaultSqlTracer>
BACKTRACE_PARAMETER_NAME, DEFAULT_TRACER_FLAGS, NULL_METRIC_NAME_FORMATTER
ATTRIBUTE_TYPE
DATABASE_VENDOR_PARAMETER_NAME, EXPLAIN_PLAN_FORMAT_PARAMETER_NAME, EXPLAIN_PLAN_PARAMETER_NAME, SQL_OBFUSCATED_PARAMETER_NAME, SQL_PARAMETER_NAME
Constructor and Description |
---|
DefaultSqlTracer(TransactionActivity txa,
ClassMethodSignature sig,
java.lang.Object object,
MetricNameFormat metricNameFormatter,
int tracerFlags) |
DefaultSqlTracer(TransactionActivity txa,
ClassMethodSignature sig,
java.lang.Object object,
MetricNameFormat metricNameFormatter,
int tracerFlags,
long pStartTime) |
DefaultSqlTracer(Transaction transaction,
ClassMethodSignature sig,
java.lang.Object object,
MetricNameFormat metricNameFormatter,
int tracerFlags) |
DefaultSqlTracer(Transaction transaction,
ClassMethodSignature sig,
java.lang.Object object,
MetricNameFormat metricNameFormatter,
int tracerFlags,
long time) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(DefaultSqlTracer otherTracer) |
protected ExplainPlanExecutor |
createExplainPlanExecutor(java.lang.String sql) |
protected void |
doFinish(int opcode,
java.lang.Object returnValue)
Subclasses may override.
|
protected void |
doFinish(java.lang.Throwable throwable)
Subclasses may override.
|
com.newrelic.agent.bridge.datastore.ConnectionFactory |
getConnectionFactory()
Returns a ConnectionFactory instance which can create a database connection on demand.
|
java.lang.String |
getDatabaseName() |
protected com.newrelic.agent.bridge.datastore.DatabaseVendor |
getDatabaseVendor() |
ExplainPlanExecutor |
getExplainPlanExecutor()
Return an executor class that can run explain plans for the given (Prepared)Statement.
|
java.lang.String |
getHost()
Returns the host of database instance used to run the query.
|
java.lang.String |
getIdentifier() |
java.lang.Object[] |
getParams()
Returns an Object array containing the parameters (in order) that were set on a PreparedStatement.
|
java.lang.Integer |
getPort()
Returns the port of database instance used to run the query.
|
java.lang.String |
getRawSql()
Returns the raw sql string that was used for a given query.
|
java.lang.Object |
getSql()
Returns the sql for the statement instrumented by this driver.
|
boolean |
hasExplainPlan()
Verify if this SqlTracer has an explain plan associated with it.
|
boolean |
isMetricProducer() |
static java.lang.String |
parameterizeSql(java.lang.String sql,
java.lang.Object[] parameters)
Substitute values from the parameter map in the SQL.
|
void |
provideConnection(java.sql.Connection conn)
Grab the host and port from the connection and store it on this tracer.
|
protected void |
recordMetrics(TransactionStats transactionStats)
Need to override this method to record Datastore metrics before the scoped metric name is recorded
|
void |
setConnectionFactory(com.newrelic.agent.bridge.datastore.ConnectionFactory connectionFactory)
Store a connection factory instance on this SqlTracer for later use.
|
void |
setDatabaseName(java.lang.String databaseName) |
void |
setExplainPlan(java.lang.Object... explainPlan) |
void |
setHost(java.lang.String host) |
void |
setIdentifier(java.lang.String identifier) |
void |
setParams(java.lang.Object[] params)
Store the parameters for this sql statement (must be in order).
|
void |
setPort(int port) |
void |
setRawSql(java.lang.String sql)
Store the raw sql string on this tracer.
|
protected boolean |
shouldStoreStackTrace() |
addOutboundRequestHeaders, childTracerFinished, childTracerFinished, doRecordMetrics, finish, finish, getChildCount, getClassMethodSignature, getDuration, getDurationInMilliseconds, getEndTime, getEndTimeInMilliseconds, getExclusiveDuration, getExternalParameters, getGuid, getInvocationTarget, getMetricName, getMetricNameFormat, getParentTracer, getRequestMetricName, getRunningDurationInNanos, getStartTime, getStartTimeInMillis, getStartTimeInMilliseconds, getTransactionSegment, getTransactionSegmentName, getTransactionSegmentUri, isAsync, isChildHasStackTrace, isLeaf, isParent, isTransactionSegment, performFinishWork, readInboundResponseHeaders, removeTransactionSegment, reportAsExternal, reportAsExternal, reset, setMetricName, setMetricNameFormat, setMetricNameFormatInfo, setParentTracer, storeStackTrace
addCustomAttribute, addCustomAttribute, addCustomAttribute, addCustomAttributes, addExclusiveRollupMetricName, addRollupMetricName, getAgentAttribute, getAgentAttributes, getCustomAttribute, getCustomAttributes, getException, getExclusiveRollupMetricNames, getParentTracedMethod, getParentTracerWithSpan, getRollupMetricNames, getTransaction, getTransactionActivity, invoke, isTrackCallbackRunnable, markFinishTime, nameTransaction, removeAgentAttribute, setAgentAttribute, setAttribute, setCustomMetricPrefix, setNoticedError, setRollupMetricNames, setThrownException, setTrackCallbackRunnable, setTrackChildThreads, trackChildThreads, wasExceptionSetByAPI
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTransaction
childTracerFinished, getAgentAttribute, getAgentAttributes, getChildCount, getClassMethodSignature, getCustomAttributes, getEndTime, getEndTimeInMilliseconds, getExclusiveDuration, getExternalParameters, getGuid, getMetricName, getParentTracer, getRunningDurationInNanos, getStartTime, getStartTimeInMillis, getStartTimeInMilliseconds, getTransactionActivity, getTransactionSegment, getTransactionSegmentName, getTransactionSegmentUri, isAsync, isChildHasStackTrace, isLeaf, isParent, isTransactionSegment, markFinishTime, removeAgentAttribute, removeTransactionSegment, setAgentAttribute, setParentTracer
getDuration, getDurationInMilliseconds
addExclusiveRollupMetricName, addOutboundRequestHeaders, getParentTracedMethod, isTrackCallbackRunnable, nameTransaction, readInboundResponseHeaders, reportAsExternal, setCustomMetricPrefix, setMetricNameFormatInfo, setRollupMetricNames, setTrackCallbackRunnable, setTrackChildThreads, trackChildThreads
addRollupMetricName, reportAsExternal, setMetricName
addCustomAttribute, addCustomAttribute, addCustomAttribute, addCustomAttributes
getException, setNoticedError, setThrownException, wasExceptionSetByAPI
public DefaultSqlTracer(Transaction transaction, ClassMethodSignature sig, java.lang.Object object, MetricNameFormat metricNameFormatter, int tracerFlags)
public DefaultSqlTracer(Transaction transaction, ClassMethodSignature sig, java.lang.Object object, MetricNameFormat metricNameFormatter, int tracerFlags, long time)
public DefaultSqlTracer(TransactionActivity txa, ClassMethodSignature sig, java.lang.Object object, MetricNameFormat metricNameFormatter, int tracerFlags)
public DefaultSqlTracer(TransactionActivity txa, ClassMethodSignature sig, java.lang.Object object, MetricNameFormat metricNameFormatter, int tracerFlags, long pStartTime)
public com.newrelic.agent.bridge.datastore.ConnectionFactory getConnectionFactory()
SqlTracer
getConnectionFactory
in interface SqlTracer
public void setConnectionFactory(com.newrelic.agent.bridge.datastore.ConnectionFactory connectionFactory)
SqlTracer
NoticeSqlVisitor
setConnectionFactory
in interface SqlTracer
connectionFactory
- The ConnectionFactory instance to storepublic void setHost(java.lang.String host)
public void setPort(int port)
public java.lang.String getRawSql()
SqlTracer
public void provideConnection(java.sql.Connection conn)
SqlTracer
provideConnection
in interface SqlTracer
conn
- the connection instance to grab frompublic java.lang.String getHost()
SqlTracer
public java.lang.Integer getPort()
SqlTracer
public void setRawSql(java.lang.String sql)
SqlTracer
NoticeSqlVisitor
public java.lang.Object[] getParams()
SqlTracer
public void setParams(java.lang.Object[] params)
SqlTracer
NoticeSqlVisitor
protected com.newrelic.agent.bridge.datastore.DatabaseVendor getDatabaseVendor()
protected void doFinish(java.lang.Throwable throwable)
DefaultTracer
doFinish
in class DefaultTracer
protected void doFinish(int opcode, java.lang.Object returnValue)
DefaultTracer
doFinish
in class DefaultTracer
protected boolean shouldStoreStackTrace()
shouldStoreStackTrace
in class DefaultTracer
public boolean isMetricProducer()
isMetricProducer
in class DefaultTracer
protected void recordMetrics(TransactionStats transactionStats)
recordMetrics
in class DefaultTracer
public java.lang.Object getSql()
getSql
in interface SqlTracerExplainInfo
JSONAware
instance.public boolean hasExplainPlan()
SqlTracerExplainInfo
hasExplainPlan
in interface SqlTracerExplainInfo
public ExplainPlanExecutor getExplainPlanExecutor()
SqlTracerExplainInfo
getExplainPlanExecutor
in interface SqlTracerExplainInfo
protected ExplainPlanExecutor createExplainPlanExecutor(java.lang.String sql)
public void setExplainPlan(java.lang.Object... explainPlan)
setExplainPlan
in interface SqlTracerExplainInfo
public int compareTo(DefaultSqlTracer otherTracer)
compareTo
in interface java.lang.Comparable<DefaultSqlTracer>
public void setIdentifier(java.lang.String identifier)
public java.lang.String getIdentifier()
public void setDatabaseName(java.lang.String databaseName)
public java.lang.String getDatabaseName()
public static java.lang.String parameterizeSql(java.lang.String sql, java.lang.Object[] parameters) throws java.lang.Exception
sql
- the SQLparameters
- the parameter mapjava.lang.Exception