Class Transaction
- java.lang.Object
-
- co.elastic.apm.agent.impl.transaction.AbstractSpan<Transaction>
-
- co.elastic.apm.agent.impl.transaction.Transaction
-
- All Implemented Interfaces:
Recyclable
public class Transaction extends AbstractSpan<Transaction>
Data captured by an agent representing an event occurring in a monitored service
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringTYPE_REQUEST-
Fields inherited from class co.elastic.apm.agent.impl.transaction.AbstractSpan
collectBreakdownMetrics, duration, finished, MS_IN_MICROS, name, PRIO_DEFAULT, PRIO_HIGH_LEVEL_FRAMEWORK, PRIO_LOW_LEVEL_FRAMEWORK, PRIO_METHOD_SIGNATURE, PRIO_USER_SUPPLIED, references, traceContext, tracer
-
-
Constructor Summary
Constructors Constructor Description Transaction(ElasticApmTracer tracer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCustomContext(java.lang.String key, java.lang.Boolean value)voidaddCustomContext(java.lang.String key, java.lang.Number value)voidaddCustomContext(java.lang.String key, java.lang.String value)protected voidafterEnd()voidbeforeEnd(long epochMicros)TransactionContextgetContext()ContextTransactionContextgetContextEnsureVisibility()Returns the context and ensures visibility when accessed from a different thread.java.lang.StringgetFrameworkName()java.lang.StringgetFrameworkVersion()java.lang.StringgetResult()The result of the transaction.SpanCountgetSpanCount()KeyListConcurrentHashMap<java.lang.String,KeyListConcurrentHashMap<java.lang.String,Timer>>getTimerBySpanTypeAndSubtype()TransactiongetTransaction()java.lang.StringgetType()voidignoreTransaction()Ignores this transaction, which makes it a noop so that it will not be reported to the APM Server.voidincrementReferences()booleanisNoop()protected voidrecycle()voidresetState()resets pooled object state so it can be reusedvoidsetFrameworkName(java.lang.String frameworkName)voidsetFrameworkVersion(java.lang.String frameworkVersion)voidsetUser(java.lang.String id, java.lang.String email, java.lang.String username, java.lang.String domain)voidsetUserFrameworkName(java.lang.String frameworkName)<T> Transactionstart(TraceContext.ChildContextCreator<T> childContextCreator, T parent, long epochMicros, Sampler sampler, java.lang.ClassLoader initiatingClassLoader)<T,A>
Transactionstart(TraceContext.ChildContextCreatorTwoArg<T,A> childContextCreator, T parent, A arg, long epochMicros, Sampler sampler, java.lang.ClassLoader initiatingClassLoader)TransactionstartNoop()protected Transactionthiz()java.lang.StringtoString()TransactionwithResult(java.lang.String result)The result of the transaction.TransactionwithResultIfUnset(java.lang.String result)The result of the transaction.TransactionwithType(java.lang.String type)Keyword of specific relevance in the service's domain (eg: 'request', 'backgroundjob')-
Methods inherited from class co.elastic.apm.agent.impl.transaction.AbstractSpan
activate, activateInScope, addLabel, addLabel, addLabel, appendToName, appendToName, asExit, captureException, captureException, captureExceptionAndGetErrorId, createExitSpan, createSpan, createSpan, deactivate, decrementReferences, end, end, endExceptionally, getAndOverrideName, getAndOverrideName, getChildIds, getDuration, getDurationMs, getNameAsString, getNameForSerialization, getOutcome, getReferenceCount, getSelfDuration, getTimestamp, getTraceContext, hasCapturedExceptions, isChildOf, isDiscardable, isDiscarded, isExit, isFinished, isReferenced, isSampled, onAfterStart, outcomeNotSet, propagateTraceContext, propagateTraceContext, requestDiscarding, setNonDiscardable, setStartTimestamp, setStartTimestampNow, withChildIds, withName, withName, withName, withOutcome, withUserOutcome
-
-
-
-
Field Detail
-
TYPE_REQUEST
public static final java.lang.String TYPE_REQUEST
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Transaction
public Transaction(ElasticApmTracer tracer)
-
-
Method Detail
-
getTransaction
public Transaction getTransaction()
- Specified by:
getTransactionin classAbstractSpan<Transaction>
-
start
public <T> Transaction start(TraceContext.ChildContextCreator<T> childContextCreator, @Nullable T parent, long epochMicros, Sampler sampler, @Nullable java.lang.ClassLoader initiatingClassLoader)
-
start
public <T,A> Transaction start(TraceContext.ChildContextCreatorTwoArg<T,A> childContextCreator, @Nullable T parent, A arg, long epochMicros, Sampler sampler, @Nullable java.lang.ClassLoader initiatingClassLoader)
-
startNoop
public Transaction startNoop()
-
getContext
public TransactionContext getContext()
ContextAny arbitrary contextual information regarding the event, captured by the agent, optionally provided by the user
- Specified by:
getContextin classAbstractSpan<Transaction>
-
getContextEnsureVisibility
public TransactionContext getContextEnsureVisibility()
Returns the context and ensures visibility when accessed from a different thread.- Returns:
- the transaction context
- See Also:
getContext()
-
withType
public Transaction withType(@Nullable java.lang.String type)
Keyword of specific relevance in the service's domain (eg: 'request', 'backgroundjob')
-
getResult
@Nullable public java.lang.String getResult()
The result of the transaction. HTTP status code for HTTP-related transactions.
-
withResultIfUnset
public Transaction withResultIfUnset(@Nullable java.lang.String result)
The result of the transaction. HTTP status code for HTTP-related transactions. This sets the result only if it is not already set. should be used for instrumentations
-
withResult
public Transaction withResult(@Nullable java.lang.String result)
The result of the transaction. HTTP status code for HTTP-related transactions. This sets the result regardless of an already existing value. should be used for user defined results
-
setUser
public void setUser(java.lang.String id, java.lang.String email, java.lang.String username, java.lang.String domain)
-
beforeEnd
public void beforeEnd(long epochMicros)
- Specified by:
beforeEndin classAbstractSpan<Transaction>
-
afterEnd
protected void afterEnd()
- Specified by:
afterEndin classAbstractSpan<Transaction>
-
getSpanCount
public SpanCount getSpanCount()
-
getTimerBySpanTypeAndSubtype
public KeyListConcurrentHashMap<java.lang.String,KeyListConcurrentHashMap<java.lang.String,Timer>> getTimerBySpanTypeAndSubtype()
-
resetState
public void resetState()
Description copied from interface:Recyclableresets pooled object state so it can be reused- Specified by:
resetStatein interfaceRecyclable- Overrides:
resetStatein classAbstractSpan<Transaction>
-
isNoop
public boolean isNoop()
-
ignoreTransaction
public void ignoreTransaction()
Ignores this transaction, which makes it a noop so that it will not be reported to the APM Server.
-
getType
@Nullable public java.lang.String getType()
-
addCustomContext
public void addCustomContext(java.lang.String key, java.lang.String value)
-
addCustomContext
public void addCustomContext(java.lang.String key, java.lang.Number value)
-
addCustomContext
public void addCustomContext(java.lang.String key, java.lang.Boolean value)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
incrementReferences
public void incrementReferences()
- Overrides:
incrementReferencesin classAbstractSpan<Transaction>
-
recycle
protected void recycle()
- Specified by:
recyclein classAbstractSpan<Transaction>
-
setFrameworkName
public void setFrameworkName(@Nullable java.lang.String frameworkName)
-
setUserFrameworkName
public void setUserFrameworkName(@Nullable java.lang.String frameworkName)
-
getFrameworkName
@Nullable public java.lang.String getFrameworkName()
-
setFrameworkVersion
public void setFrameworkVersion(@Nullable java.lang.String frameworkVersion)
-
getFrameworkVersion
@Nullable public java.lang.String getFrameworkVersion()
-
thiz
protected Transaction thiz()
- Specified by:
thizin classAbstractSpan<Transaction>
-
-