New Relic

Added in: v2.0.0-31

This reporter supports sending metrics, events and traces to New Relic (opens in a new tab)

In order to enable the New Relic reporter set type to newrelic as shown below:

plugins:
  publish-metrics:
    - type: newrelic

Metrics

By default, all Artillery metrics will be sent to New Relic. Each Artillery metric will create a custom New Relic metric (opens in a new tab), which may have an associated cost.

Configuration options

Example configuration
config:
  plugins:
    publish-metrics:
      - type: newrelic
        # NR_LICENSE_KEY is an environment variable containing the New Relic license key
        licenseKey: "{{ $env.NR_LICENSE_KEY }}"
        region: eu
        prefix: "artillery.publish_metrics_plugin."
        attributes:
          - "testType:LoadTest"
          - "tool:Artillery"
NameDescription
licenseKey (required)The license key for the account you want to send the metrics to
regionus (default) or eu. If your account hosts data in the EU data center set the region to eu.
prefixSet a prefix for metric names created by Artillery; defaults to artillery.
attributesA list of name:value strings to use as tags for all metrics sent during a test
excludedA list of metric names which should not be sent to New Relic. Defaults to an empty list, i.e. all metrics are sent to New Relic.
includeOnlyA list of specific metrics to send to New Relic. No other metrics will be sent. Defaults to an empty list, i.e. all metrics are sent to New Relic.
eventSet to send a New Relic event when test starts/finishes. See event specific configuration
tracesSet to send traces to New Relic. See traces specific configuration

Events

The reporter supports sending a New Relic event on test start and test finish. To enable set the event option and configure it with the accountId.

Configuration options

Example configuration
config:
  plugins:
    publish-metrics:
      - type: newrelic
        licenseKey:  "{{ $env.NR_LICENSE_KEY }}"
        event:
          accountId: "{{ $env.NR_ACCOUNT_ID }}"
          eventType: "Artillery_load_test"
          attributes:
            - "alertType:info"
            - "priority:low"
            - "testId:myTest123"
NameDescription
accountId (required)Your New Relic account ID (opens in a new tab).
eventTypeSet to customize the event's name, defaults to Artillery_io_Test. Must be a string that is a combination of alphanumeric characters, underscores, and colons.
sendSet to false to turn off the event. By default, if event is configured, it will be sent. This option makes it possible to turn event creation on/off on the fly (e.g. via an environment variable)
attributesOptional list of name:value strings to use as attributes/tags for events sent during a test.
By default Artillery sends the target: , timestamp: and phase: 'Test Started' / 'Test Finished' attributes.

Traces

Added in: v2.0.5

Powered by: OpenTelemetry reporter

⚠️

Experimental This feature is under active development. We aim to keep it stable, but it may need to introduce breaking changes. Please open an issue (opens in a new tab) or discussion (opens in a new tab) for any feedback.

New Relic tracing feature is available for both HTTP and Playwright engines, and the tracing data available is different depending on the engine used.

Configuration options

To enable set the traces option in reporters configuration.

Example configuration
config:
  plugins:
    publish-metrics:
      - type: newrelic
        licenseKey:  "{{ $env.NR_LICENSE_KEY }}"
        traces:
          serviceName: service_name
          sampleRate: 0.5
          useRequestNames: true
          attributes:
            - testType:LoadTest
            - tool:Artillery
NameDescription
serviceNameName of your service. Defaults to Artillery-test
sampleRateSample rate. Percentage of traces to send represented by a value between 0 and 1. (defaults to 1 - all traces are sent)
useRequestNamesIf set to true the request names provided in test script will be used as span names
attributesCustom attributes to be added to each span in key: value pair format.

Debugging

Set DEBUG=plugin:publish-metrics:newrelic when running your tests to print out helpful debugging messages when sending metrics to New Relic.

DEBUG=plugin:publish-metrics:newrelic artillery run my-script.yaml