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:
The type as read from the HTTP request's
The name from the host's HTTP request header.
The incoming request referer as read from the
The contents of the
The HTTP method of the incoming request.
The response status code for a web request.
The response status message for a web request, if present.
The outgoing response size in bytes as read from the
The outgoing response content type as read from the
Create custom attributes
To create custom attributes, use any of these options:
- Create a custom event: Create a new event with the
recordCustomEventmethod, and associate custom attributes with it.
- Add to existing transaction: Add a custom attribute to an existing transaction by using
- Add multiple attributes: Use