The `artillery-plugin-metrics-by-endpoint` package extends Artillery, a powerful load testing tool, by providing granular, per-endpoint breakdown of latency and HTTP response codes. Unlike Artillery's default behavior, which aggregates performance metrics across all endpoints, this plugin enables users to view statistics (e.g., p50, p95, p99 response times, min/max latency, and status code counts) for each unique URL or named request within their HTTP tests. The current stable version is 1.24.0, with releases typically aligning with updates to the main Artillery monorepo, where the plugin's code now resides. Its key differentiator is the ability to offer deep insights into individual endpoint performance, crucial for identifying bottlenecks in complex microservice architectures or APIs with many routes. It offers configuration options to intelligently group metrics for dynamic URLs, providing clearer reports.
npm install artillery-plugin-metrics-by-endpointVerified import paths — ran on the pinned version, not inferred.
This Artillery YAML script demonstrates how to enable the `metrics-by-endpoint` plugin and configure it to report metrics based on explicit request names, while stripping query strings for better aggregation. It includes a multi-step scenario with named HTTP requests, ensuring granular performance data for each defined endpoint.
Upgrade Artillery to a recent stable version (e.g., `npm install -g artillery@latest`) and ensure `artillery-plugin-metrics-by-endpoint` is also at its latest version (`npm install artillery-plugin-metrics-by-endpoint`). If Artillery is installed locally, install the plugin locally too.
Configure `stripQueryString: true` to ignore query parameters, and/or `useOnlyRequestNames: true` (recommended) to group metrics based on the `name` property defined for requests in your scenario. Set `groupDynamicURLs: false` to ensure dynamic parts of the URL are still considered unique if `useOnlyRequestNames` isn't fully comprehensive.
Explicitly add a `name` property to *all* requests for which you desire per-endpoint metrics when `useOnlyRequestNames: true`. Consider setting `reportNoNameRequests: false` if you strictly only want metrics for explicitly named requests.
If Artillery is installed globally (`npm install -g artillery`), install the plugin globally (`npm install -g artillery-plugin-metrics-by-endpoint`). If Artillery is a local project dependency, install the plugin as a local dev dependency (`npm install --save-dev artillery-plugin-metrics-by-endpoint`).
Ensure `artillery-plugin-metrics-by-endpoint` is installed in the same manner as your Artillery installation. If Artillery is global, install the plugin globally (`npm install -g artillery-plugin-metrics-by-endpoint`). If Artillery is a local project dependency, install the plugin locally (`npm install --save-dev artillery-plugin-metrics-by-endpoint`).
Add `useOnlyRequestNames: true` and define `name` properties for your requests in the Artillery scenario. For dynamic path segments, ensure your `name` is consistent across those requests. If query parameters are causing the issue, add `stripQueryString: true`.
Ensure *all* requests you want metrics for have an explicit `name` property. Additionally, you can set `reportNoNameRequests: false` in the plugin configuration to explicitly prevent metrics from being reported for requests that do not have a `name` field.