Coder Social home page Coder Social logo

xk6-output-statsd's Introduction

xk6-output-statsd

Provides support for real-time output of k6 test metrics to a StatsD service.

Direct support for the StatsD metrics collector will be removed from k6 in a future release. For those seeking to continue using StatsD, the functionality may be compiled into custom k6 binaries as an xk6 extension.

Build

To build a k6 binary with this extension, first ensure you have the prerequisites:

  1. Build with xk6:
xk6 build --with github.com/LeonAdato/xk6-output-statsd

This will result in a k6 binary in the current directory.

  1. Run with the just build `k6:
./k6 run -o output-statsd <script.js>

Options

The xk6-output-statsd extension supports the following configuration options:

Environment Variable Default Description
K6_STATSD_ADDR localhost:8125 Address of the statsd service, currently only UDP is supported.
K6_STATSD_NAMESPACE k6. The namespace used as a prefix for all the metric names.
K6_STATSD_PUSH_INTERVAL 1s Configure how often data batches are sent.
K6_STATSD_BUFFER_SIZE 20 The buffer size.
K6_STATSD_ENABLE_TAGS false If true enables sending tags. Versions prior to statsd v0.9.0 did not support tags.
K6_STATSD_TAG_BLOCKLIST vu,iter,url Comma-separated list of tags that should not be sent to statsd.

Options may be specified as system environment variables as with the following:

K6_STATSD_ADDR=localhost:8125 K6_STATSD_ENABLE_TAGS=true ./k6 run -o output-statsd examples/simple.js

Testing Locally

This repository includes a docker-compose.yml file that starts Graphite backed by StatsD which can be used for testing the xk6-output-statsd extension.

⚠️ This environment is intended for testing only and should not be used for production purposes.

  1. Start the docker compose environment.
    docker compose up -d
    Output should appear similar to the following:
    ✔ Network xk6-output-statsd_default       Created               ...    0.0s
    ✔ Container xk6-output-statsd-graphite-1  Started               ...    0.3s
  2. Use your custom k6 binary to run a k6 test script sending metrics to your StatsD service started ing the previous step.
    ./k6 run -o output-statsd examples/ramping-vus.js
  3. Open the Graphite application by accessing http://localhost:80/ to view metrics from your test similar to the following: Graphite Dashboard

xk6-output-statsd's People

Contributors

dependabot[bot] avatar javaducky avatar kempsterc avatar leonadato avatar mstoykov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xk6-output-statsd's Issues

Using an outdated version of k6

The current dependency is v0.45.1 with the latest version of k6 being v0.50.0

Is this going to be updated at any point? Between xk6, this extension and recent changes, k6 browser based tests are broken for me. (though I'm not suggesting an update with fix this)

Metrics not delivering to CloudWatch: The parameter ... must be shorter than 1025 characters.

Hi,

I'm using K6 with this extension to delivery metrics to AWS CloudWatch Metrics via the CloudWatch agent.

I noticed that many of the metrics aren't delivery to CloudWatch (obvious when looking at the data on CloudWatch). I tested locally using Graphite, and here it is clear that all metrics are delivering.

I inspected the logs on the CloudWatch agent, and found that many requests are failing with HTTP 400 Bad Request errors. The specific errors look as follows:

<ErrorResponse xmlns=""http://monitoring.amazonaws.com/doc/2010-08-01/"">"
  <Error>
    <Type>Sender</Type>
    <Code>InvalidParameterValue</Code>
    <Message>The parameter MetricData.member.13.Dimensions.member.4.Value must be shorter than 1025 characters.</Message>
  </Error>
  <RequestId>12345</RequestId>
</ErrorResponse>

I realize that this is very specific to CloudWatch, but this extension is the officially recommended approach to delivery metrics to CloudWatch, and thus it feels most appropriate to report the issue here.

By setting the "aws_sdk_log_level" to "LogDebugWithHTTPBody" in the CloudWatch agent config, I am able to see the GZIP compressed Post body content for the failing requests, but I haven't been able to successfully decompress any of these, so I can't see the offending metric value.

Any suggestions regarding how I can further debug this, or potentially solve the issue?

k8s network errors

Hello! I'm use extenson in k6-operator with prometheus-statsd-exporter. In exporter running HPA. When test launched, everything works fine, but when resources run out and k8s creates additional exporters pods, traffic is not distributed to them. Apparently due to address caching. After deleting the exporters starting pod, I see a sending error in the logs. After this, traffic begins to be distributed among several pods, but not all.

Porting a know issues from the k6 repository

What?

There are a couple of opened issues in the k6 repository related to the StatsD output:

Since we likely won't work on them, keeping in mind the grafana/k6#2982 it's good to port (not sure of transfer could work) to this repository since currently this is the primarily recommended repository for the k6's statsd output.

@LeonAdato, do you think that makes sense? If so, I could port the mentioned issues to the repo and close them in the k6 reposory

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.