# Reference > Extensions > 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.

> **Info:** This plugin is only compatible with the `http` engine.

## Usage

### Enable the plugin

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

## Plugin Configuration

| Name                                                    | Valid Options                                          | Description                                                                                                                                                                                                                      |
| ------------------------------------------------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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`       | \`false\`  (default)   \`true\`  | If `true`, query-strings will be stripped from the metric name.                                                                                                                                                                  |
| `ignoreUnnamedRequests`  | \`false\`  (default)   \`true\`  | If `true`, any requests without a `name` field will not have metrics reported.                                                                                                                                                   |
| `metricsNamespace`       | any string (defaults to `plugins.metrics-by-endpoint`) | Custom prefix to use for metrics published by this plugin.                                                                                                                                                                       |
| `groupDynamicURLs`  | \`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.

```yaml
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-metrics#metrics-reported-by-artillery) reported by Artillery and your chosen engine(s), this plugin reports the following additional metrics:

| Metric                                            | Type                                                | Description                                                                                                                                                                                                                                                   |
| ------------------------------------------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `<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`).                                                                                                              |

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

> **Info:** The default `req_name` is the URL of the request. You can configure this
> through the configuration options listed above.
