Monitor background processes and other non-web transactions

This document explains what non-web transactions are in New Relic APM, and how you can instrument background tasks and other arbitrary activity to be reported as non-web transactions.

What are non-web transactions?

The two main New Relic APM transaction categories are web and non-web.

  • Web transactions are transactions New Relic detects as being initiated by a web request; they are the most common type of transaction reported by New Relic APM.
  • Non-web transactions are transactions that are not web transactions; New Relic does not detect they were initiated by a web request. This includes processes and jobs that do not handle web requests, such as message processing and background tasks. For example, you might schedule something to periodically run on your server to do database work, send emails, etc. The source is not a web request but something on your server.

Some non-web transactions from supported frameworks or services are detected automatically by New Relic; others may be created using custom instrumentation.

Non-web transactions have their own section in the APM UI, separated from web transactions. The main reasons for this separation are:

  • Less directly important: Non-web transactions are often background processes and tasks, and they are less directly important to your application's users when compared to web transactions.
  • Long running: Non-web transactions are often long-running processes. Separating them from web transactions prevents those results from skewing your customer-facing response times. For example, combining your non-web transactions with your web transactions would hurt your Apdex score (a measure of satisfaction with load times).

Create non-web transactions

To create new non-web transactions, follow the procedures for your APM language agent.

Go

Follow the procedures for instrumenting a non-web transaction.

Java

Follow the procedures for instrumenting a transaction (instrumenting a transaction without web request parameters creates a non-web transaction).

.NET

By default, the New Relic APM .NET agent instruments IIS ASP workers. To instrument other (non-IIS) .NET applications, such as standalone (WCF) services, console apps, and other Windows services, see Instrumenting custom applications and Instrumenting WCF applications.

For IIS applications, you cannot change web transactions to non-web transactions.

Node.js

Use startBackgroundTransaction().

PHP

To mark a transaction as non-web: use newrelic_background_job and set the flag to true.

The PHP agent reports all command-line run scripts as non-web transactions.

Python

See Python agent non-web transactions.

The Python agent also supports non-web transaction reporting from Celery and Gearman.

Ruby

See Ruby agent non-web transactions.

View non-web transactions

These are the places you can find non-web transactions in New Relic APM:

APM Overview page

To view non-web transactions on the APM Overview page:

  1. Go to rpm.newrelic.com > (select an app) > Monitoring > Overview.
  2. From the dropdown above the main chart, select a non-web transaction chart view.

Chart views: Web and non-web transactions

Transactions page

To view non-web transactions on the APM Transactions page:

  1. Go to rpm.newrelic.com > (select an app) > Monitoring > Transactions.
  2. From the Type dropdown, select Non-web transactions.
Key transactions Overview page

If a non-web transaction has been made into a key transaction, you can view it in the UI:

  1. Go to rpm.newrelic.com > (select an app).
  2. Select Key transactions.
  3. From the key transactions index, select a key transaction.

For PHP, Node.js, and Go agents, only web transactions can be made into key transactions.

For more help

Recommendations for learning more: