Adds multiple custom attributes to a transaction.
Attributes may be found in APM if the transaction is associated with an error or if a transaction trace is generated for that transaction. Attributes can also be found and queried in the New Relic UI.
Before you create custom attributes, review our list of reserved terms used by NRQL.
Required. Each item in the list must be a
True if all attributes were added successfully.
An example of adding custom attributes to a background task:
@newrelic.agent.background_task()def send_request():response = requests.get("http://example.com")newrelic.agent.add_custom_attributes([("url_path_status_code", response.status_code)])
You can also use custom attributes to troubleshoot performance issues. For example, you might see occasional slow response times from a pool of memcache instances, but you don't know what instance is causing the problem. You might add an attribute to the transaction indicating the server, like so:
# Set server_ip to be the current server processing the transactionnewrelic.agent.add_custom_attributes([("memcache_query_frontend_lookup", server_ip)])