MiddlewareSpec

MiddlewareSpec

Describes the interface for middleware functions with this instrumentation.

Properties:
Name Type Attributes Default Description
req number | RouteRequestFunction <optional>
shim.FIRST

Indicates which argument to the middleware is the request object. It can also be a function to extract the request object from the middleware arguments.

res number <optional>
shim.SECOND

Indicates which argument to the middleware is the response object.

next number | RouteNextFunction <optional>
shim.THIRD

Indicates which argument to the middleware function is the callback. When it is a function, it will be called with the arguments of the middleware and a function for wrapping calls that represent continuation from the current middleware.

name string <optional>

The name to use for this middleware. Defaults to middleware.name.

params RouteParameterFunction <optional>

A function to extract the route parameters from the middleware arguments. Defaults to using req.params.

type string <optional>
'MIDDLEWARE'
route string | function <optional>
null

Route/path used for naming segments and transaction name candidates. If a function, will be invoked just before segment creation with middleware invocation.

appendPath boolean <optional>
true

Indicates that the path associated with the middleware should be appended and popped from the stack of name candidates.

Source: