InfluxDB
Artillery can send metrics to InfluxDB through Telegraf using Telegraf’s statsd Service Plugin .
Quick Start
config:
plugins:
publish-metrics:
- type: influxdb-statsd
host: localhost
port: 8125Configuration
The InfluxDB integration uses the same configuration options as the StatsD integration:
| Name | Description |
|---|---|
type | Set to influxdb-statsd |
host | Hostname/IP of Telegraf agent (defaults to 127.0.0.1) |
port | Port of Telegraf StatsD input (defaults to 8125) |
prefix | Prefix for metric names created by Artillery (defaults to artillery.) |
tags | List of name:value strings to use as tags for all metrics sent during a test |
Telegraf Configuration
Configure Telegraf’s StatsD input plugin in your telegraf.conf:
[[inputs.statsd]]
protocol = "udp"
service_address = ":8125"
delete_gauges = true
delete_counters = true
delete_sets = true
delete_timings = true
percentiles = [50.0, 90.0, 95.0, 99.0]
metric_separator = "_"
datadog_extensions = true
allowed_pending_messages = 10000
percentile_limit = 1000
[[outputs.influxdb_v2]]
urls = ["http://localhost:8086"]
token = "$INFLUX_TOKEN"
organization = "your-org"
bucket = "your-bucket"Examples
Basic Configuration
config:
plugins:
publish-metrics:
- type: influxdb-statsd
prefix: 'artillery.publish_metrics_plugin.'
tags:
- 'testId:{{ $testId }}'
- 'environment:production'With Custom Host and Port
config:
plugins:
publish-metrics:
- type: influxdb-statsd
host: telegraf.example.com
port: 8126
prefix: 'loadtest.'
tags:
- 'service:checkout'
- 'testType:peak-load'
- 'version:{{ $env.APP_VERSION }}'Querying Metrics in InfluxDB
Example Flux queries:
// Get response time percentiles
from(bucket: "your-bucket")
|> range(start: -1h)
|> filter(fn: (r) => r._measurement == "artillery_http_response_time")
|> filter(fn: (r) => r._field == "p95")
// Get request rate
from(bucket: "your-bucket")
|> range(start: -1h)
|> filter(fn: (r) => r._measurement == "artillery_http_requests")
|> aggregateWindow(every: 10s, fn: mean)Best Practices
- Configure retention policies: Set appropriate retention policies in InfluxDB for your load test data
- Use consistent tags: Include tags that help you filter and group metrics across test runs
- Monitor Telegraf: Ensure Telegraf has sufficient resources to handle the metric volume from Artillery
Debugging
Monitor Telegraf logs to verify metrics are being received:
journalctl -u telegraf -fYou can also enable debug logging in Telegraf configuration:
[agent]
debug = trueLast updated on