TracingChannel

The class TracingChannel is a collection of TracingChannel Channels which together express a single traceable action. It is used to formalize and simplify the process of producing events for tracing application flow. {@link tracingChannel} is used to construct a TracingChannel. As with Channel it is recommended to create and reuse a single TracingChannel at the top-level of the file rather than creating them dynamically.

Since

v19.9.0

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override var asyncEnd: Channel<StoreType, ContextType>
Link copied to clipboard
Link copied to clipboard
open override var end: Channel<StoreType, ContextType>
Link copied to clipboard
open override var error: Channel<StoreType, ContextType>
Link copied to clipboard
open override var start: Channel<StoreType, ContextType>

Functions

Link copied to clipboard

Helper to subscribe a collection of functions to the corresponding channels. This is the same as calling channel.subscribe(onMessage) on each channel individually.

Link copied to clipboard
fun <Fn : Function<Any?>> traceCallback(fn: Fn, position: Double?, context: ContextType?, thisArg: Any?, vararg args: Any?)

Trace a callback-receiving function call. This will always produce a start event and end event around the synchronous portion of the function execution, and will produce a asyncStart event and asyncEnd event around the callback execution. It may also produce an error event if the given function throws an error or the returned promise rejects. This will run the given function using channel.runStores(context, ...) on the start channel which ensures all events should have any bound stores set to match this trace context.

Link copied to clipboard
fun <ThisArg, Args : ReadonlyArray<Any?>> tracePromise(fn: Function<Promise<Any?>>, context: ContextType = definedExternally, thisArg: ThisArg = definedExternally, vararg args: Any?)

Trace a promise-returning function call. This will always produce a start event and end event around the synchronous portion of the function execution, and will produce an asyncStart event and asyncEnd event when a promise continuation is reached. It may also produce an error event if the given function throws an error or the returned promise rejects. This will run the given function using channel.runStores(context, ...) on the start channel which ensures all events should have any bound stores set to match this trace context.

Link copied to clipboard
fun <ThisArg, Args : ReadonlyArray<Any?>> traceSync(fn: Function<Any?>, context: ContextType = definedExternally, thisArg: ThisArg = definedExternally, vararg args: Any?)

Trace a synchronous function call. This will always produce a start event and end event around the execution and may produce an error event if the given function throws an error. This will run the given function using channel.runStores(context, ...) on the start channel which ensures all events should have any bound stores set to match this trace context.

Link copied to clipboard

Helper to unsubscribe a collection of functions from the corresponding channels. This is the same as calling channel.unsubscribe(onMessage) on each channel individually.