• Public
  • Public/Protected
  • All

Interface http

This plugin automatically instruments the http module.

By default any option set at the root will apply to both clients and servers. To configure only one or the other, use the client and server options.


  • HttpClient
  • HttpServer
    • http



Optional analytics

analytics: boolean | number | object

Whether to enable App Analytics. Can also be set to a number instead to control the sample rate, or to an key-value pair with span names as keys and booleans or sample rates as values for more granular control.

Optional blacklist

blacklist: string | RegExp | function | (string | RegExp | function)[]

List of URLs that should not be instrumented. Takes precedence over whitelist if a URL matches an entry in both.



Optional client

client: HttpClient

Configuration for HTTP clients.

Optional enabled

enabled: boolean

Whether to enable the plugin.



Optional headers

headers: string[]

An array of headers to include in the span metadata.



Optional hooks

hooks: object

Hooks to run before spans are finished.

Type declaration

  • Optional request?: function

    Hook to execute just before the request span finishes.

      • (span?: opentracing.Span, req?: IncomingMessage | ClientRequest, res?: ServerResponse | IncomingMessage): any
      • Parameters

        • Optional span: opentracing.Span
        • Optional req: IncomingMessage | ClientRequest
        • Optional res: ServerResponse | IncomingMessage

        Returns any

Optional server

server: HttpServer

Configuration for HTTP servers.

Optional service

service: string

The service name to be used for this plugin.

Optional splitByDomain

splitByDomain: boolean

Use the remote endpoint host as the service name instead of the default.



Optional validateStatus

validateStatus: function

Callback function to determine if there was an error. It should take a status code as its only parameter and return true for success or false for errors.


code => code < 400

Type declaration

    • (code: number): boolean
    • Parameters

      • code: number

      Returns boolean

Optional whitelist

whitelist: string | RegExp | function | (string | RegExp | function)[]

List of URLs that should be instrumented.



Generated using TypeDoc