pushgateway

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

README

xk6-output-prometheus-pushgateway

This is a k6 extension for publishing test-run metrics to Prometheus via Pushgateway.
This extension is fully inspired by xk6-output-prometheus-remote.
There might be a circumstance not to enable the "Remote Write" feature on your Prometheus instance. In that case, the Pushgateway and this extension are possibly be an alternative solution.

Usage

% xk6 build --with github.com/llaszkie/xk6-output-prometheus-pushgateway@latest
% K6_PUSHGATEWAY_URL=http://localhost:9091 \
K6_JOB_NAME=k6_load_testing \
./k6 run \
./script.js \
-o output-prometheus-pushgateway

Prometheus Labels

It is possible to add Prometheus labels with external JSON dictionary in js script

export const options = {
  ext: {
    "pushgateway": {
      app: "myapp",
      env: "myenv",
    }
  }
};

or with environment variables

K6_LABEL_APP=myapp K6_LABEL_ENV=myenv k6 run ...

It is possible to check Prometheus labels with debug output. It looks like

DEBU[0000] Pushgateway labels from JSON options.ext.pushgateway dictionary map[app:MYAPP env:MYENV url:MYURL]
DEBU[0000] Pushgateway labels map[app:MYAPP env:MYENV url:MYURL]

The 1st line is Prometheus labels from options.ext.pushgateway dictionary.

The 2nd line is the final set of labels after merging options.ext.pushgateway dictionary and environment variables.

Metrics prefix

It is possible to configure this output to expose the time series with a prefix.

Configure it with the following environment variable:

K6_PUSHGATEWAY_NAMESPACE=k6 k6 run ...

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL