Prometheus
Artillery metrics can be sent to Prometheus via Pushgateway .
Quick Start
config:
plugins:
publish-metrics:
- type: prometheus
pushgateway: 'http://localhost:9091'Configuration
- Set
typetoprometheusand setpushgatewayto the URL of the Pushgateway instance - Set an optional
prefix(defaults toartillery) andtags - You can optionally set a custom CA certificate by using the
caoption in the config
Metric Names in Prometheus
Prometheus requires that every metric name is registered ahead of time, whereas metrics can be generated on the fly in Artillery, i.e. there is no way to know all metric names that may be generated by Artillery during a test run ahead of time.
This integration creates three metric names (when using the default artillery prefix):
artillery_countersartillery_summariesartillery_rates
Individual Artillery metrics are then made available via the metric tag. For example:
- The built-in Artillery metric
http.response_timeis of type “summary”, i.e. it has the following fields:min/max/p95/p99 - Those values can be looked up in Prometheus through the
artillery_summariesmetric with tagmetric:http_response_time_p95forp95
Examples
Basic Configuration
config:
plugins:
publish-metrics:
- type: prometheus
pushgateway: 'http://kubernetes.docker.internal:9091'
tags:
- 'testId:mytest123'
- 'type:loadtest'With Custom Prefix and CA Certificate
config:
plugins:
publish-metrics:
- type: prometheus
pushgateway: 'https://prometheus.example.com:9091'
prefix: 'loadtest'
tags:
- 'environment:production'
- 'service:checkout'
ca: |
-----BEGIN CERTIFICATE-----
MIIDXTCCAkWgAwIBAgIJAKl...
-----END CERTIFICATE-----Best Practices
- Use consistent tags: Include tags that help you filter and group metrics in Prometheus queries
- Monitor Pushgateway: Ensure your Pushgateway instance has sufficient resources to handle the metric volume
- Set retention policies: Configure appropriate retention policies in Prometheus for your load test metrics
Querying Metrics
Example Prometheus queries:
# Get 95th percentile response time
artillery_summaries{metric="http_response_time_p95"}
# Get request rate
artillery_rates{metric="http_requests"}
# Get error count
artillery_counters{metric="errors_count"}Last updated on