Module: capture

Capture module.
Source:

Methods

(static) captureAsyncFunc(name, fcn, parentopt) → {*}

Wrap to automatically capture information for the sub/segment. You must close the segment manually from within the function.
Parameters:
Name Type Attributes Description
name string The name of the new subsegment.
fcn function The function context to wrap. Must take a single 'subsegment' argument and call 'subsegment.close([optional error])' when the async function completes.
parent Segment | Subsegment <optional>
The parent for the new subsegment, for manual mode.
Source:
Returns:
- Returns a promise by executing the provided async function.
Type
*

(static) captureCallbackFunc(name, fcn, parentopt)

Wrap to automatically capture information for the sub/segment. This wraps the callback and returns a function. when executed, all arguments are passed through accordingly. An additional argument is appended to gain access to the newly created subsegment. For this reason, always call the captured callback with the full list of arguments.
Parameters:
Name Type Attributes Description
name string The name of the new subsegment.
fcn function The function context to wrap. Can take a single 'subsegment' argument.
parent Segment | Subsegment <optional>
The parent for the new subsegment, for manual mode.
Source:

(static) captureFunc(name, fcn, parentopt) → {*}

Wrap to automatically capture information for the segment.
Parameters:
Name Type Attributes Description
name string The name of the new subsegment.
fcn function The function context to wrap. Can take a single 'subsegment' argument.
parent Segment | Subsegment <optional>
The parent for the new subsegment, for manual mode.
Source:
Returns:
- Returns the result if any by executing the provided function.
Type
*