Skip to Content

Prometheus

Artillery metrics can be sent to Prometheus via Pushgateway .

Quick Start

config: plugins: publish-metrics: - type: prometheus pushgateway: 'http://localhost:9091'

Configuration

  • Set type to prometheus and set pushgateway to the URL of the Pushgateway instance
  • Set an optional prefix (defaults to artillery) and tags
  • You can optionally set a custom CA certificate by using the ca option 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_counters
  • artillery_summaries
  • artillery_rates

Individual Artillery metrics are then made available via the metric tag. For example:

  • The built-in Artillery metric http.response_time is 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_summaries metric with tag metric:http_response_time_p95 for p95

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

  1. Use consistent tags: Include tags that help you filter and group metrics in Prometheus queries
  2. Monitor Pushgateway: Ensure your Pushgateway instance has sufficient resources to handle the metric volume
  3. 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