Package co.elastic.apm.agent.impl
Interface Tracer
-
- All Known Implementing Classes:
ElasticApmTracer,GlobalTracer
public interface Tracer
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classTracer.TracerStateAn enumeration used to represent the current tracer state.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringcaptureAndReportException(long epochMicros, java.lang.Throwable e, AbstractSpan<?> parent)voidcaptureAndReportException(java.lang.Throwable e, java.lang.ClassLoader initiatingClassLoader)Captures an exception without providing an explicit reference to a parentAbstractSpanErrorCapturecaptureException(java.lang.Throwable e, AbstractSpan<?> parent, java.lang.ClassLoader initiatingClassLoader)SpancreateExitChildSpan()TransactioncurrentTransaction()AbstractSpan<?>getActive()SpangetActiveExitSpan()SpangetActiveSpan()Tracer.TracerStategetState()booleanisRunning()voidoverrideServiceNameForClassLoader(java.lang.ClassLoader classLoader, java.lang.String serviceName)Overrides the service name for allTransactions,Spans andErrorCaptures which are created by the service which corresponds to the providedClassLoader.<C> TransactionstartChildTransaction(C headerCarrier, BinaryHeaderGetter<C> binaryHeadersGetter, Sampler sampler, long epochMicros, java.lang.ClassLoader initiatingClassLoader)Starts a transaction as a child of the context headers obtained through the providedHeaderGetter.<C> TransactionstartChildTransaction(C headerCarrier, BinaryHeaderGetter<C> binaryHeadersGetter, java.lang.ClassLoader initiatingClassLoader)Starts a transaction as a child of the context headers obtained through the providedHeaderGetter.<C> TransactionstartChildTransaction(C headerCarrier, TextHeaderGetter<C> textHeadersGetter, Sampler sampler, long epochMicros, java.lang.ClassLoader initiatingClassLoader)Starts a transaction as a child of the context headers obtained through the providedHeaderGetter.<C> TransactionstartChildTransaction(C headerCarrier, TextHeaderGetter<C> textHeadersGetter, java.lang.ClassLoader initiatingClassLoader)Starts a transaction as a child of the context headers obtained through the providedHeaderGetter.<C> TransactionstartChildTransaction(C headerCarrier, TextHeaderGetter<C> textHeadersGetter, java.lang.ClassLoader initiatingClassLoader, long epochMicros)TransactionstartRootTransaction(Sampler sampler, long epochMicros, java.lang.ClassLoader initiatingClassLoader)Starts a trace-root transaction with a specified sampler and start timestampTransactionstartRootTransaction(java.lang.ClassLoader initiatingClassLoader)Starts a trace-root transactionTransactionstartRootTransaction(java.lang.ClassLoader initiatingClassLoader, long epochMicro)voidstop()Called when the container shuts down.
-
-
-
Method Detail
-
startRootTransaction
@Nullable Transaction startRootTransaction(@Nullable java.lang.ClassLoader initiatingClassLoader)
Starts a trace-root transaction- Parameters:
initiatingClassLoader- the class loader corresponding to the service which initiated the creation of the transaction. Used to determine the service name.- Returns:
- a transaction that will be the root of the current trace if the agent is currently RUNNING; null otherwise
-
startRootTransaction
@Nullable Transaction startRootTransaction(@Nullable java.lang.ClassLoader initiatingClassLoader, long epochMicro)
-
startRootTransaction
@Nullable Transaction startRootTransaction(Sampler sampler, long epochMicros, @Nullable java.lang.ClassLoader initiatingClassLoader)
Starts a trace-root transaction with a specified sampler and start timestamp- Parameters:
sampler- theSamplerinstance which is responsible for determining the sampling decision if this is a root transactionepochMicros- the start timestampinitiatingClassLoader- the class loader corresponding to the service which initiated the creation of the transaction. Used to determine the service name and to load application-scoped classes like theMDC, for log correlation.- Returns:
- a transaction that will be the root of the current trace if the agent is currently RUNNING; null otherwise
-
startChildTransaction
@Nullable <C> Transaction startChildTransaction(@Nullable C headerCarrier, TextHeaderGetter<C> textHeadersGetter, @Nullable java.lang.ClassLoader initiatingClassLoader)
Starts a transaction as a child of the context headers obtained through the providedHeaderGetter. If the created transaction cannot be started as a child transaction (for example - if no parent context header is available), then it will be started as the root transaction of the trace.- Parameters:
headerCarrier- the Object from which context headers can be obtained, typically a request or a messagetextHeadersGetter- provides the trace context headers required in order to create a child transactioninitiatingClassLoader- the class loader corresponding to the service which initiated the creation of the transaction. Used to determine the service name.- Returns:
- a transaction which is a child of the provided parent if the agent is currently RUNNING; null otherwise
-
startChildTransaction
@Nullable <C> Transaction startChildTransaction(@Nullable C headerCarrier, TextHeaderGetter<C> textHeadersGetter, @Nullable java.lang.ClassLoader initiatingClassLoader, long epochMicros)
-
startChildTransaction
@Nullable <C> Transaction startChildTransaction(@Nullable C headerCarrier, TextHeaderGetter<C> textHeadersGetter, Sampler sampler, long epochMicros, @Nullable java.lang.ClassLoader initiatingClassLoader)
Starts a transaction as a child of the context headers obtained through the providedHeaderGetter. If the created transaction cannot be started as a child transaction (for example - if no parent context header is available), then it will be started as the root transaction of the trace.- Parameters:
headerCarrier- the Object from which context headers can be obtained, typically a request or a messagetextHeadersGetter- provides the trace context headers required in order to create a child transactionsampler- theSamplerinstance which is responsible for determining the sampling decision if this is a root transactionepochMicros- the start timestampinitiatingClassLoader- the class loader corresponding to the service which initiated the creation of the transaction. Used to determine the service name and to load application-scoped classes like theMDC, for log correlation.- Returns:
- a transaction which is a child of the provided parent if the agent is currently RUNNING; null otherwise
-
startChildTransaction
@Nullable <C> Transaction startChildTransaction(@Nullable C headerCarrier, BinaryHeaderGetter<C> binaryHeadersGetter, @Nullable java.lang.ClassLoader initiatingClassLoader)
Starts a transaction as a child of the context headers obtained through the providedHeaderGetter. If the created transaction cannot be started as a child transaction (for example - if no parent context header is available), then it will be started as the root transaction of the trace.- Parameters:
headerCarrier- the Object from which context headers can be obtained, typically a request or a messagebinaryHeadersGetter- provides the trace context headers required in order to create a child transactioninitiatingClassLoader- the class loader corresponding to the service which initiated the creation of the transaction. Used to determine the service name.- Returns:
- a transaction which is a child of the provided parent if the agent is currently RUNNING; null otherwise
-
startChildTransaction
@Nullable <C> Transaction startChildTransaction(@Nullable C headerCarrier, BinaryHeaderGetter<C> binaryHeadersGetter, Sampler sampler, long epochMicros, @Nullable java.lang.ClassLoader initiatingClassLoader)
Starts a transaction as a child of the context headers obtained through the providedHeaderGetter. If the created transaction cannot be started as a child transaction (for example - if no parent context header is available), then it will be started as the root transaction of the trace.- Parameters:
headerCarrier- the Object from which context headers can be obtained, typically a request or a messagebinaryHeadersGetter- provides the trace context headers required in order to create a child transactionsampler- theSamplerinstance which is responsible for determining the sampling decision if this is a root transactionepochMicros- the start timestampinitiatingClassLoader- the class loader corresponding to the service which initiated the creation of the transaction. Used to determine the service name and to load application-scoped classes like theMDC, for log correlation.- Returns:
- a transaction which is a child of the provided parent if the agent is currently RUNNING; null otherwise
-
currentTransaction
@Nullable Transaction currentTransaction()
-
getActive
@Nullable AbstractSpan<?> getActive()
-
getActiveSpan
@Nullable Span getActiveSpan()
-
captureAndReportException
void captureAndReportException(@Nullable java.lang.Throwable e, java.lang.ClassLoader initiatingClassLoader)Captures an exception without providing an explicit reference to a parentAbstractSpan- Parameters:
e- the exception to captureinitiatingClassLoader- the class
-
captureAndReportException
@Nullable java.lang.String captureAndReportException(long epochMicros, @Nullable java.lang.Throwable e, @Nullable AbstractSpan<?> parent)
-
captureException
@Nullable ErrorCapture captureException(@Nullable java.lang.Throwable e, @Nullable AbstractSpan<?> parent, @Nullable java.lang.ClassLoader initiatingClassLoader)
-
getActiveExitSpan
@Nullable Span getActiveExitSpan()
-
getState
Tracer.TracerState getState()
-
overrideServiceNameForClassLoader
void overrideServiceNameForClassLoader(@Nullable java.lang.ClassLoader classLoader, @Nullable java.lang.String serviceName)Overrides the service name for allTransactions,Spans andErrorCaptures which are created by the service which corresponds to the providedClassLoader.The main use case is being able to differentiate between multiple services deployed to the same application server.
- Parameters:
classLoader- the class loader which corresponds to a particular serviceserviceName- the service name for this class loader
-
stop
void stop()
Called when the container shuts down. Cleans up thread pools and other resources.
-
isRunning
boolean isRunning()
-
createExitChildSpan
@Nullable Span createExitChildSpan()
-
-