New Relic

Added inv2.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:{{ $testId }}"
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 inv2.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.

An additional plugins.publish-metrics.spans.exported metric will be recorded and will appear in your reports when tracing is enabled. It represents the number of spans exported to New Relic.

Added inv2.0.9

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
          replaceSpanNameRegex:
            - pattern: get_user_[a-zA-Z0-9]+
              as: get_user_id
          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.
replaceSpanNameRegex
Added inv2.0.9
A list of replacement maps that consist of:
pattern - regex pattern to match against the span names
as - string to replace the matched pattern in the span names

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