Package com.newrelic.agent.bridge
Class NoOpInstrumentation
- java.lang.Object
-
- com.newrelic.agent.bridge.NoOpInstrumentation
-
- All Implemented Interfaces:
Instrumentation
public class NoOpInstrumentation extends java.lang.Object implements Instrumentation
-
-
Constructor Summary
Constructors Constructor Description NoOpInstrumentation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddToObjectCache(java.lang.Object object)ExitTracercreateScalaTxnTracer()ExitTracercreateSqlTracer(java.lang.Object invocationTarget, int signatureId, java.lang.String metricName, int flags)Create a sql tracer.ExitTracercreateTracer(java.lang.Object invocationTarget, int signatureId, boolean dispatcher, java.lang.String metricName, java.lang.String tracerFactoryName, java.lang.Object[] args)Create a tracer.ExitTracercreateTracer(java.lang.Object invocationTarget, int signatureId, java.lang.String metricName, int flags)Create a tracer.java.lang.ObjectgetCachedObject(int id)TransactiongetTransaction()Returns the current transaction.TransactiongetTransactionOrNull()Returns the current transaction.voidinstrument()Trace with transaction activity enabled (async=true) the first non-New Relic stack element on the current stack.voidinstrument(java.lang.reflect.Method methodToInstrument, java.lang.String metricPrefix)Add instrumentation for a given method of a given class only if no @InstrumentedMethod annotation is present.voidinstrument(java.lang.String className, java.lang.String metricPrefix)Adds instrumentation for all methods of a given class, but does not call retransform.java.lang.Class<?>loadClass(java.lang.ClassLoader classLoader, java.lang.Class<?> theClass)voidnoticeInstrumentationError(java.lang.Throwable throwable, java.lang.String libraryName)Log an instrumentation error.voidregisterCloseable(java.lang.String string, java.io.Closeable closeable)voidretransformUninstrumentedClass(java.lang.Class<?> classToRetransform)Re-transform a class if it hasn't already been instrumented (Annotated with @InstrumentedClass).
-
-
-
Method Detail
-
createTracer
public ExitTracer createTracer(java.lang.Object invocationTarget, int signatureId, java.lang.String metricName, int flags)
Description copied from interface:InstrumentationCreate a tracer. A call to this method is injected into methods that are traced with weaved implementations, trace annotations and custom xml.- Specified by:
createTracerin interfaceInstrumentation- Parameters:
invocationTarget- The instance of the object owning the method being invoked, or null for a static method.signatureId- The index of the ClassMethodSignature in the ClassMethodSignatures cache.- Returns:
- the Tracer on which to call finish()
-
noticeInstrumentationError
public void noticeInstrumentationError(java.lang.Throwable throwable, java.lang.String libraryName)Description copied from interface:InstrumentationLog an instrumentation error.- Specified by:
noticeInstrumentationErrorin interfaceInstrumentation
-
instrument
public void instrument(java.lang.String className, java.lang.String metricPrefix)Description copied from interface:InstrumentationAdds instrumentation for all methods of a given class, but does not call retransform.- Specified by:
instrumentin interfaceInstrumentation- Parameters:
className- - exact class name to instrument all methods.
-
instrument
public void instrument(java.lang.reflect.Method methodToInstrument, java.lang.String metricPrefix)Description copied from interface:InstrumentationAdd instrumentation for a given method of a given class only if no @InstrumentedMethod annotation is present. Does not instrument native, abstract, or interface methods. Calls retransform if necessary.- Specified by:
instrumentin interfaceInstrumentation- Parameters:
methodToInstrument- - exact method name along with its associated declared class to instrument.
-
instrument
public void instrument()
Description copied from interface:InstrumentationTrace with transaction activity enabled (async=true) the first non-New Relic stack element on the current stack. Often customers will call APIs likeToken.link(), which need to be called within a transaction, without having instrumented code to start a transaction. We can detect that case and instrument the calling method. This will be rate limited to reduce the overhead, controlled by the config class_transformer:auto_async_link_rate_limit- Specified by:
instrumentin interfaceInstrumentation
-
retransformUninstrumentedClass
public void retransformUninstrumentedClass(java.lang.Class<?> classToRetransform)
Description copied from interface:InstrumentationRe-transform a class if it hasn't already been instrumented (Annotated with @InstrumentedClass). Classes that have instrumentation added or removed will not be affected.- Specified by:
retransformUninstrumentedClassin interfaceInstrumentation
-
loadClass
public java.lang.Class<?> loadClass(java.lang.ClassLoader classLoader, java.lang.Class<?> theClass) throws java.lang.ClassNotFoundException- Specified by:
loadClassin interfaceInstrumentation- Throws:
java.lang.ClassNotFoundException
-
getTransaction
public Transaction getTransaction()
Description copied from interface:InstrumentationReturns the current transaction. This should not be called directly - instead useAgent.getTransaction().- Specified by:
getTransactionin interfaceInstrumentation- Returns:
- Tx on thread or created Tx
-
getTransactionOrNull
public Transaction getTransactionOrNull()
Description copied from interface:InstrumentationReturns the current transaction. This should not be called directly- Specified by:
getTransactionOrNullin interfaceInstrumentation- Returns:
- Tx on thread, or null.
-
addToObjectCache
public int addToObjectCache(java.lang.Object object)
- Specified by:
addToObjectCachein interfaceInstrumentation
-
getCachedObject
public java.lang.Object getCachedObject(int id)
- Specified by:
getCachedObjectin interfaceInstrumentation
-
registerCloseable
public void registerCloseable(java.lang.String string, java.io.Closeable closeable)- Specified by:
registerCloseablein interfaceInstrumentation
-
createTracer
public ExitTracer createTracer(java.lang.Object invocationTarget, int signatureId, boolean dispatcher, java.lang.String metricName, java.lang.String tracerFactoryName, java.lang.Object[] args)
Description copied from interface:InstrumentationCreate a tracer. A call to this method is injected into methods that are traced because of yaml configuration.- Specified by:
createTracerin interfaceInstrumentation- Parameters:
invocationTarget- The instance of the object owning the method being invoked, or null for a static method.signatureId- The index of the ClassMethodSignature in the ClassMethodSignatures cache.dispatcher- If true, this should be treated as the start of a transaction if a transaction is not already in progress.args- The arguments passed in the method invocation.- Returns:
- the Tracer on which to call finish()
-
createSqlTracer
public ExitTracer createSqlTracer(java.lang.Object invocationTarget, int signatureId, java.lang.String metricName, int flags)
Description copied from interface:InstrumentationCreate a sql tracer. A call to this method is injected into methods that are traced with weaved implementations, trace annotations and custom xml where thecom.newrelic.agent.bridge.datastore.DatastoreMetrics#noticeSql(ConnectionFactory, String, Object[])method is used. The sql tracer properly handles queueing up and managing explain plans for slow sql.- Specified by:
createSqlTracerin interfaceInstrumentation- Parameters:
invocationTarget- The instance of the object owning the method being invoked, or null for a static method.signatureId- The index of the ClassMethodSignature in the ClassMethodSignatures cache.- Returns:
- the Tracer on which to call finish()
-
createScalaTxnTracer
public ExitTracer createScalaTxnTracer()
- Specified by:
createScalaTxnTracerin interfaceInstrumentation
-
-