Package org.glowroot.agent.plugin.api
Interface TraceEntry
- All Known Subinterfaces:
AsyncQueryEntry,AsyncTraceEntry,QueryEntry
public interface TraceEntry
See
ThreadContext.startTraceEntry(MessageSupplier, TimerName) for how to create and use
TraceEntry instances.-
Method Summary
Modifier and TypeMethodDescriptionvoidend()End the entry.voidendWithError(String message) End the entry and mark the trace entry as an error with the specified throwable.voidendWithError(String message, Throwable t) End the entry and add the specifiederrorMessageto the entry.voidEnd the entry and mark the trace entry as an error with the specified throwable.voidThis method is the same asendWithError(Throwable), except that it won't escalate a dummy entry into a real entry.voidendWithLocationStackTrace(long threshold, TimeUnit unit) End the entry and capture a stack trace if its total time exceeds the specifiedthreshold.extend()Example of query and subsequent iterating over results which goes back to database and pulls more results.Returns the message supplier that was supplied when theTraceEntrywas created.
-
Method Details
-
end
void end()End the entry. -
endWithLocationStackTrace
End the entry and capture a stack trace if its total time exceeds the specifiedthreshold. In case the trace has accumulatedmaxTraceEntriesPerTransactionentries and this is a dummy entry and its total time exceeds the specified threshold, then this dummy entry is escalated into a real entry. A hard cap (maxTraceEntriesPerTransaction * 2) on the total number of (real) entries is applied when escalating dummy entries to real entries. This is a no-op for async trace entries (those created byThreadContext.startAsyncTraceEntry(MessageSupplier, TimerName)andThreadContext.startAsyncQueryEntry(String, String, QueryMessageSupplier, TimerName)). This is because async trace entries are used when their end is performed by a different thread, and so a stack trace at that time does not point to the code which executed triggered the trace entry creation. -
endWithError
End the entry and mark the trace entry as an error with the specified throwable. The error message text is captured fromThrowable#getMessage(). If this is the root entry, then the error flag on the transaction is set. In case the transaction has accumulatedmaxTraceEntriesPerTransactionentries and this is a dummy entry, then this dummy entry is escalated into a real entry. A hard cap (maxTraceEntriesPerTransaction * 2) on the total number of (real) entries is applied when escalating dummy entries to real entries. -
endWithError
End the entry and mark the trace entry as an error with the specified throwable. If this is the root entry, then the error flag on the transaction is set. In case the transaction has accumulatedmaxTraceEntriesPerTransactionentries and this is a dummy entry, then this dummy entry is escalated into a real entry. A hard cap (maxTraceEntriesPerTransaction * 2) on the total number of (real) entries is applied when escalating dummy entries to real entries. -
endWithError
End the entry and add the specifiederrorMessageto the entry. Ifmessageis empty or null, then the error message text is captured fromThrowable#getMessage(). If this is the root entry, then the error flag on the transaction is set. In case the transaction has accumulatedmaxTraceEntriesPerTransactionentries and this is a dummy entry, then this dummy entry is escalated into a real entry. A hard cap (maxTraceEntriesPerTransaction * 2) on the total number of (real) entries is applied when escalating dummy entries to real entries. -
endWithInfo
This method is the same asendWithError(Throwable), except that it won't escalate a dummy entry into a real entry. -
extend
Timer extend()Example of query and subsequent iterating over results which goes back to database and pulls more results. Important note for async trace entries (those created byThreadContext.startAsyncTraceEntry(MessageSupplier, TimerName)andThreadContext.startAsyncQueryEntry(String, String, QueryMessageSupplier, TimerName)): this method should not be used by a thread other than the one that created the async trace entry. -
getMessageSupplier
Object getMessageSupplier()Returns the message supplier that was supplied when theTraceEntrywas created. This can be useful (for example) to retrieve the message supplier in @OnReturnso that the return value can be added to the message produced by theMessageSupplier. This returns the message supplier even if the trace has accumulatedmaxTraceEntriesPerTransactionentries and this is a dummy entry. Under some error conditions this can returnnull.
-