GithubHelp home page GithubHelp logo

Comments (6)

jmdacruz avatar jmdacruz commented on July 23, 2024 4

thanks @dgzlopes, I completely missed the -e argument! And yes, it would be ideal to be able to replace the image on the operator. I'll see if I can put together a PR for this.

from k6-operator.

simskij avatar simskij commented on July 23, 2024 1

Yeah, using -e won't work, just as you point out @mikaelkundert. What that does is that it allows the k6 script to use it as an environment variable. However, the statsd output is initiated outside of the actual test script. I'll raise an issue about adding support for env vars in the CRD.

from k6-operator.

dgzlopes avatar dgzlopes commented on July 23, 2024

Hey :)

You can pass env vars as arguments in k6. Something like this should work:

apiVersion: k6.io/v1alpha1
kind: K6
metadata:
  name: k6-sample
spec:
  parallelism: 4
  script: k6-test
  arguments: -e K6_STATSD_ADDR=something --out statsd

Another approach is to create an image with a custom k6 build that includes https://github.com/szkiba/xk6-prometheus. Then, you can use that img on the operator and scrape the metrics from the pods as usual. But idk if we have support to swap the image used by the operator (cc @simskij).

from k6-operator.

dgzlopes avatar dgzlopes commented on July 23, 2024

Now that #17 has been merged, we can close this :)

btw, thanks for raising the issue!

from k6-operator.

mikaelkundert avatar mikaelkundert commented on July 23, 2024

I did not get -e argument working.

I got following errors:

time="2021-06-04T14:51:39Z" level=error msg="Couldn't flush a batch" error="write udp 127.0.0.1:36848->127.0.0.1:8125: write: connection refused" output=statsd

While having following manifest:

apiVersion: k6.io/v1alpha1
kind: K6
metadata:
  name: k6-sample
spec:
  parallelism: 4
  script: crocodile-stress-test
  arguments: -e K6_STATSD_ADDR=graphite-1622816495:8125 --out statsd

This popped up job with commands:

k6 run --quiet --execution-segment=0:1/4 --execution-segment-sequence=0,1/4,2/4,3/4,1 -e K6_STATSD_ADDR=graphite-1622816495:8125 --out statsd /test/test.js --address=0.0.0.0:6565 --paused

/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: /test/test.js
output: statsd (localhost:8125)

But this doesn't work locally either. Unless I run the command as follow:

$ K6_STATSD_ADDR=graphite-1622816495:8125 k6 run --quiet --execution-segment=0:1/4 --execution-segment-sequence=0,1/4,2/4,3/4,1 -e K6_STATSD_ADDR=graphite-1622816495:8125 --out statsd ./test.js --address=0.0.0.0:6565 --paused

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

ERRO[0000] The moduleSpecifier "./test.js" couldn't be found on local disk. Make sure that you've specified the right path to the file. If you're running k6 using the Docker image make sure you have mounted the local directory (-v /local/path/:/inside/docker/path) containing your script and modules so that they're accessible by k6 from inside of the container, see https://k6.io/docs/using-k6/modules#using-local-modules-with-docker.

from k6-operator.

mikaelkundert avatar mikaelkundert commented on July 23, 2024

I noticed that error message was about missing test.js, but here's the actual error message that indicates that latter command should work.

$ K6_STATSD_ADDR=graphite-1622816495:8125 k6 run --quiet --execution-segment=0:1/4 --execution-segment-sequence=0,1/4,2/4,3/4,1 -e K6_STATSD_ADDR=graphite-1622816495:8125 --out statsd ./test.js --address=0.0.0.0:6565 --paused

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

ERRO[0000] Couldn't make buffered client, lookup graphite-1622816495 on 127.0.0.53:53: server misbehaving  output=statsd
ERRO[0000] lookup graphite-1622816495 on 127.0.0.53:53: server misbehaving 

from k6-operator.

Related Issues (20)

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.