Giter VIP home page Giter VIP logo

xk6-output-prometheus-pushgateway's Introduction

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/martymarron/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 ...

xk6-output-prometheus-pushgateway's People

Contributors

llaszkie avatar lucasoares avatar martymarron avatar mstoykov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xk6-output-prometheus-pushgateway's Issues

Errors after merge to tag v0.2.0

When you add new func (labels) my tests run but always get error. When I start them up, I immediately get an error display:
level=error msg="Could not add to pushgateway" component=output-prometheus-pushgateway error="1008 error(s) occurred: collected metric "checks" { gauge:value:1 } was collected before with the same name and label values .... for all metrics. I deleted all custom metrics from my code and got same errors.

I set my dockerfile and set up build to tag v0.1.1 - tests and custom metrics work.

Additional question how labels work, if I want to have for example for custom metrics label named "aaa" to have the status of each request sent, it is possible to do this? Needs this for my grafana :)

invalid output type 'output-prometheus-pushgateway'

built k6 according to README
xk6 build --with github.com/martymarron/xk6-output-prometheus-pushgateway@latest

trying to start test according to README, but getting this error:
invalid output type 'output-prometheus-pushgateway', available types are: cloud, csv, experimental-prometheus-rw, influxdb, json, statsd

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.