Configure and analyze web application errors

Dynatrace categorizes errors into the following types:

  • Request errors are detected by the browser and OneAgent on your servers.
  • Custom errors are triggered directly in your application via the RUM JavaScript API.
  • JavaScript errors are detected JavaScript exceptions thrown by the browser.

To set up how errors are captured, edit your application, and go to Errors. On the Errors page, you can configure an error to be captured, included in Apdex calculations, or considered for Davis AI problem detection and analysis.

Configure request errors

By default, Dynatrace considers all 4xx and 5xx response status codes to be web request errors. CSP violations and errors with failed image requests are captured as well. However, you may change the default settings by configuring request error rules.

To add a request error rule

  1. In the Dynatrace menu, go to Web.

  2. Select the application you want to configure.

  3. Select Browse () > Edit.

  4. From the application settings, go to Errors.

  5. Under Request errors, select Add request error rule.

  6. Turn on at least one of the following options:

    • Match by error code. For this option, also provide either an individual HTTP error code, such as 404, or a whole error code range, such as 400-499.
    • Match by errors that have failed image requests
    • Match by errors that have CSP violations
  7. optional To apply the request error rule only to certain URLs, turn on Filter by URL, and specify the condition.

  8. Specify if you want to Capture this error. Also, you can Include error in Apdex calculations and Include error in Davis AI problem detection and analysis.
    Configuring a request error rule

    If you opt for including the error in Davis AI analysis, Davis may report this error as a new open problem.

The request error rules are executed in the order of appearance in the error list. Select Move up Move up 1 or Move down Move down 1 to change a rule's priority.

You can also turn on Ignore request errors in Apdex calculations to override Apdex settings for individual request error rules.

Configure custom errors

Custom errors allow you to detect your own defined errors with Dynatrace. An example of this is an error that is triggered during a form field validation.

For setting up a custom error, configure how Dynatrace should treat the error, and then trigger the error in your application using the RUM JavaScript API.

To add a custom error rule

  1. In the Dynatrace menu, go to Web.

  2. Select the application you want to configure.

  3. Select Browse () > Edit.

  4. From the application settings, go to Errors.

  5. Under Custom errors, select Add custom error rule.

  6. Provide the Key and Value conditions that Dynatrace should use to identify the custom error.

  7. Specify if you want to Capture this error. Also, you can Include error in Apdex calculations and Include error in Davis AI problem detection and analysis.
    Configuring a custom error rule

    If you opt for including the error in Davis AI analysis, Davis may report this error as a new open problem.

The custom error rules are executed in their order of appearance in the error list. Select Move up Move up 1 or Move down Move down 1 to change a rule's priority.

You can also turn on Ignore custom errors in Apdex calculations to override Apdex settings for individual custom error rules.

After adding or excluding a custom error in Dynatrace, you must trigger the error in your application using the dtrum.reportCustomError() method of the RUM JavaScript API.

For example, a form field error would require the following JavaScript method parameters:

Parameter Explanation Example
Key The name of the form field. custom_buying_form_number_of_travelers_field
Value The validation error triggered by the validator. availability exceeded - e3434
Hint The actual user input. 1000

Only Key and Value can be used to group and analyze custom errors; Hint is optional information.

For more information, see RUM JavaScript API - reportCustomError.

Configure JavaScript errors

JavaScript errors are detected automatically by the browser, so you don't have to add them. If you configure these errors to be captured, they are automatically included in Apdex calculations and Davis analysis.

To ignore JavaScript errors on an individual level, select Ignore this JavaScript error on the respective JavaScript error detail page.

Ignore a JavaScript error

To ignore all JavaScript errors

  1. In the Dynatrace menu, go to Web.
  2. Select the application you want to configure.
  3. Select Browse () > Edit.
  4. From the application settings, go to Errors.
  5. Under JavaScript errors, turn on Ignore JavaScript errors in Apdex calculations.

Create additional error alerts for Davis

If the out-of-the-box alerting on request, custom, and JavaScript errors is not sensitive enough for you, or if you want to focus on an individual error, you can create additional error alerts.

To create additional error alerts

  1. In the Dynatrace menu, go to Web.

  2. Select the application to display the application overview page.

  3. In the infographic, select Errors.

  4. Under Errors by type, select Analyze by type.

  5. Under Detail analysis for selected timeframe, set a filter in the Filter by… box. Available filters in the Errors category are Custom error name, Custom error type, Error type, Errors, Request error code, Request error resource, and Request error type.

  6. Select Create metric. In the opened overlay, select Create metric again.
    For details on creating and charting calculated metrics, see Create calculated metrics.

  7. Select Create alert.

  8. Configure the alert settings. When done, select Create custom event for alerting.

    • Use a static threshold of 1 if you want Davis to always raise a problem when a particular error happens.
    • Use auto-baselining if you are interested only in anomalies for that error.
    • For details on creating an alert, see Metric events for alerting.