A Proof of Concept for using Artillery for backend performance testing, publishing metrics to InfluxDB 2.0 through Telegraf, and displaying them using Grafana.
-
Run Docker Compose:
docker-compose up -d
- This will run InfluxDB 2.0, Telegraf, Grafana and a Weather Forecast API
-
Go to your Grafana and log in
- username:
admin
- password:
admin
- username:
-
Connect Grafana to Influx DB
-
Go to Add data source, select InfluxDB and configure the following
Query Language: Flux # InfluxDB 2.0 HTTP: URL: http://influxdb2:8086 # InfluxDB address inside Docker Auth: Basic auth: false # Turn off Basic Auth InfluxDB Details: Organization: poc-organization Token: my-super-secret-auth-token # You should issue a new Read-Only access token for Grafana in your InfluxDB Default Bucket: poc-artillery.io
-
-
Create a new Grafana Dashboard (you can find the finished dashboard here)
- Go to Dashboards and click New Dashboard
- Click
Add an empty panel
-
Responses
-
Panel (Settings)
- Panel title:
Responses
- Panel title:
-
Query
from(bucket: "poc-artillery.io") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "artillery_response_1xx" or r["_measurement"] == "artillery_response_2xx" or r["_measurement"] == "artillery_response_3xx" or r["_measurement"] == "artillery_response_4xx" or r["_measurement"] == "artillery_response_5xx") |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false) |> yield(name: "mean")
-
Overrides (Fields with name matching regex)
- 1xx Responses
- RegEx:
artillery_response_1xx.+
- Display name:
1xx
- RegEx:
- 2xx Responses
- RegEx:
artillery_response_2xx.+
- Display name:
2xx
- RegEx:
- 3xx Responses
- RegEx:
artillery_response_3xx.+
- Display name:
3xx
- RegEx:
- 4xx Responses
- RegEx:
artillery_response_4xx.+
- Display name:
4xx
- RegEx:
- 5xx Responses
- RegEx:
artillery_response_5xx.+
- Display name:
5xx
- RegEx:
- 1xx Responses
-
-
Latency
-
Panel (Settings)
- Panel title:
Latency
- Panel title:
-
Field (Standard options)
- Unit:
milliseconds (ms)
(under Time)
- Unit:
-
Query
from(bucket: "poc-artillery.io") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "artillery_latency_max" or r["_measurement"] == "artillery_latency_median" or r["_measurement"] == "artillery_latency_min" or r["_measurement"] == "artillery_latency_p95" or r["_measurement"] == "artillery_latency_p99") |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false) |> yield(name: "mean")
-
Overrides (Fields with name matching regex)
- Maximum latency
- RegEx:
artillery_latency_max.+
- Display name:
Maximum
- RegEx:
- Median latency
- RegEx:
artillery_latency_median.+
- Display name:
Median
- RegEx:
- Minimum latency
- RegEx:
artillery_latency_min.+
- Display name:
Minimum
- RegEx:
- 95th percentile latency
- RegEx:
artillery_latency_p95.+
- Display name:
95th percentile latency
- RegEx:
- 99th percentile latency
- RegEx:
artillery_latency_p99.+
- Display name:
99th percentile latency
- RegEx:
- Maximum latency
-
-
Traffic
-
Panel (Settings)
- Panel title:
Traffic
- Panel title:
-
Field (Standard options)
- Unit:
requests/sec (rps)
(under Throughput)
- Unit:
-
Query
from(bucket: "poc-artillery.io") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "artillery_rps_mean") |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false) |> yield(name: "mean")
-
Overrides (Fields with name matching regex)
- Maximum latency
- RegEx:
value.+
- Display name:
Number of requests
- RegEx:
- Maximum latency
-
-
- Install dependencies:
npm install
- Run tests:
npm run weather-forecast
- Tomas Svejnoha
- GitHub: svejnohatomas
- LinkedIn: Tomáš Švejnoha