You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 18, 2025. It is now read-only.
K6 extension for Prometheus remote-write output. **WIP!**
3
+
> ### ⚠️ Beta version
4
+
5
+
k6 extension for Prometheus remote-write output.
4
6
5
7
*Distinguish from [Prometheus remote write **client** extension](https://github.com/grafana/xk6-client-prometheus-remote) :)*
6
8
7
-
According to [Prometheus API Stability Guarantees](https://prometheus.io/docs/prometheus/latest/stability/) remote write is an **experimental feature**, thus it is unstable and is subject to change as of now. There are many options for remote-write compatible agents, the official list can be found [here](https://prometheus.io/docs/operating/integrations/). The exact details of how metrics will be processed or stored depends on the underlying agent used.
9
+
According to [Prometheus API Stability Guarantees](https://prometheus.io/docs/prometheus/latest/stability/) remote write is an **experimental feature**, thus it is unstable and is subject to change. There are many options for remote-write compatible agents, the official list can be found [here](https://prometheus.io/docs/operating/integrations/). The exact details of how metrics will be processed or stored depends on the underlying agent used.
8
10
9
11
Key points to know:
10
12
11
13
- remote write format does not contain explicit definition of any metric types while metadata definition is still in flux and can have different implementation depending on the remote-write compatible agent
12
14
- remote read is a separate interface and it is much less defined. For example, remote read may not work without precise queries; see [here](https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations) and [here](https://github.com/timescale/promscale/issues/64) for details
13
15
- some remote-write compatible agents may support additional formats for remote write, like JSON, but it is not part of official Prometheus remote write specification and therefore absent here
14
-
- exemplars are not yet officially supported by format, see [here](https://github.com/prometheus/prometheus/issues/9317)
15
16
16
17
### Usage
17
18
18
19
To build k6 binary with the Prometheus remote write output extension use:
K6_PROMETHEUS_REMOTE_URL=http://localhost:9090/api/v1/write ./k6 run script.js -o output-prometheus-remote
28
27
```
29
28
30
29
Add TLS and HTTP basic authentication:
31
-
32
30
```
33
31
K6_PROMETHEUS_REMOTE_URL=https://localhost:9090/api/v1/write K6_PROMETHEUS_INSECURE_SKIP_TLS_VERIFY=false K6_CA_CERT_FILE=example/tls.crt K6_PROMETHEUS_USER=foo K6_PROMETHEUS_PASSWORD=bar ./k6 run script.js -o output-prometheus-remote
34
32
```
35
33
36
-
Different remote storage agents are supported with mapping option. The default is Prometheus itself but there is a simpler raw mapping that can be used as a starting point for other storages:
37
-
34
+
Different remote storage agents are supported with mapping option. The default is Prometheus itself but there is a simpler raw mapping that can be used as a starting point for other remote agents:
38
35
```
39
36
K6_PROMETHEUS_MAPPING=raw K6_PROMETHEUS_REMOTE_URL=http://localhost:9090/api/v1/write ./k6 run script.js -o output-prometheus-remote
40
37
```
@@ -43,25 +40,12 @@ Note: Prometheus remote client relies on a snappy library for serialization whic
43
40
44
41
### On sample rate
45
42
46
-
K6 processes its outputs once per second and that is also a default flush period in this extension. The number of K6 builtin metrics is 26 as of now and they are collected at the rate of 50ms. In practice it means that there will be around 1000-1500 samples on average per each flush period in case of raw mapping. If custom metrics are configured, that estimate will have to be adjusted.
43
+
k6 processes its outputs once per second and that is also a default flush period in this extension. The number of k6 builtin metrics is 26 and they are collected at the rate of 50ms. In practice it means that there will be around 1000-1500 samples on average per each flush period in case of raw mapping. If custom metrics are configured, that estimate will have to be adjusted.
47
44
48
-
Depending on exact Prometheus setup, it may be necessary to configure Prometheus and / or remote-write agent to handle the load. For example, see [`queue_config` parameter](https://prometheus.io/docs/practices/remote_write/) of Prometheus.
45
+
Depending on exact setup, it may be necessary to configure Prometheus and / or remote-write agent to handle the load. For example, see [`queue_config` parameter](https://prometheus.io/docs/practices/remote_write/) of Prometheus.
46
+
47
+
If remote endpoint responds too slowly or the k6 test run generates too many metrics, extension may start discarding samples in order to continue to adhere to the flush period.
49
48
50
49
### Prometheus as remote-write agent
51
50
52
51
To enable remote write in Prometheus 2.x use `--enable-feature=remote-write-receiver` option. See docker-compose samples in `example/`. Options for remote write storage can be found [here](https://prometheus.io/docs/operating/integrations/).
53
-
54
-
### Next steps
55
-
56
-
*Note:* this list is meant to keep up to date with current roadmap and status of the extension and is very dynamic.
57
-
58
-
-[X] support of raw format of Prometheus remote write specification
59
-
-[X] support of Prometheus as remote-write agent
60
-
-[X] mapping of k6 metrics to Prometheus metrics
61
-
-[X] Counter
62
-
-[X] Gauge
63
-
-[X] Rate
64
-
-[X] Trend (draft)
65
-
-[X] ability to switch Prometheus as remote agent on as a configurable option
66
-
-[ ] decide on submetrics processing
67
-
-[ ] investigate: the processing loop may need an overhaul with long running tests and cloud setups and / or look into more complex aggregations
0 commit comments