Reference
metrics-by-endpoint

metrics-by-endpoint - Report metrics by URL

By default, Artillery calculates and prints response time metrics (p50, p95, p99, min and max) measured across all endpoints (or URLs). artillery-plugin-metrics-by-endpoint can be used to print response time metrics per URL.

This plugin is only compatible with the http engine.

Usage

Enable the plugin

config:
  plugins:
    metrics-by-endpoint: {}

Plugin Configuration

NameValid OptionsDescription
useOnlyRequestNames
  • false (default)
  • true
If true, will use only the name field of a request as the metric name. If false, the name will be prepended to the standard metric name if it exists. It's recommended you use this to group requests with dynamic URLs.
stripQueryString
Added inv2.0.0-34
  • false (default)
  • true
If true, query-strings will be stripped from the metric name.
ignoreUnnamedRequests
Added inv2.0.0-34
  • false (default)
  • true
If true, any requests without a name field will not have metrics reported.
metricsNamespace
Added inv2.0.0-32
any string (defaults to plugins.metrics-by-endpoint)Custom prefix to use for metrics published by this plugin.
groupDynamicURLs
Added inv2.0.18
  • true (default)
  • false
By default, Artillery will group metrics using the non-templated static url as the name. Set this option to false to prevent grouping dynamic values.

useOnlyRequestNames example

Set useOnlyRequestNames to report metrics based on the name of the request, rather than the URL.

This can be useful when your test sends requests to the same endpoint with different query string parameters.

If the name property is not set on a request, the plugin will use the URL.

In the following example, metrics for the first 3 requests to / which share the same name (but use different query strings) will be reported together.

config:
  target: https://www.artillery.io
  phases:
    - duration: 60
      arrivalRate: 1
  plugins:
    metrics-by-endpoint:
      # Group metrics by request name rather than URL:
      useOnlyRequestNames: true
scenarios:
  - flow:
      - get:
          url: '/docs/?one'
          name: GET /docs
      - get:
          url: '/docs/?two'
          name: GET /docs
      - get:
          url: '/docs/?three'
          name: GET /docs

Metrics reported by the plugin

In addition to the default metrics reported by Artillery and your chosen engine(s), this plugin reports the following additional metrics:

MetricTypeDescription
<prefix>.<req_name>.codes.<status_code>Counter

(count)

Number of specific status_code in responses for each specific request (req_name).
<prefix>.<req_name>.errors.<error_code>Counter

(count)

Error code such as ETIMEDOUT or ECONNRESET. This records the URL of the active request at the time the error happened, but errors such as ECONNRESET may be due to server overload as a whole, rather than an issue with the specific backend endpoint.
<prefix>.response_time.<req_name>.<aggregation>Histogram

(milliseconds)

Response time (measured as time to first byte) aggregation for requests during this period, for each specific request (req_name).
<prefix>.server-timing.<req_name>.<aggregation>Histogram

(milliseconds)

If the server has the server-timing response header, Artillery will report this additional measurement for each specific request (req_name).

The default prefix for metrics reported by this plugin is plugins.metrics-by-endpoint. You can change this by setting the metricsNamespace option.

The default req_name is the URL of the request. You can configure this through the configuration options listed above.