Node.js agent attributes

In New Relic products, attributes are key-value pairs collected from your application's transactions and events. New Relic's Node.js agent collects some basic attributes from the HTTP request and response headers.

Node.js agent attributes

The New Relic Node.js agent captures some basic HTTP header data by default, like the HTTP response code and the request method. New Relic refers to this default data as agent attributes. Data for attributes collected by the New Relic Node.js agent appears in:

  • Transaction events
  • Transaction traces
  • Error traces
  • Error events

You can also add custom instrumentation to capture any other attributes.

Here are the default attributes collected by the Node.js agent:

request.headers.accept

The type as read from the HTTP request's Accept header.

request.headers.host

The name from the host's HTTP request header.

request.headers.referer

The incoming request referer as read from the Referer request header.

request.headers.userAgent

The contents of the User-Agent HTTP header.

request.method

The HTTP method of the incoming request.

httpResponseCode

The response status code for a web request.

httpResponseMessage

The response status message for a web request, if present.

response.headers.contentLength

The outgoing response size in bytes as read from the Content-Length response header.

response.headers.contentType

The outgoing response content type as read from the Content-Type response header.

Create custom attributes

To create custom attributes, use any of these options:

  • Create a custom event: Create a new event with the recordCustomEvent method, and associate custom attributes with it.
  • Add to existing transaction: Add a custom attribute to an existing transaction by using addCustomParameter.
  • Add multiple attributes: Use addCustomParameters.

For more help

Join the discussion about Node.js monitoring in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at support.newrelic.com.