Creates a wrapper around the input function that, when invoked, executes the given function inside a new span. When you don't need to manually alter the span before it is closed and reported, the success and error callbacks can be omitted. In this case, when the function ends, it either returns its result (or void) back to the caller or throws an error. In both cases, the span enclosing the function's execution is always properly closed and reported, enriched with additional error information, if applicable.
On the other hand, when you need access to the span (at the end of the function) just before it is finalized, you can specify the success and error callbacks, within which you will have access to the span. You can now add your custom tags/logs to the span. The span must be explicity closed in the body of both callbacks by invoking its finish method.
The function to be wrapped in a span.
The operation name to be recorded in the span.
The optional SpanOptions object that describes the span.
The optional success callback. It is called with two parameters:
result
- containing the result of invoking fn
.span
- the Span object that was used to
instrument fn
.The optional error callback. It is called with two parameters:
The wrapper function that accepts the same arguments as fn.
Clears the global tracer's memory of all trace and span context. Useful when it is desired to manually start a fresh trace. Normally required only in test suite runs.
Registers a task while ensuring that the trace context is correctly propagated over to the V8 context where the task is actually run. The function executed by the task is wrapped in a new span which carries the same trace context that was active at the time of registering the task.
The object describing the task.
The operation name to be recorded in the span.
The optional SpanOptions object that describes the span.
Start a transaction while ensuring that the trace context is correctly propagated over to the V8 context where the transaction is actually run. The command executed by the transaction is wrapped in a new span which carries the same trace context that was active in the V8 context that invoked the transaction.
The Transaction description.
The operation name to be recorded in the span.
The optional SpanOptions object that describes the span.
Generates a 64-bit UUID string.
The generated UUID string.
Initializes the global tracer at application startup. This should be called as early as possible (and only once) when application starts.
Executes the given query inside a new span and returns the resultant cursor. The enclosing span records query stats (available within the cursor object) in its logs.
The AQL Query to execute.
The operation name to be recorded in the span.
The optional SpanOptions object that describes the span.
The Cursor that is created as a result of running the query.
Start a new span. Useful when it is desired to manually start a fresh trace. Normally required only in test suite runs.
The operation name to be recorded in the span.
The optional SpanOptions object that describes the span.
The created Span.
Generated using TypeDoc
This module exports a number of utility functions that are used throughout the application being traced. Some functions are specifically meant to be called at application startup to initialize the global tracer, set up trace headers, etc.
This module is re-exported as a top-level export.
See the quickstart for a primer on how to set up your application for tracing.