• /
  • EnglishEspañol日本語한국어Português
  • Inicia sesiónComenzar ahora

Troubleshoot AJAX data collection

Problem

You are not seeing AJAX data for your browser app.

Solution

If your application is instrumented with and is correctly collecting data for other Pro features, follow these steps:

Verify the page is instrumented

If you are using XMLHttpRequest, use your browser's dev console to verify page has been correctly instrumented. Enter XMLHttpRequest and/or fetch into the console. If instrumentation failed, you will see something like:

// XMLHttpRequest
ƒ XMLHttpRequest() { [native code] }

If you see anything else, then the verification has succeeded.

Verify AJAX instrumentation is enabled

AJAX instrumentation is not included in the lite agent.

To verify AJAX instrumentation:

  1. Open your browser console dev tool and check the newrelic.initializedAgents object. This object contains an entry for every agent running on the page. There is typically only one agent on a page.

  2. Inspect the initialized agent object for a runtime object. This object contains information about the running agent like loaderType. If loaderType is lite, AJAX instrumentation is not included in the agent being used.

  3. If the loaderType is not lite, you can also check the initialized agent for config and features objects.

    • The config object will contain runtime configuration of the agent, including an ajax object with an enabled boolean.
    • The features object should contain an entry for each feature initialized by the agent, including an ajax entry.
  4. Verify this AJAX object contains a boolean enabled of true and featAggregate entry.

If any of these items are not true, the AJAX instrumentation may not have initialized due to a configuration change in New Relic on the browser entity or possibly a manual change to the NREUM.init object that was copied and pasted into the HTML.

Importante

newrelic.initializedAgents is the accepted property to check for agent existence on a page, unless you are using an old or an unsupported agent version.

Verify the deny list configuration

The agent can be configured to ignore certain domains and paths when creating AjaxRequest Events.

Use your browser's dev console to check the current AJAX deny list rules by running newrelic.init. Look for a property ajax containing an array called deny_list.

If you see entries in the deny list that are unfamiliar or causing AJAX calls to be filtered, review the Filter AjaxRequest Events documentation for further guidance.

Verify network access

If the object is properly instrumented, try triggering an AJAX call in your application while monitoring network traffic in the browser's developer tools. Wait up to one minute, and look for a call to bam.nr-data.net/jserrors with an xhr parameter. If the call fails, check for network issues. Alternatively, look for a request to bam.nr-data.net/events with a payload that starts with bel.7;2.

If you don't see this call, if it fails with an error not related to network access, or if it succeeds but you still aren't seeing data, continue through the troubleshooting documentation.

Review how JSONP affects requests

If your requests use JSONP, these requests will not appear on the AJAX UI page.

However, you can view them as assets within session traces.

If you're using SPA monitoring, you can view them on the AJAX tab of the Page views page.

Requirements for JSONP to be recognized:

  • Each JSONP request must use a unique callback function. Most popular libraries (like jQuery) generate a unique callback function dynamically for each request.
  • The query string containing the callback function name must be named "callback" or "cb" in order to be recognized by New Relic. This is the default behavior in most popular libraries.

Sugerencia

If any of these troubleshooting steps fails or you are still having issues with missing AJAX data, get support at support.newrelic.com.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.