Dynatrace
Added inv2.0.0-36This reporter supports sending metrics, events and traces to Dynatrace.
In order to enable the Dynatrace reporter set type
to dynatrace
as shown below:
plugins:
publish-metrics:
- type: dynatrace
Metrics
By default, all Artillery metrics will be sent to Dynatrace. Each Artillery metric will create a custom Dynatrace metric, which will have an associated charge.
NOTE: If using metrics-by-endpoint
plugin alongside this reporter, in order
for all of your metrics to be ingested sucessfully, set useOnlyRequestNames
to true
(in metrics-by-endpoint
's config) and provide the name
for each
of your requests. This is required as metrics-by-endpoint
plugin by default
creates metric names with characters that are not supported by Dynatrace (e.g.
'/') and will be dropped on ingest. Keep Dynatraces metric key naming
requirements (opens in a new tab)
in mind when naming your requests and custom metrics as well.
For information on how to manage data ingested through the Dynatrace Metric API consult Dynatrace docs (opens in a new tab).
Configuration options
Example configuration
config:
plugins:
publish-metrics:
- type: dynatrace
# DT_API_TOKEN is an environment variable containing the API key
apiToken: "{{ $env.DT_API_TOKEN }}"
envUrl: "{{ $env.DT_ENVIRONMENT_URL }}"
prefix: "artillery."
dimensions:
- "service:my-service"
- "host_id:1.2.3.4"
Name | Description |
---|---|
apiToken (required) | The access token (opens in a new tab). Must have the proper scopes assigned to it for the data type you are sending (metrics.ingest , events.ingest , and/or openTelemetryTrace.ingest ). |
envUrl (required) | Set to your Dynatrace environment URL. For Managed, Dynatrace for Government or Environment ActiveGate this URL is https://{your-domain}/e/{your-environment-id} ( In case of Environment ActiveGate {your-domain} represents your Activegate domain).For SaaS the URL is https://{your-environment-id}.live.dynatrace.com |
prefix | use a prefix for metric names created by Artillery; defaults to artillery. |
dimensions | a list of name:value strings to use as dimensions for all metrics sent during a test. |
excluded | A list of metric names which should not be sent to Dynatrace. Defaults to an empty list, i.e. all metrics are sent. |
includeOnly | A list of specific metrics to send to Dynatrace. No other metrics will be sent. Defaults to an empty list, i.e. all metrics are sent. |
event | Set to send a Dynatrace event when test starts/finishes. See event specific configuration |
traces | Set to send traces to Dynatrace. 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: dynatrace
apiToken: "{{ $env.DT_API_TOKEN }}"
envUrl: "{{ $env.DT_ENVIRONMENT_URL }}"
event:
title: "Loadtest"
entitySelector: "type(SERVICE),entityName.equals(MyService)"
properties:
- "Tool:Artillery"
- "Load per minute:100"
- "Load pattern:production"
Name | Description |
---|---|
title | The title of the event. Defaults to Artillery_io_Test . |
eventType | The type of the event. It can be one of the values listed here (opens in a new tab). Defaults to CUSTOM_INFO |
send | Set 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) |
properties | Optional list of name:value strings to use as properties for events sent during a test. By default Artillery sends the Target: <target set in the script config> and Phase: 'Test-Started' / 'Test-Finished' properties. Any properties set in script will be sent in addition to the default ones. |
entitySelector | The entity selector (opens in a new tab) string, defining a set of Dynatrace entities to be associated with the event. Only entities that have been active within the last 24 hours can be selected. |
Traces
Added inv2.0.5Powered 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.
Dynatrace 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 Dynatrace.
Configuration options
To enable set the traces
option in reporters configuration.
Example configuration
config:
plugins:
publish-metrics:
- type: dynatrace
apiToken: "{{ $env.DT_API_TOKEN }}"
envUrl: "{{ $env.DT_ENVIRONMENT_URL }}"
traces:
serviceName: service_name
sampleRate: 0.5
replaceSpanNameRegex:
- pattern: get_user_[a-zA-Z0-9]+
as: get_user_id
attributes:
- "testType:LoadTest"
- "tool:Artillery"
Name | Description |
---|---|
serviceName | Name of your service. Defaults to Artillery-test |
sampleRate | Sample rate. Percentage of traces to send represented by a value between 0 and 1. (defaults to 1 - all traces are sent) |
useRequestNames | If set to true the request name s provided in test script will be used as span names |
attributes | Custom 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:dynatrace
when running your tests to print out helpful debugging messages when sending metrics to Dynatrace
DEBUG=plugin:publish-metrics:dynatrace artillery run my-script.yaml