StatsD
Artillery can send metrics to any StatsD-compatible backend, providing a simple and widely-supported protocol for metrics collection.
Quick Start
config:
plugins:
publish-metrics:
- type: statsd
host: localhost
port: 8125Configuration
Configuration Options
| Name | Description |
|---|---|
type | Set to statsd |
host | Hostname/IP of the StatsD server (defaults to 127.0.0.1) |
port | Port of the StatsD server (defaults to 8125) |
prefix | Prefix for metric names created by Artillery (defaults to artillery.) |
Examples
Basic Configuration
config:
plugins:
publish-metrics:
- type: statsd
prefix: 'artillery.publish_metrics_plugin.'Custom Host and Port
config:
plugins:
publish-metrics:
- type: statsd
host: metrics.example.com
port: 8126
prefix: 'loadtest.'Multiple Environments
config:
plugins:
publish-metrics:
- type: statsd
host: '{{ $env.STATSD_HOST }}'
port: '{{ $env.STATSD_PORT }}'
prefix: 'artillery.{{ $env.ENVIRONMENT }}.'Compatible Backends
The StatsD integration works with any StatsD-compatible backend:
- Original StatsD: The original Etsy StatsD daemon
- Telegraf: InfluxData’s metrics collector (see InfluxDB integration)
- Datadog Agent: Can receive StatsD metrics (see Datadog integration)
- AWS CloudWatch Agent: Supports StatsD protocol
- Graphite: With StatsD frontend
- Prometheus: Via statsd_exporter
Metric Format
Artillery sends the following metric types to StatsD:
- Counters: For counts (e.g., total requests, errors)
- Timers: For latencies (e.g., response times)
- Gauges: For concurrent users and other measurements
Example metric names (with default prefix):
artillery.http.requests- Total HTTP requestsartillery.http.response_time- Response time measurementsartillery.errors.ECONNREFUSED- Connection errorsartillery.vusers.active- Active virtual users
Best Practices
- Use namespacing: Include environment and service names in your prefix
- Monitor UDP buffer: StatsD uses UDP, which can drop packets under high load
- Local StatsD relay: Consider running a local StatsD relay to buffer metrics
- Consistent prefixes: Use consistent prefixes across all your load tests
Debugging
To verify metrics are being sent, you can:
-
Use
tcpdumpto monitor UDP traffic:tcpdump -i any -n udp port 8125 -
Run a simple StatsD server for testing:
nc -lu 8125 -
Check your StatsD backend’s logs and dashboards
Last updated on