RecorderSpec

RecorderSpec

The return value from a RecorderFunction, used to set the parameters of segment creation and lifetime. Extends the SegmentSpec.

Properties:
Name Type Attributes Default Description
stream bool | string <optional>

Indicates if the return value from the wrapped function is a stream. If the value is truthy then the recording will extend to the end event of the stream. If the value is a string it is assumed to be the name of an event to measure. A segment will be created to record emissions of the event.

promise bool <optional>

Indicates if the return value from the wrapped function is a Promise. If the value is truthy then the recording will extend to the completion of the Promise.

callback number | CallbackBindFunction <optional>

If this is a number, it identifies which argument is the callback and the segment will also be bound to the callback. Otherwise, the passed function should perform the segment binding itself.

rowCallback number | CallbackBindFunction <optional>

Like callback, this identifies a callback function in the arguments. The difference is that the default behavior for row callbacks is to only create one segment for all calls to the callback. This is mostly useful for functions which will be called repeatedly, such as once for each item in a result set.

internal bool <optional>
false

Marks this as the boundary point into the instrumented library. If true and the current segment is also marked as internal by the same shim, then we will not record this inner activity.

This is useful when instrumenting a library which implements high-order methods which simply call other public methods and you only want to record the method directly called by the user while still instrumenting all endpoints.

after function <optional>
null

A function to call after the synchronous execution of the recorded method. If the function synchronously threw an error, that error will be handed to this function.

callbackRequired bool <optional>

When true, a recorded method must be called with a callback for a segment to be created. Does not apply if a custom callback method has been assigned via callback.

Source:
See:

Extends