Skip to content

NewRelic APM Browser

udx-github edited this page Jul 3, 2026 · 3 revisions

Creates NewRelic APM and Browser monitoring applications with alert policies and Slack notifications.

Use this module when a Rabbit service needs application performance monitoring, browser real-user monitoring, or both, with configurable alert thresholds and Slack notification workflows.

Supported Features

  • APM alert policy with error rate, response time, and Apdex conditions.
  • APM application settings configuration (when the agent has reported data).
  • APM entity tags.
  • Browser application creation with JavaScript snippet output.
  • Browser alert policy with page load time, JS error, and AJAX error rate conditions.
  • Slack notification destination, channels, and workflows for both APM and Browser alerts.
  • Independent enable/disable for APM and Browser.

Prerequisites

  • A NewRelic account and API key available to the deployment runtime.
  • For APM: an APM agent configured in the application reporting to NewRelic.
  • For Slack notifications: a Slack webhook URL.

Important Notes

  • apm.app_name must match the name reported by the APM agent.
  • apm.configure_app_settings should only be set to true after the APM agent has reported data at least once.
  • browser.enabled: true creates a standalone Browser application and returns a browser_js_config output containing the JavaScript snippet to embed in the site's <head>.
  • R2A placeholders (#{Environment}, #{Lifecycle}, #{Owner}, #{Repository}) are supported in tag values.
  • slack.webhook_url set to empty string disables Slack notifications.

Minimal Example

services:
  - name: "NewRelic APM and Browser"
    module: "newrelic-apm-browser"
    id: "newrelic"
    deployment_order: 145
    configurations:
      apm:
        enabled: true
        app_name: "www-example-com-#{Environment}"
      browser:
        enabled: true
        app_name: "www-example-com-#{Environment}-browser"
      slack:
        webhook_url: "projects/<project-id>/secrets/<slack-webhook-secret>"
        channel: "#alerts"

Outputs

Output Description
apm_entity_guid NewRelic entity GUID of the APM application (null if configure_app_settings is false).
apm_alert_policy_id ID of the APM alert policy (null if APM is disabled).
browser_application_id NewRelic application ID of the Browser app (null if Browser is disabled).
browser_application_guid NewRelic entity GUID of the Browser app (null if Browser is disabled).
browser_js_config JavaScript snippet for Browser monitoring (sensitive, null if Browser is disabled).
browser_alert_policy_id ID of the Browser alert policy (null if Browser is disabled).
slack_destination_id ID of the Slack notification destination (null if Slack is disabled).
apm_workflow_id ID of the APM to Slack workflow (null if APM or Slack is disabled).
browser_workflow_id ID of the Browser to Slack workflow (null if Browser or Slack is disabled).

Full Configuration Schema

The fields below are public module inputs under configurations.

configurations:
  slack:
    webhook_url: ""
    channel: "#alerts"
  apm:
    enabled: false
    app_name: ""
    apdex_threshold: 0.5
    configure_app_settings: false
    enable_real_user_monitoring: true
    transaction_tracer:
      record_sql: "obfuscated"
      threshold: 1.0
    tags: {}
    alerts:
      error_rate:
        enabled: true
        threshold: 5
        threshold_duration: 300
      response_time:
        enabled: true
        threshold: 2.0
        threshold_duration: 300
      apdex:
        enabled: true
        threshold: 0.75
        threshold_duration: 300
  browser:
    enabled: false
    app_name: ""
    cookies_enabled: true
    distributed_tracing_enabled: true
    loader_type: "SPA"
    tags: {}
    alerts:
      page_load_time:
        enabled: true
        threshold: 5.0
        threshold_duration: 300
      js_errors:
        enabled: true
        threshold: 5
        threshold_duration: 300
      ajax_error_rate:
        enabled: true
        threshold: 5
        threshold_duration: 300

slack

Field Type Required Description
webhook_url string No Slack webhook URL or GCP Secret Manager path. Empty disables Slack.
channel string No Slack channel. Defaults to #alerts.

apm

Field Type Required Description
enabled boolean No Enables APM monitoring. Defaults to false.
app_name string Conditional APM application name. Required when enabled is true.
apdex_threshold number No Apdex T value in seconds. Defaults to 0.5.
configure_app_settings boolean No Configures app settings (only after agent reports data). Defaults to false.
enable_real_user_monitoring boolean No Enables browser auto-instrumentation via APM. Defaults to true.
transaction_tracer.record_sql string No SQL recording mode. Defaults to obfuscated.
transaction_tracer.threshold number No Transaction tracer threshold in seconds. Defaults to 1.0.
tags map[string] No Entity tags for the APM app.
alerts.error_rate.enabled boolean No Enables error rate alert. Defaults to true.
alerts.error_rate.threshold number No Error rate threshold (%). Defaults to 5.
alerts.error_rate.threshold_duration number No Duration in seconds. Defaults to 300.
alerts.response_time.enabled boolean No Enables response time alert. Defaults to true.
alerts.response_time.threshold number No Response time threshold in seconds. Defaults to 2.0.
alerts.response_time.threshold_duration number No Duration in seconds. Defaults to 300.
alerts.apdex.enabled boolean No Enables Apdex alert. Defaults to true.
alerts.apdex.threshold number No Apdex score threshold (0-1). Defaults to 0.75.
alerts.apdex.threshold_duration number No Duration in seconds. Defaults to 300.

browser

Field Type Required Description
enabled boolean No Enables Browser monitoring. Defaults to false.
app_name string Conditional Browser application name. Required when enabled is true.
cookies_enabled boolean No Enables cookies. Defaults to true.
distributed_tracing_enabled boolean No Enables distributed tracing. Defaults to true.
loader_type string No Browser agent loader type: SPA, PRO, or LITE. Defaults to SPA.
tags map[string] No Entity tags for the Browser app.
alerts.page_load_time.enabled boolean No Enables page load time alert. Defaults to true.
alerts.page_load_time.threshold number No Page load time threshold in seconds. Defaults to 5.0.
alerts.page_load_time.threshold_duration number No Duration in seconds. Defaults to 300.
alerts.js_errors.enabled boolean No Enables JS error count alert. Defaults to true.
alerts.js_errors.threshold number No JS error count threshold. Defaults to 5.
alerts.js_errors.threshold_duration number No Duration in seconds. Defaults to 300.
alerts.ajax_error_rate.enabled boolean No Enables AJAX error rate alert. Defaults to true.
alerts.ajax_error_rate.threshold number No AJAX error rate threshold (%). Defaults to 5.
alerts.ajax_error_rate.threshold_duration number No Duration in seconds. Defaults to 300.

Clone this wiki locally