Coder Social home page Coder Social logo

javaducky / k6-office-hours-047 Goto Github PK

View Code? Open in Web Editor NEW
24.0 2.0 7.0 33 KB

k6 Office Hours session 47, https://www.youtube.com/watch?v=IW7I_vWV93A

License: GNU Affero General Public License v3.0

Dockerfile 14.72% Shell 65.28% JavaScript 20.01%
demo k6 xk6 k6-office-hours

k6-office-hours-047's Introduction

Demos from k6 Office Hours #47 (March 25, 2022)

Note

These instructions have been updated as of k6 version 0.47.0 (fall 2023). Updates to k6 and highlighted extensions may have changed the workflow shown in the video demonstration. The following instructions should supersede those from the video.

Running the xk6-dashboard natively

Note

The xk6-dashboard extension was transferred to the Grafana organization thanks to @szkiba!

Build multiple extensions into a single Docker image

  • Generate a multi-extension Docker image of k6 using Dockerfile.
    docker build -t k6-extended:latest .

Running the xk6-output-influxdb extension within Docker

  • Start our Grafana service backed by InfluxDB
    docker compose -f influxdb/docker-compose.yml up
  • Run a test using run-influxdb.sh
    ./run-influxdb.sh scripts/ramping-arr-rate.js
  • Access the Grafana dashboard at http://localhost:3000/
  • Shutdown Docker when finished running scripts
    docker compose -f influxdb/docker-compose.yml down

Running the xk6-output-timescaledb extension within Docker

  • Start our Grafana service backed by InfluxDB
    docker compose -f timescaledb/docker-compose.yml up
  • Run a test using run-timescaledb.sh
    ./run-timescaledb.sh scripts/ramping-arr-rate.js
  • Access the Grafana dashboard at http://localhost:3000/
  • Shutdown Docker when finished running scripts
    docker compose -f timescaledb/docker-compose.yml down

Running the xk6-output-prometheus-remote extension within Docker

Important

The xk6-output-prometheus-remote extension is now built into the native k6 binary as an experimental extension. This removes the need to specially compile the extension, but does change some of the usage.

  • Start our Grafana service backed by Prometheus
    docker compose -f prometheus/docker-compose.yml up
  • Run a test using run-prometheus.sh
    ./run-prometheus.sh scripts/ramping-arr-rate.js
  • Access the Grafana dashboard at http://localhost:3000/
  • Shutdown Docker when finished running scripts
    docker compose -f prometheus/docker-compose.yml down

k6-office-hours-047's People

Contributors

javaducky avatar

Stargazers

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

Watchers

 avatar  avatar

k6-office-hours-047's Issues

k6 build fails

Hi Paul,
I got an error as given below when I ran the docker command 'docker build -t k6-extended:latest .'.
I didnt understand what causes this error.. Why it is complaining and what I should do to continue ?
Thanks in advance.

$ docker build -t k6-extended:latest .
[+] Building 11.9s (15/17) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.07kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/alpine:3.15 2.7s
=> [internal] load metadata for docker.io/library/golang:1.18-alpine 2.6s
=> [auth] library/alpine:pull token for registry-1.docker.io 0.0s
=> [auth] library/golang:pull token for registry-1.docker.io 0.0s
=> [builder 1/6] FROM docker.io/library/golang:1.18-alpine@sha256:77f25981bd57e60a510165f3be89c901aec90453fd0f1c5a45691f6cb1528807 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 4.57kB 0.0s
=> [stage-1 1/4] FROM docker.io/library/alpine:3.15@sha256:794bc829ea39d85926be70fedfc9fb17aa4244d82b2fbecb5634b03e5dd97aca 0.0s
=> CACHED [stage-1 2/4] RUN apk add --no-cache ca-certificates && adduser -D -u 12345 -g 12345 k6 0.0s
=> CACHED [builder 2/6] WORKDIR /go/src/go.k6.io/k6 0.0s
=> CACHED [builder 3/6] ADD . . 0.0s
=> CACHED [builder 4/6] RUN apk --no-cache add build-base git 0.0s
=> CACHED [builder 5/6] RUN go install go.k6.io/xk6/cmd/xk6@latest 0.0s
=> ERROR [builder 6/6] RUN CGO_ENABLED=0 xk6 build --with github.com/grafana/xk6-output-prometheus-remote --with github.com/grafana/xk6-output-timescaledb --with github.com/grafana/xk6-output-influxdb --output / 9.1s

[builder 6/6] RUN CGO_ENABLED=0 xk6 build --with github.com/grafana/xk6-output-prometheus-remote --with github.com/grafana/xk6-output-timescaledb --with github.com/grafana/xk6-output-influxdb --output /tmp/k6:
0.228 2023/11/25 23:49:42 [INFO] Temporary folder: /tmp/buildenv_2023-11-25-2349.3603754344
0.228 2023/11/25 23:49:42 [INFO] Initializing Go module
0.228 2023/11/25 23:49:42 [INFO] exec (timeout=10s): /usr/local/go/bin/go mod init k6
0.231 go: creating new go.mod: module k6
0.232 2023/11/25 23:49:42 [INFO] Pinning versions
0.232 2023/11/25 23:49:42 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod edit -require github.com/grafana/xk6-output-prometheus-remote@latest
0.234 2023/11/25 23:49:42 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod tidy -compat=1.17
0.358 go: downloading github.com/grafana/xk6-output-prometheus-remote v0.3.1
0.698 go: downloading go.k6.io/k6 v0.46.1-0.20230921075448-d1c5ee8fb28d
0.698 go: downloading buf.build/gen/go/prometheus/prometheus/protocolbuffers/go v1.31.0-20230627135113-9a12bc2590d2.1
0.698 go: downloading github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd
0.698 go: downloading github.com/prometheus/client_golang v1.16.0
0.698 go: downloading github.com/prometheus/client_model v0.4.0
0.699 go: downloading github.com/sirupsen/logrus v1.9.3
0.774 go: downloading gopkg.in/guregu/null.v3 v3.3.0
0.785 go: downloading github.com/stretchr/testify v1.8.4
0.838 go: downloading google.golang.org/protobuf v1.31.0
0.850 go: downloading github.com/klauspost/compress v1.16.7
0.937 go: downloading github.com/golang/snappy v0.0.4
0.942 go: downloading buf.build/gen/go/gogo/protobuf/protocolbuffers/go v1.31.0-20210810001428-4df00b267f94.1
0.978 go: downloading golang.org/x/sys v0.11.0
1.062 go: downloading github.com/beorn7/perks v1.0.1
1.062 go: downloading github.com/cespare/xxhash/v2 v2.2.0
1.063 go: downloading github.com/prometheus/common v0.42.0
1.107 go: downloading github.com/prometheus/procfs v0.10.1
1.164 go: downloading github.com/davecgh/go-spew v1.1.1
1.165 go: downloading github.com/pmezard/go-difflib v1.0.0
1.182 go: downloading gopkg.in/yaml.v3 v3.0.1
1.202 go: downloading github.com/mailru/easyjson v0.7.7
1.221 go: downloading github.com/golang/protobuf v1.5.3
1.262 go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.4
1.288 go: downloading github.com/spf13/afero v1.1.2
1.288 go: downloading golang.org/x/time v0.3.0
1.311 go: downloading github.com/josharian/intern v1.0.0
1.328 go: downloading github.com/fatih/color v1.15.0
1.362 go: downloading golang.org/x/text v0.12.0
1.367 go: downloading github.com/mattn/go-colorable v0.1.13
1.437 go: downloading github.com/mattn/go-isatty v0.0.19
3.985 go: downloading github.com/mstoykov/envconfig v1.4.1-0.20220114105314-765c6d8c76f1
4.061 go: downloading github.com/google/go-cmp v0.5.9
4.068 go: downloading github.com/andybalholm/brotli v1.0.5
4.068 go: downloading github.com/gorilla/websocket v1.5.0
4.068 go: downloading github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa
4.069 go: downloading golang.org/x/net v0.14.0
4.147 go: downloading google.golang.org/grpc v1.57.0
4.162 go: downloading golang.org/x/crypto v0.12.0
4.553 go: downloading google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19
4.598 2023/11/25 23:49:47 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod edit -require github.com/grafana/xk6-output-timescaledb@latest
4.601 2023/11/25 23:49:47 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod tidy -compat=1.17
4.695 go: downloading github.com/grafana/xk6-output-timescaledb v0.2.1
4.862 go: downloading github.com/jackc/pgx/v5 v5.2.0
5.010 go: downloading github.com/jackc/puddle/v2 v2.1.2
5.010 go: downloading github.com/jackc/pgpassfile v1.0.0
5.010 go: downloading github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b
5.059 go: downloading golang.org/x/sync v0.3.0
5.059 go: downloading go.uber.org/atomic v1.10.0
5.189 2023/11/25 23:49:47 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod edit -require github.com/grafana/xk6-output-influxdb@latest
5.191 2023/11/25 23:49:47 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod tidy -compat=1.17
5.267 go: downloading github.com/grafana/xk6-output-influxdb v0.4.1
5.359 go: downloading github.com/influxdata/influxdb-client-go/v2 v2.12.2
5.431 go: downloading github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf
5.431 go: downloading github.com/deepmap/oapi-codegen v1.12.4
5.431 go: downloading github.com/pkg/errors v0.9.1
5.523 go: downloading github.com/google/uuid v1.3.0
5.523 go: downloading github.com/apapsch/go-jsonmerge/v2 v2.0.0
7.978 go: downloading gopkg.in/guregu/null.v3 v3.5.0
7.994 go: downloading github.com/spf13/afero v1.9.5
8.003 go: downloading google.golang.org/genproto v0.0.0-20210226172003-ab064af71705
8.922 k6 imports
8.922 github.com/grafana/xk6-output-influxdb imports
8.922 go.k6.io/k6/output imports
8.922 go.k6.io/k6/lib imports
8.922 go.k6.io/k6/loader tested by
8.922 go.k6.io/k6/loader.test imports
8.922 go.k6.io/k6/lib/testutils/httpmultibin imports
8.922 google.golang.org/grpc/status imports
8.922 google.golang.org/genproto/googleapis/rpc/status: ambiguous import: found package google.golang.org/genproto/googleapis/rpc/status in multiple modules:
8.922 google.golang.org/genproto v0.0.0-20210226172003-ab064af71705 (/go/pkg/mod/google.golang.org/[email protected]/googleapis/rpc/status)
8.922 google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 (/go/pkg/mod/google.golang.org/genproto/googleapis/[email protected]/status)
8.923 2023/11/25 23:49:51 [INFO] Cleaning up temporary folder: /tmp/buildenv_2023-11-25-2349.3603754344
8.923 2023/11/25 23:49:51 [FATAL] exit status 1


Dockerfile:15

14 | #
15 | >>> RUN CGO_ENABLED=0 xk6 build
16 | >>> --with github.com/grafana/xk6-output-prometheus-remote
17 | >>> --with github.com/grafana/xk6-output-timescaledb
18 | >>> --with github.com/grafana/xk6-output-influxdb
19 | >>> --output /tmp/k6
20 |

ERROR: failed to solve: process "/bin/sh -c CGO_ENABLED=0 xk6 build --with github.com/grafana/xk6-output-prometheus-remote --with github.com/grafana/xk6-output-timescaledb --with github.com/grafana/xk6-output-influxdb --output /tmp/k6" did not complete successfully: exit code: 1

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.