diff --git a/README.md b/README.md index d331e90..d764038 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ application._ - in wasmCloud on VMs [example](./platform-wasmcloud/README.md) - in wasmCloud on Kubernetes, with the wasmCloud Operator [example](./platform-wasmcloud/README.md) - - in Spin on VMs — to be added - - in Spin on Kubernetes, with SpinKube — to be added + - in Spin on VMs — to be added + - in Spin on Kubernetes, with SpinKube — to be added > [!CAUTION] diff --git a/java-containers-k8s/kubernetes/local_k3d/README.md b/java-containers-k8s/kubernetes/local_k3d/README.md index e4828d3..1efb001 100644 --- a/java-containers-k8s/kubernetes/local_k3d/README.md +++ b/java-containers-k8s/kubernetes/local_k3d/README.md @@ -3,7 +3,7 @@ 1. Create the cluster with a registry ```fish - ./create.fish + ../../../local_k3d/create.fish ``` 1. Add the registry to your local /etc/hosts @@ -47,7 +47,7 @@ 1. Delete the cluster ```fish - ./destroy.fish + ../../../local_k3d/destroy.fish ``` ## Test diff --git a/java-containers-k8s/kubernetes/local_k3d/destroy.fish b/java-containers-k8s/kubernetes/local_k3d/destroy.fish deleted file mode 100755 index 99111a6..0000000 --- a/java-containers-k8s/kubernetes/local_k3d/destroy.fish +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env fish - -function section - echo - string pad --right --char=— -w$COLUMNS "———— $argv ————" -end - -section "deleting platform-poc cluster" -k3d cluster delete platform-poc - -section "deleting registry" -k3d registry delete platform-poc.localhost diff --git a/java-containers-k8s/kubernetes/local_k3d/create.fish b/local_k3d/create.fish similarity index 74% rename from java-containers-k8s/kubernetes/local_k3d/create.fish rename to local_k3d/create.fish index bd12c9b..94f99b5 100755 --- a/java-containers-k8s/kubernetes/local_k3d/create.fish +++ b/local_k3d/create.fish @@ -1,5 +1,7 @@ #!/usr/bin/env fish +set --local SCRIPT_DIR (dirname (realpath (status -f))) + function section echo string pad --right --char=— -w$COLUMNS "———— $argv ————" @@ -8,7 +10,7 @@ end section "starting registry" k3d registry create platform-poc.localhost --port 5001 -section "starting platform-poc cluster" +section "starting cluster" k3d cluster create platform-poc \ --agents 2 \ --registry-use k3d-platform-poc.localhost:5001 \ @@ -17,3 +19,6 @@ k3d cluster create platform-poc \ section configuration kubectl cluster-info + +section "deploying prometheus" +./deploy_prometheus.fish diff --git a/local_k3d/deploy_prometheus.fish b/local_k3d/deploy_prometheus.fish new file mode 100755 index 0000000..96b6cff --- /dev/null +++ b/local_k3d/deploy_prometheus.fish @@ -0,0 +1,61 @@ +#!/usr/bin/env fish + +set --local SCRIPT_DIR (dirname (realpath (status -f))) + +function section + echo + string pad --right --char=— -w$COLUMNS "———— $argv ————" +end + +rm -rf $SCRIPT_DIR/kube-prometheus +mkdir -p $SCRIPT_DIR/kube-prometheus +pushd $SCRIPT_DIR/kube-prometheus +echo "*" >.gitignore + +curl -L https://github.com/prometheus-operator/kube-prometheus/archive/main.zip -o kube-prometheus-main.zip +tar -xvf kube-prometheus-main.zip +rm kube-prometheus-main.zip + +mv kube-prometheus-main/manifests/setup . +mv kube-prometheus-main/manifests . +rm -rf kube-prometheus-main + +kubectl create -f setup +while not kubectl get servicemonitors --all-namespaces + date + sleep 1 +end +kubectl create -f manifests + +function daemon + pushd /tmp + status job-control full + set -l name $argv[1] + if test -f {$name}.pid + set -l PID (cat {$name}.pid) + rm -f {$name}.pid {$name}.out + if test -n "$PID" + echo "Killing $name with PID $PID" + kill $PID + end + end + set -l command $argv[2..-1] + command nohup $command >{$name}.out 2>&1 & + echo {$name}... + echo $last_pid >{$name}.pid + sleep 0.5 + cat {$name}.out + popd +end + +section "forwarding ports" +kubectl \ + --namespace monitoring \ + wait \ + --for condition=ready \ + --timeout 60s \ + pod \ + --selector app.kubernetes.io/part-of=kube-prometheus +daemon prometheus kubectl --namespace monitoring port-forward svc/prometheus-k8s 9090 +daemon grafana kubectl --namespace monitoring port-forward svc/grafana 3000 +daemon alertmanager kubectl --namespace monitoring port-forward svc/alertmanager-main 9093 diff --git a/rust-containers-k8s/kubernetes/local_k3d/destroy.fish b/local_k3d/destroy.fish similarity index 81% rename from rust-containers-k8s/kubernetes/local_k3d/destroy.fish rename to local_k3d/destroy.fish index 99111a6..c3aaead 100755 --- a/rust-containers-k8s/kubernetes/local_k3d/destroy.fish +++ b/local_k3d/destroy.fish @@ -5,6 +5,9 @@ function section string pad --right --char=— -w$COLUMNS "———— $argv ————" end +section "removing kube-prometheus" +./undeploy_prometheus.fish + section "deleting platform-poc cluster" k3d cluster delete platform-poc diff --git a/local_k3d/undeploy_prometheus.fish b/local_k3d/undeploy_prometheus.fish new file mode 100755 index 0000000..073eb87 --- /dev/null +++ b/local_k3d/undeploy_prometheus.fish @@ -0,0 +1,36 @@ +#!/usr/bin/env fish + +set --local SCRIPT_DIR (dirname (realpath (status -f))) + +function section + echo + string pad --right --char=— -w$COLUMNS "———— $argv ————" +end + +function stop + set -l name $argv[1] + pushd /tmp + if test -f {$name}.pid + set -l PID (cat {$name}.pid) + rm -f {$name}.pid {$name}.out + if test -n "$PID" + echo "Killing $name with PID $PID" + kill $PID + end + end + popd +end + +section "stopping port forwarding" +stop prometheus +stop grafana +stop alertmanager + +section "removing kube-prometheus" +if test -d $SCRIPT_DIR/kube-prometheus + pushd $SCRIPT_DIR/kube-prometheus + kubectl delete --ignore-not-found=true -f manifests/ -f setup/ + popd +end + +rm -rf $SCRIPT_DIR/kube-prometheus diff --git a/platform-wasmcloud/k3d/README.md b/platform-wasmcloud/k3d/README.md index 2474c69..901873c 100644 --- a/platform-wasmcloud/k3d/README.md +++ b/platform-wasmcloud/k3d/README.md @@ -3,7 +3,7 @@ 1. Create the cluster and local registry ```fish - ./create.fish + ../../local_k3d/create.fish ``` 1. Install the wasmCloud operator @@ -15,7 +15,7 @@ 1. Start redis, postgres, wash ui and port forwarding ```fish - ../up.fish + ./up.fish ``` 1. Build the platform-poc application @@ -27,13 +27,13 @@ 1. Install our platform-poc application ```fish - kubectl apply -f ./wadm.yaml + ./deploy.fish ``` 1. Delete the application ```fish - kubectl delete -f ./wadm.yaml + ./undeploy.fish ``` 1. Stop the cluster @@ -45,5 +45,5 @@ 1. Delete the cluster and registry ```fish - ./destroy.fish + ../../local_k3d/destroy.fish ``` diff --git a/platform-wasmcloud/k3d/create.fish b/platform-wasmcloud/k3d/create.fish deleted file mode 100755 index bd12c9b..0000000 --- a/platform-wasmcloud/k3d/create.fish +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env fish - -function section - echo - string pad --right --char=— -w$COLUMNS "———— $argv ————" -end - -section "starting registry" -k3d registry create platform-poc.localhost --port 5001 - -section "starting platform-poc cluster" -k3d cluster create platform-poc \ - --agents 2 \ - --registry-use k3d-platform-poc.localhost:5001 \ - --api-port 6550 \ - -p "8081:80@loadbalancer" - -section configuration -kubectl cluster-info diff --git a/platform-wasmcloud/k3d/deploy.fish b/platform-wasmcloud/k3d/deploy.fish new file mode 100755 index 0000000..4ae40ea --- /dev/null +++ b/platform-wasmcloud/k3d/deploy.fish @@ -0,0 +1,9 @@ +#!/usr/bin/env fish + +function section + echo + string pad --right --char=— -w$COLUMNS "———— $argv ————" +end + +section "deploying components" +kubectl apply -f ./wadm.yaml diff --git a/platform-wasmcloud/k3d/destroy.fish b/platform-wasmcloud/k3d/destroy.fish deleted file mode 100755 index 99111a6..0000000 --- a/platform-wasmcloud/k3d/destroy.fish +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env fish - -function section - echo - string pad --right --char=— -w$COLUMNS "———— $argv ————" -end - -section "deleting platform-poc cluster" -k3d cluster delete platform-poc - -section "deleting registry" -k3d registry delete platform-poc.localhost diff --git a/platform-wasmcloud/k3d/undeploy.fish b/platform-wasmcloud/k3d/undeploy.fish new file mode 100755 index 0000000..f8e0f20 --- /dev/null +++ b/platform-wasmcloud/k3d/undeploy.fish @@ -0,0 +1,11 @@ +#!/usr/bin/env fish + +set --local SCRIPT_DIR (dirname (realpath (status -f))) + +function section + echo + string pad --right --char=— -w$COLUMNS "———— $argv ————" +end + +section "deploying components" +kubectl delete -f ./wadm.yaml diff --git a/platform-wasmcloud/k3d/up.fish b/platform-wasmcloud/k3d/up.fish index e00a5c9..44d27cd 100755 --- a/platform-wasmcloud/k3d/up.fish +++ b/platform-wasmcloud/k3d/up.fish @@ -39,7 +39,7 @@ set wasmcloud_host ( ) section "forwarding ports" -daemon http kubectl port-forward $wasmcloud_host 8080 +daemon http kubectl port-forward $wasmcloud_host 8081 daemon nats kubectl port-forward svc/nats 4222 4223 section "starting wash UI" diff --git a/platform-wasmcloud/k3d/wadm.yaml b/platform-wasmcloud/k3d/wadm.yaml index fad5692..67f07ce 100644 --- a/platform-wasmcloud/k3d/wadm.yaml +++ b/platform-wasmcloud/k3d/wadm.yaml @@ -25,14 +25,7 @@ spec: target: name: sqldb-postgres config: - - name: data-init-pg - properties: - POSTGRES_HOST: host.docker.internal - POSTGRES_PORT: "5432" - POSTGRES_USERNAME: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DATABASE: postgres - POSTGRES_TLS_REQUIRED: "false" + - name: platform_poc-default_postgres - type: link properties: namespace: wasi @@ -41,9 +34,7 @@ spec: target: name: kv-redis config: - - name: data-init-redis - properties: - url: "redis://host.docker.internal:6379" + - name: platform_poc-default_redis - name: http-controller type: component @@ -53,7 +44,7 @@ spec: traits: - type: spreadscaler properties: - instances: 200 + instances: 1000 - type: link properties: namespace: platform-poc @@ -91,7 +82,7 @@ spec: traits: - type: spreadscaler properties: - instances: 200 + instances: 1000 - type: link properties: namespace: wasi @@ -100,9 +91,7 @@ spec: target: name: kv-redis config: - - name: products-redis - properties: - url: "redis://host.docker.internal:6379" + - name: platform_poc-default_redis - name: inventory-service type: component @@ -112,7 +101,7 @@ spec: traits: - type: spreadscaler properties: - instances: 200 + instances: 1000 - type: link properties: namespace: wasmcloud @@ -121,14 +110,7 @@ spec: target: name: sqldb-postgres config: - - name: inventory-pg - properties: - POSTGRES_HOST: host.docker.internal - POSTGRES_PORT: "5432" - POSTGRES_USERNAME: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DATABASE: postgres - POSTGRES_TLS_REQUIRED: "false" + - name: platform_poc-default_postgres - name: notification-service type: component @@ -138,7 +120,7 @@ spec: traits: - type: spreadscaler properties: - instances: 200 + instances: 1000 - name: orders-service type: component @@ -148,7 +130,7 @@ spec: traits: - type: spreadscaler properties: - instances: 200 + instances: 1000 - type: link properties: namespace: wasmcloud @@ -157,14 +139,7 @@ spec: target: name: sqldb-postgres config: - - name: orders-pg - properties: - POSTGRES_HOST: host.docker.internal - POSTGRES_PORT: "5432" - POSTGRES_USERNAME: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DATABASE: postgres - POSTGRES_TLS_REQUIRED: "false" + - name: platform_poc-default_postgres - type: link properties: namespace: platform-poc @@ -185,8 +160,12 @@ spec: - name: http-server type: capability properties: - image: ghcr.io/wasmcloud/http-server:0.25.0 + image: ghcr.io/wasmcloud/http-server:0.26.0 id: http-server + config: + - name: default-http + properties: + address: 0.0.0.0:8081 traits: - type: link properties: @@ -195,9 +174,7 @@ spec: interfaces: [incoming-handler] source: config: - - name: default-http - properties: - address: 0.0.0.0:8080 + - name: platform_poc-default_http target: name: http-controller @@ -206,18 +183,35 @@ spec: properties: image: ghcr.io/wasmcloud/keyvalue-redis:0.28.2 id: kv-redis + config: + - name: default-redis + properties: + url: "redis://host.docker.internal:6379" - name: sqldb-postgres type: capability properties: image: ghcr.io/wasmcloud/sqldb-postgres:0.7.2 id: sqldb-postgres + config: + - name: default-postgres + properties: + POSTGRES_HOST: host.docker.internal + POSTGRES_PORT: "5432" + POSTGRES_USERNAME: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DATABASE: postgres + POSTGRES_TLS_REQUIRED: "false" - name: nats type: capability properties: - image: ghcr.io/wasmcloud/messaging-nats:0.24.0 + image: ghcr.io/wasmcloud/messaging-nats:0.25.0 id: nats + config: + - name: default-nats + properties: + subscriptions: "platform-poc.order-notification" traits: - type: link properties: @@ -226,8 +220,6 @@ spec: interfaces: [handler] source: config: - - name: default-nats - properties: - subscriptions: "platform-poc.order-notification" + - name: platform_poc-default_nats target: name: notification-service diff --git a/platform-wasmcloud/k3d/wasmcloud-host.yaml b/platform-wasmcloud/k3d/wasmcloud-host.yaml index 5fdf0e1..85f4973 100644 --- a/platform-wasmcloud/k3d/wasmcloud-host.yaml +++ b/platform-wasmcloud/k3d/wasmcloud-host.yaml @@ -4,7 +4,7 @@ metadata: name: wasmcloud-host spec: lattice: default - version: 1.5.1 + version: 1.6.1 hostReplicas: 1 allowedInsecure: - "host.docker.internal:5001" diff --git a/platform-wasmcloud/k6/run.fish b/platform-wasmcloud/k6/run.fish new file mode 100755 index 0000000..906d463 --- /dev/null +++ b/platform-wasmcloud/k6/run.fish @@ -0,0 +1,7 @@ +#!/usr/bin/env fish + +set --local SCRIPT_DIR (dirname (realpath (status -f))) + +cd $SCRIPT_DIR + +k6 run script.js --out influxdb='http://localhost:8181/k6' diff --git a/platform-wasmcloud/k6/script.js b/platform-wasmcloud/k6/script.js new file mode 100644 index 0000000..e018369 --- /dev/null +++ b/platform-wasmcloud/k6/script.js @@ -0,0 +1,51 @@ +import http from "k6/http"; +import { sleep, check } from "k6"; + +export const options = { + vus: 100, + thresholds: { + // http errors should be less than 1%, otherwise abort the test + http_req_failed: [{ threshold: "rate<0.01", abortOnFail: true }], + // 99% of requests should be below 200ms + http_req_duration: ["p(99)<200"], + }, + scenarios: { + average_load: { + executor: "ramping-vus", + stages: [ + { duration: "5s", target: 50 }, + { duration: "10s", target: 100 }, + { duration: "10s", target: 200 }, + { duration: "10s", target: 300 }, + { duration: "10s", target: 400 }, + { duration: "10s", target: 500 }, + { duration: "10s", target: 0 }, + ], + }, + }, +}; + +export default function () { + const url = "http://localhost:8081/api/order"; + const payload = JSON.stringify([ + { + sku: "WND-WPR-AW", + price: 1000, + quantity: 1, + }, + ]); + const params = { + headers: { + "Content-Type": "application/json", + }, + }; + check(http.post(url, payload, params), { + "status is 201": (res) => res.status === 201, + }); + + check(http.get(url), { + "status is 200": (res) => res.status === 200, + }); + + sleep(1); +} diff --git a/platform-wasmcloud/README.md b/platform-wasmcloud/local/README.md similarity index 65% rename from platform-wasmcloud/README.md rename to platform-wasmcloud/local/README.md index 458d766..c6e07b1 100644 --- a/platform-wasmcloud/README.md +++ b/platform-wasmcloud/local/README.md @@ -10,82 +10,92 @@ _Wasm components linked at runtime (via wRPC) and running in wasmCloud._ ### wasmCloud -Install `wash` with `brew install wasmcloud/wasmcloud/wash`. +Install `wash`, e.g. with `brew install wasmcloud/wasmcloud/wash`. ```bash wash --version -# wash v0.38.0 +# wash v0.39.0 # ├ nats-server v2.10.20 -# ├ wadm v0.19.0 -# └ wasmcloud v1.4.2 +# ├ wadm v0.20.2 +# └ wasmcloud v1.6.1 ``` -### Docker - -We use `docker` to start a local registry, so you will need to have it installed. - ## run -1. Start up a running environment. +1. Create a platform environment. Starts: - * a local redis server - * a local postgres server * a local OCI registry * a single wasmCloud host, with NATS and `wadm` running * the wash UI (http://localhost:3030/) ```bash - ./local/up.fish + ./create.fish + ``` + +1. Start up external services. + + Starts: + * a local redis server + * a local postgres server + + ```bash + ./up.fish ``` 1. Build (and sign) the components, pushing them to the local registry ```bash - ./build_and_push.fish + ../build_and_push.fish ``` 1. Deploy the components with `wadm` ```bash - ./start.fish + ./deploy.fish ``` 1. Redeploy the components with `wadm` ```bash - ./restart.fish + ./redeploy.fish ``` 1. Delete the application with `wadm` ```bash - ./stop.fish + ./undeploy.fish ``` -1. Stop the wasmCloud host +1. Stop the external services ```bash ./local/down.fish ``` +1. Destroy the registry and the wasmCloud host + + ```bash + ./local/destroy.fish + ``` + 1. Test ```bash # data init - curl 'localhost:8080/data-init/all' + curl 'localhost:8081/api/data-init/all' # products - curl 'localhost:8080/products' + curl 'localhost:8081/api/products' # inventory - curl 'localhost:8080/inventory/?skus=ENG-V8-500' + curl 'localhost:8081/api/inventory/?skus=ENG-V8-500' # orders - curl 'localhost:8080/orders' + curl 'localhost:8081/api/orders' # create order (fish shell) - curl localhost:8080/orders -d ' + curl localhost:8081/api/orders -d ' [ { "sku": "WND-WPR-AW", @@ -104,7 +114,7 @@ We use `docker` to start a local registry, so you will need to have it installed ### benchmark ```fish -oha 'http://localhost:8080/orders' \ +oha 'http://localhost:8081/api/orders' \ -c 100 \ -n 10000 \ -m POST \ diff --git a/platform-wasmcloud/local/create.fish b/platform-wasmcloud/local/create.fish new file mode 100755 index 0000000..57f6964 --- /dev/null +++ b/platform-wasmcloud/local/create.fish @@ -0,0 +1,43 @@ +#!/usr/bin/env fish + +function section + echo + string pad --right --char=— -w$COLUMNS "———— $argv ————" +end + +section "starting registry" +k3d registry create platform-poc.localhost --port 5001 + +section "stopping NATS in case it's running locally" +brew services stop nats-server + +section "starting wasmcloud, NATS and wadm" +set -x WASMCLOUD_EXPERIMENTAL_FEATURES "builtin-messaging-nats,builtin-http-server" +wash up \ + --detached \ + --allow-latest \ + --allowed-insecure "localhost:5001" + +function daemon + pushd /tmp + status job-control full + set -l name $argv[1] + if test -f {$name}.pid + set -l PID (cat {$name}.pid) + rm -f {$name}.pid {$name}.out + if test -n "$PID" + echo "Killing $name with PID $PID" + kill $PID + end + end + set -l command $argv[2..-1] + command nohup $command >{$name}.out 2>&1 & + echo {$name}... + echo $last_pid >{$name}.pid + sleep 0.5 + cat {$name}.out + popd +end + +section "starting wash-ui" +daemon wash-ui wash ui -v 0.6.0 diff --git a/platform-wasmcloud/start.fish b/platform-wasmcloud/local/deploy.fish similarity index 100% rename from platform-wasmcloud/start.fish rename to platform-wasmcloud/local/deploy.fish diff --git a/platform-wasmcloud/local/destroy.fish b/platform-wasmcloud/local/destroy.fish new file mode 100755 index 0000000..a687bb7 --- /dev/null +++ b/platform-wasmcloud/local/destroy.fish @@ -0,0 +1,37 @@ +#!/usr/bin/env fish + +set --local SCRIPT_DIR (dirname (realpath (status -f))) + +function section + echo + string pad --right --char=— -w$COLUMNS "———— $argv ————" +end + +section "undeploying wasm components" +$SCRIPT_DIR/undeploy.fish + +section "stopping wasmcloud, NATS and wadm" +wash down --all + +section "deleting registry" +k3d registry delete platform-poc.localhost + +function stop + set -l name $argv[1] + pushd /tmp + if test -f {$name}.pid + set -l PID (cat {$name}.pid) + rm -f {$name}.pid {$name}.out + if test -n "$PID" + echo "Killing $name with PID $PID" + kill $PID + end + end + popd +end + +section "stopping wash-ui" +stop wash-ui + +section "draining caches" +wash drain all diff --git a/platform-wasmcloud/local/down.fish b/platform-wasmcloud/local/down.fish index a3648a5..5bc5bce 100755 --- a/platform-wasmcloud/local/down.fish +++ b/platform-wasmcloud/local/down.fish @@ -1,44 +1,12 @@ #!/usr/bin/env fish -set --local SCRIPT_DIR (dirname (realpath (status -f))) - function section echo string pad --right --char=— -w$COLUMNS "———— $argv ————" end -section "stopping platform-poc wasm components" -$SCRIPT_DIR/../stop.fish - -section "stopping wasmcloud, NATS and wadm" -wash down --all - -section "stopping local registry" -# local registry on port 5001 -$SCRIPT_DIR/../registry.fish down - -function stop - set -l name $argv[1] - pushd /tmp - if test -f {$name}.pid - set -l PID (cat {$name}.pid) - rm -f {$name}.pid {$name}.out - if test -n "$PID" - echo "Killing $name with PID $PID" - kill $PID - end - end - popd -end - -section "stopping wash-ui" -stop wash-ui - section "stopping redis" brew services stop redis section "stopping postgresql@15" brew services stop postgresql@15 - -section "draining caches" -wash drain all diff --git a/platform-wasmcloud/local/redeploy.fish b/platform-wasmcloud/local/redeploy.fish new file mode 100755 index 0000000..5c68784 --- /dev/null +++ b/platform-wasmcloud/local/redeploy.fish @@ -0,0 +1,6 @@ +#!/usr/bin/env fish + +set --local SCRIPT_DIR (dirname (realpath (status -f))) + +$SCRIPT_DIR/undeploy.fish +$SCRIPT_DIR/deploy.fish diff --git a/platform-wasmcloud/stop.fish b/platform-wasmcloud/local/undeploy.fish similarity index 100% rename from platform-wasmcloud/stop.fish rename to platform-wasmcloud/local/undeploy.fish diff --git a/platform-wasmcloud/local/up.fish b/platform-wasmcloud/local/up.fish index aee76d0..ae83ccd 100755 --- a/platform-wasmcloud/local/up.fish +++ b/platform-wasmcloud/local/up.fish @@ -1,7 +1,5 @@ #!/usr/bin/env fish -set --local SCRIPT_DIR (dirname (realpath (status -f))) - function section echo string pad --right --char=— -w$COLUMNS "———— $argv ————" @@ -12,35 +10,3 @@ brew services start redis section "starting postgresql@15" brew services start postgresql@15 - -section "starting local registry" -# local registry on port 5001 -$SCRIPT_DIR/../registry.fish up - -section "starting wasmcloud, NATS and wadm" -set -x WASMCLOUD_OCI_ALLOWED_INSECURE localhost:5001 -wash up -d - -function daemon - pushd /tmp - status job-control full - set -l name $argv[1] - if test -f {$name}.pid - set -l PID (cat {$name}.pid) - rm -f {$name}.pid {$name}.out - if test -n "$PID" - echo "Killing $name with PID $PID" - kill $PID - end - end - set -l command $argv[2..-1] - command nohup $command >{$name}.out 2>&1 & - echo {$name}... - echo $last_pid >{$name}.pid - sleep 0.1 - cat {$name}.out - popd -end - -section "starting wash-ui" -daemon wash-ui wash ui -v 0.6.0 diff --git a/platform-wasmcloud/wadm.yaml b/platform-wasmcloud/local/wadm.yaml similarity index 73% rename from platform-wasmcloud/wadm.yaml rename to platform-wasmcloud/local/wadm.yaml index 2bbdc53..57e51c5 100644 --- a/platform-wasmcloud/wadm.yaml +++ b/platform-wasmcloud/local/wadm.yaml @@ -25,14 +25,7 @@ spec: target: name: sqldb-postgres config: - - name: data-init-pg - properties: - POSTGRES_HOST: localhost - POSTGRES_PORT: "5432" - POSTGRES_USERNAME: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DATABASE: postgres - POSTGRES_TLS_REQUIRED: "false" + - name: platform_poc-default_postgres - type: link properties: namespace: wasi @@ -41,9 +34,7 @@ spec: target: name: kv-redis config: - - name: data-init-redis - properties: - url: "redis://127.0.0.1:6379" + - name: platform_poc-default_redis - name: http-controller type: component @@ -53,7 +44,7 @@ spec: traits: - type: spreadscaler properties: - instances: 100 + instances: 1000 - type: link properties: namespace: platform-poc @@ -91,7 +82,7 @@ spec: traits: - type: spreadscaler properties: - instances: 100 + instances: 1000 - type: link properties: namespace: wasi @@ -100,9 +91,7 @@ spec: target: name: kv-redis config: - - name: products-redis - properties: - url: "redis://127.0.0.1:6379" + - name: platform_poc-default_redis - name: inventory-service type: component @@ -112,7 +101,7 @@ spec: traits: - type: spreadscaler properties: - instances: 100 + instances: 1000 - type: link properties: namespace: wasmcloud @@ -121,14 +110,7 @@ spec: target: name: sqldb-postgres config: - - name: inventory-pg - properties: - POSTGRES_HOST: localhost - POSTGRES_PORT: "5432" - POSTGRES_USERNAME: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DATABASE: postgres - POSTGRES_TLS_REQUIRED: "false" + - name: platform_poc-default_postgres - name: notification-service type: component @@ -138,7 +120,7 @@ spec: traits: - type: spreadscaler properties: - instances: 100 + instances: 1000 - name: orders-service type: component @@ -148,7 +130,7 @@ spec: traits: - type: spreadscaler properties: - instances: 100 + instances: 1000 - type: link properties: namespace: wasmcloud @@ -157,14 +139,7 @@ spec: target: name: sqldb-postgres config: - - name: orders-pg - properties: - POSTGRES_HOST: localhost - POSTGRES_PORT: "5432" - POSTGRES_USERNAME: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DATABASE: postgres - POSTGRES_TLS_REQUIRED: "false" + - name: platform_poc-default_postgres - type: link properties: namespace: platform-poc @@ -185,8 +160,12 @@ spec: - name: http-server type: capability properties: - image: ghcr.io/wasmcloud/http-server:0.25.0 + image: wasmcloud+builtin://http-server id: http-server + config: + - name: default-http + properties: + address: 0.0.0.0:8081 traits: - type: link properties: @@ -195,9 +174,7 @@ spec: interfaces: [incoming-handler] source: config: - - name: default-http - properties: - address: 0.0.0.0:8080 + - name: platform_poc-default_http target: name: http-controller @@ -206,18 +183,35 @@ spec: properties: image: ghcr.io/wasmcloud/keyvalue-redis:0.28.2 id: kv-redis + config: + - name: default-redis + properties: + url: "redis://127.0.0.1:6379" - name: sqldb-postgres type: capability properties: image: ghcr.io/wasmcloud/sqldb-postgres:0.7.2 id: sqldb-postgres + config: + - name: default-postgres + properties: + POSTGRES_HOST: localhost + POSTGRES_PORT: "5432" + POSTGRES_USERNAME: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DATABASE: postgres + POSTGRES_TLS_REQUIRED: "false" - name: nats type: capability properties: - image: ghcr.io/wasmcloud/messaging-nats:0.24.0 + image: wasmcloud+builtin://messaging-nats id: nats + config: + - name: default-nats + properties: + subscriptions: "platform-poc.order-notification" traits: - type: link properties: @@ -226,8 +220,6 @@ spec: interfaces: [handler] source: config: - - name: default-nats - properties: - subscriptions: "platform-poc.order-notification" + - name: platform_poc-default_nats target: name: notification-service diff --git a/platform-wasmcloud/restart.fish b/platform-wasmcloud/restart.fish deleted file mode 100755 index 30bfc68..0000000 --- a/platform-wasmcloud/restart.fish +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env fish - -./stop.fish -./start.fish diff --git a/rust-containers-k8s/.sqlx/query-ec32a82d65e640cdf1ce55786cbbb431943ce608a6446e516da346adb93e2733.json b/rust-containers-k8s/.sqlx/query-ae4de96af1a48996eb06e7e92de4278fb1492880240f709c12094a9471e981f4.json similarity index 59% rename from rust-containers-k8s/.sqlx/query-ec32a82d65e640cdf1ce55786cbbb431943ce608a6446e516da346adb93e2733.json rename to rust-containers-k8s/.sqlx/query-ae4de96af1a48996eb06e7e92de4278fb1492880240f709c12094a9471e981f4.json index 98fc9e9..dc1619f 100644 --- a/rust-containers-k8s/.sqlx/query-ec32a82d65e640cdf1ce55786cbbb431943ce608a6446e516da346adb93e2733.json +++ b/rust-containers-k8s/.sqlx/query-ae4de96af1a48996eb06e7e92de4278fb1492880240f709c12094a9471e981f4.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT \"order\".id as order_id,\n \"order\".order_number,\n \"line_items\".id as item_id,\n \"line_items\".sku_code,\n \"line_items\".price,\n \"line_items\".quantity\nFROM t_order_line_items as line_items\n JOIN t_orders_order_line_items_list as order_lines ON \"order_lines\".order_line_items_list_id = \"line_items\".id\n JOIN t_orders as \"order\" ON \"order\".id = \"order_lines\".order_id\n", + "query": "SELECT\n \"order\".id as order_id,\n \"order\".order_number,\n \"line_items\".id as item_id,\n \"line_items\".sku_code,\n \"line_items\".price,\n \"line_items\".quantity\nFROM\n t_order_line_items as line_items\n JOIN t_orders_order_line_items_list as order_lines ON \"order_lines\".order_line_items_list_id = \"line_items\".id\n JOIN t_orders as \"order\" ON \"order\".id = \"order_lines\".order_id\nLIMIT\n 10;\n", "describe": { "columns": [ { @@ -46,5 +46,5 @@ true ] }, - "hash": "ec32a82d65e640cdf1ce55786cbbb431943ce608a6446e516da346adb93e2733" + "hash": "ae4de96af1a48996eb06e7e92de4278fb1492880240f709c12094a9471e981f4" } diff --git a/rust-containers-k8s/Makefile b/rust-containers-k8s/Makefile index 72b0ec8..9f84993 100644 --- a/rust-containers-k8s/Makefile +++ b/rust-containers-k8s/Makefile @@ -1,9 +1,11 @@ -.PHONY = default release +.PHONY = default prepare release docker -default: - cargo sqlx prepare --workspace +default: prepare cargo build +prepare: + cargo sqlx prepare --workspace + release: cargo build --release diff --git a/rust-containers-k8s/kubernetes/k6/21825_rev1.json b/rust-containers-k8s/kubernetes/k6/21825_rev1.json new file mode 100644 index 0000000..5e410a5 --- /dev/null +++ b/rust-containers-k8s/kubernetes/k6/21825_rev1.json @@ -0,0 +1,5483 @@ +{ + "__inputs": [ + { + "name": "DS_K6", + "label": "k6", + "description": "InfluxDB 1.8 or InfluxDB 2 with v1 auth", + "type": "datasource", + "pluginId": "influxdb", + "pluginName": "InfluxDB" + } + ], + "__elements": [], + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "8.4.7" + }, + { + "type": "panel", + "id": "graph", + "name": "Graph (old)", + "version": "" + }, + { + "type": "panel", + "id": "histogram", + "name": "Histogram", + "version": "" + }, + { + "type": "datasource", + "id": "influxdb", + "name": "InfluxDB", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + }, + { + "type": "panel", + "id": "text", + "name": "Text", + "version": "" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "description": "A dashboard for visualizing results from the k6.io load testing tool, using the InfluxDB exporter. It supports http, ws, grpc, ... metrics", + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": 21825, + "graphTooltip": 1, + "id": null, + "iteration": 1725451401963, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 68, + "panels": [ + { + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 1 + }, + "id": 66, + "links": [], + "options": { + "content": "### To choose which measurements to show, use the **Measurements** drop-down in the top left corner!\n\nK6 collects metrics for several phases during the HTTP request lifetime.\n\nThe combined delays for the application and network (send, wait, recieve) are available in this metric:\n * **http_req_duration** _( Total time for request, excluding time spent blocked (http_req_blocked), DNS lookup (http_req_looking_up) and TCP connect (http_req_connecting) time. )_\n\nThis metric can also be broken down into these metrics:\n * **http_req_tls_handshaking** _( Time spent handshaking TLS session with remote host. )_\n * **http_req_sending** _( Time spent sending data to remote host. )_\n * **http_req_waiting** _( Time spent waiting for response from remote host (a.k.a. \"time to first byte\", or \"TTFB\"). )_\n * **http_req_receiving** _( Time spent receiving response data from remote host. )_\n\nThese metrics measure delays and durations on the client:\n\n * **http_req_blocked** _( Time spent blocked (waiting for a free TCP connection slot) before initiating request. )_\n * **http_req_looking_up** _( Time spent looking up remote host name in DNS. )_\n * **http_req_connecting** _( Time spent establishing TCP connection to remote host. )_\n\n\n### View official K6.io documentation here: [https://docs.k6.io/docs/result-metrics][1]\n\n\n[1]: https://docs.k6.io/docs/result-metrics\n\n", + "mode": "markdown" + }, + "pluginVersion": "8.4.7", + "transparent": true, + "type": "text" + } + ], + "title": "Documentation", + "type": "row" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 1 + }, + "id": 70, + "panels": [], + "repeat": "Measurement", + "title": "$Measurement", + "type": "row" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "description": "Grouped by 1 sec intervals", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "left", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 56, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "max" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#c73905", + "mode": "fixed" + } + }, + { + "id": "custom.fillBelowTo", + "value": "99%" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "99%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#d11c97", + "mode": "fixed" + } + }, + { + "id": "custom.fillBelowTo", + "value": "95%" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "95%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#bc28d7", + "mode": "fixed" + } + }, + { + "id": "custom.fillBelowTo", + "value": "90%" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "90%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#7335dc", + "mode": "fixed" + } + }, + { + "id": "custom.fillBelowTo", + "value": "85%" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "85%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "80%" + }, + { + "id": "color", + "value": { + "fixedColor": "#4353e2", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "80%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "75%" + }, + { + "id": "color", + "value": { + "fixedColor": "#51a8e7", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "75%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "50%" + }, + { + "id": "color", + "value": { + "fixedColor": "#60ece5", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "50%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "25%" + }, + { + "id": "color", + "value": { + "fixedColor": "#6ff2ad", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "25%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "min" + }, + { + "id": "color", + "value": { + "fixedColor": "#7ff77f", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "min" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#c4fd90", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "iterations per second" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "left" + }, + { + "id": "unit", + "value": "ops" + }, + { + "id": "custom.lineWidth", + "value": 1 + }, + { + "id": "color", + "value": { + "fixedColor": "#000000", + "mode": "fixed" + } + }, + { + "id": "custom.lineInterpolation", + "value": "smooth" + }, + { + "id": "custom.gradientMode", + "value": "none" + }, + { + "id": "custom.fillOpacity", + "value": 100 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "rps" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "hidden" + }, + { + "id": "unit", + "value": "ops" + }, + { + "id": "custom.fillOpacity", + "value": 100 + }, + { + "id": "color", + "value": { + "fixedColor": "#000000", + "mode": "fixed" + } + }, + { + "id": "custom.gradientMode", + "value": "none" + }, + { + "id": "custom.lineInterpolation", + "value": "smooth" + } + ] + } + ] + }, + "gridPos": { + "h": 10, + "w": 24, + "x": 0, + "y": 2 + }, + "id": 5, + "interval": ">1s", + "links": [], + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "right", + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "8.3.2", + "targets": [ + { + "alias": "$col", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "rps", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "count" + }, + { + "params": [ + "* 1000 / $__interval_ms" + ], + "type": "math" + }, + { + "params": [ + "rps" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + }, + { + "alias": "$col", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "duration", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "max" + }, + { + "params": [ + "max" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "99" + ], + "type": "percentile" + }, + { + "params": [ + "99%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "95" + ], + "type": "percentile" + }, + { + "params": [ + "95%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "90" + ], + "type": "percentile" + }, + { + "params": [ + "90%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "85" + ], + "type": "percentile" + }, + { + "params": [ + "85%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "80" + ], + "type": "percentile" + }, + { + "params": [ + "80%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "75" + ], + "type": "percentile" + }, + { + "params": [ + "75%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "50" + ], + "type": "percentile" + }, + { + "params": [ + "50%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "25" + ], + "type": "percentile" + }, + { + "params": [ + "25%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "min" + }, + { + "params": [ + "min" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "title": "$Measurement (over time)", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 0, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 200 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 500 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 0, + "y": 12 + }, + "id": 12, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "sum" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "8.4.7", + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [], + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "count" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "title": "$Measurement (count)", + "type": "stat" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 4, + "y": 12 + }, + "id": 16, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "min" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "8.4.7", + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [], + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "min" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "title": "$Measurement (min)", + "type": "stat" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 8, + "y": 12 + }, + "id": 15, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "8.4.7", + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [], + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "median" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "title": "$Measurement (med)", + "type": "stat" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0.97)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 200 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 500 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 12, + "y": 12 + }, + "id": 14, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "max" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "8.4.7", + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "max" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "title": "$Measurement (max)", + "type": "stat" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 200 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 500 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 16, + "y": 12 + }, + "id": 11, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "background", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "/^mean$/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "8.4.7", + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [], + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "title": "$Measurement (mean)", + "type": "stat" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 20, + "y": 12 + }, + "id": 13, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "8.4.7", + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [], + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + 95 + ], + "type": "percentile" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "title": "$Measurement (p95)", + "type": "stat" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Time" + }, + "properties": [ + { + "id": "displayName", + "value": "Time" + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "p95" + }, + "properties": [ + { + "id": "unit", + "value": "ms" + }, + { + "id": "custom.displayMode", + "value": "color-background" + }, + { + "id": "custom.align" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 200 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 500 + } + ] + } + }, + { + "id": "custom.width", + "value": 80 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "url" + }, + "properties": [ + { + "id": "displayName", + "value": "URL" + }, + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "min" + }, + "properties": [ + { + "id": "unit", + "value": "ms" + }, + { + "id": "custom.displayMode", + "value": "color-background" + }, + { + "id": "custom.align" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 200 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 500 + } + ] + } + }, + { + "id": "custom.width", + "value": 80 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "max" + }, + "properties": [ + { + "id": "unit", + "value": "ms" + }, + { + "id": "custom.displayMode", + "value": "color-background" + }, + { + "id": "custom.align" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 200 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 500 + } + ] + } + }, + { + "id": "custom.width", + "value": 80 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "mean" + }, + "properties": [ + { + "id": "unit", + "value": "ms" + }, + { + "id": "custom.displayMode", + "value": "color-background" + }, + { + "id": "custom.align" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 200 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 500 + } + ] + } + }, + { + "id": "custom.width", + "value": 80 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "median" + }, + "properties": [ + { + "id": "unit", + "value": "ms" + }, + { + "id": "custom.displayMode", + "value": "color-background" + }, + { + "id": "custom.align" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 200 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 500 + } + ] + } + }, + { + "id": "custom.width", + "value": 80 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "name" + }, + "properties": [ + { + "id": "displayName", + "value": "URL" + }, + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "APDEX" + }, + "properties": [ + { + "id": "custom.width", + "value": 80 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "count" + }, + "properties": [ + { + "id": "custom.width", + "value": 80 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "APDEX" + }, + "properties": [ + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "dark-red", + "value": null + }, + { + "color": "dark-orange", + "value": 0.5 + }, + { + "color": "dark-yellow", + "value": 0.7 + }, + { + "color": "semi-dark-green", + "value": 0.85 + }, + { + "color": "dark-green", + "value": 0.94 + } + ] + } + }, + { + "id": "custom.displayMode", + "value": "color-background" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "group" + }, + "properties": [ + { + "id": "custom.width", + "value": 66 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "scenario" + }, + "properties": [ + { + "id": "custom.width", + "value": 112 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "p99" + }, + "properties": [ + { + "id": "custom.width", + "value": 80 + }, + { + "id": "custom.displayMode", + "value": "color-background" + }, + { + "id": "color" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "transparent", + "value": null + }, + { + "color": "orange", + "value": 200 + }, + { + "color": "red", + "value": 500 + } + ] + } + }, + { + "id": "unit", + "value": "ms" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "subscenario" + }, + "properties": [ + { + "id": "custom.width", + "value": 109 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "testEnvironment" + }, + "properties": [ + { + "id": "custom.width", + "value": 128 + } + ] + } + ] + }, + "gridPos": { + "h": 5, + "w": 24, + "x": 0, + "y": 15 + }, + "id": 67, + "links": [], + "options": { + "footer": { + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [ + { + "desc": false, + "displayName": "scenario" + } + ] + }, + "pluginVersion": "8.4.7", + "targets": [ + { + "alias": "min", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "expr": "", + "format": "table", + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "scenario" + ], + "type": "tag" + } + ], + "hide": false, + "intervalFactor": 2, + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "query": "SELECT count(\"value\"), min(\"value\"), median(\"value\"), max(\"value\"), mean(\"value\"), percentile(\"value\", 95) FROM /^$Measurement$/ WHERE (\"name\" =~ /^${URL:raw}$/ AND \"scenario\" =~ /^$scenario$/) AND $timeFilter GROUP BY \"name\", \"scenario\", \"group\" fill(0)", + "rawQuery": false, + "refId": "A", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "count" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "min" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "median" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "max" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + 95 + ], + "type": "percentile" + }, + { + "params": [ + "p95" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "99" + ], + "type": "percentile" + }, + { + "params": [ + "p99" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + }, + { + "alias": "sCount", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "expr": "", + "format": "table", + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "scenario" + ], + "type": "tag" + }, + { + "params": [ + "group" + ], + "type": "tag" + } + ], + "hide": false, + "intervalFactor": 2, + "measurement": "http_req_duration", + "orderByTime": "ASC", + "policy": "default", + "query": "SELECT count(\"value\") as \"sCount\" FROM /^${Measurement:regex}$/ WHERE ( \"name\" =~ /^${URL:raw}$/ AND \"scenario\" =~ /^${scenario:regex}$/ AND \"value\" <= ${T:raw}) AND $timeFilter GROUP BY \"name\", \"scenario\" fill(0)", + "rawQuery": true, + "refId": "sCount", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "count" + }, + { + "params": [ + "sTime" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + }, + { + "condition": "AND", + "key": "value", + "operator": "<", + "value": "${T:raw}" + } + ] + }, + { + "alias": "tCount", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "expr": "", + "format": "table", + "groupBy": [ + { + "params": [ + "name" + ], + "type": "tag" + }, + { + "params": [ + "scenario" + ], + "type": "tag" + }, + { + "params": [ + "group" + ], + "type": "tag" + } + ], + "hide": false, + "intervalFactor": 2, + "measurement": "http_req_duration", + "orderByTime": "ASC", + "policy": "default", + "query": "SELECT count(\"value\")/2.0 as \"tCount\" FROM /^${Measurement:regex}$/ WHERE ( \"name\" =~ /^${URL:raw}$/ AND \"scenario\" =~ /^$scenario$/ AND \"value\" > ${T:raw} AND \"value\" <= 4*${T:raw}) AND $timeFilter GROUP BY \"name\", \"scenario\" fill(0)", + "rawQuery": true, + "refId": "tCount", + "resultFormat": "table", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "count" + }, + { + "params": [ + "sTime" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + }, + { + "condition": "AND", + "key": "value", + "operator": "<", + "value": "${T:raw}" + } + ] + } + ], + "title": "URLs and latencies", + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "groupBy", + "options": { + "fields": { + "count": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "group": { + "aggregations": [], + "operation": "groupby" + }, + "max": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "mean": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "median": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "min": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "name": { + "aggregations": [], + "operation": "groupby" + }, + "p95": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "p99": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "percentile": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "sCount": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "scenario": { + "aggregations": [], + "operation": "groupby" + }, + "subscenario": { + "aggregations": [], + "operation": "groupby" + }, + "tCount": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "testEnvironment": { + "aggregations": [], + "operation": "groupby" + } + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "AAAA", + "binary": { + "left": "sCount (sum)", + "operator": "+", + "reducer": "sum", + "right": "tCount (sum)" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "APDEX", + "binary": { + "left": "AAAA", + "operator": "/", + "reducer": "sum", + "right": "count (sum)" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "AAAA": true, + "sCount (sum)": true, + "tCount (sum)": true + }, + "indexByName": { + "AAAA": 14, + "APDEX": 4, + "count (sum)": 5, + "group": 2, + "max (sum)": 11, + "mean (sum)": 7, + "median (sum)": 8, + "min (sum)": 6, + "name": 3, + "p95 (sum)": 9, + "p99 (sum)": 10, + "sCount (sum)": 12, + "scenario": 1, + "tCount (sum)": 13, + "testEnvironment": 0 + }, + "renameByName": { + "APDEX": "", + "count (sum)": "count", + "max (sum)": "max", + "mean (sum)": "mean", + "median (sum)": "median", + "min (sum)": "min", + "p95 (sum)": "p95", + "p99 (sum)": "p99", + "percentile (sum)": "percentile", + "sCount (sum)": "" + } + } + } + ], + "type": "table" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 20 + }, + "id": 69, + "panels": [], + "title": "K6 Test overview (all URLs)", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 21 + }, + "hiddenSeries": false, + "id": 1, + "interval": "2s", + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 3, + "links": [], + "maxDataPoints": 1000, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.4.7", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "Active VUs", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "vus", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "sum" + }, + { + "params": [ + "* 1000 / $__interval_ms" + ], + "type": "math" + } + ] + ] + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Virtual Users", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:89", + "format": "short", + "logBase": 1, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:90", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "fieldConfig": { + "defaults": { + "unit": "ops" + }, + "overrides": [] + }, + "fill": 5, + "fillGradient": 2, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 28 + }, + "hiddenSeries": false, + "id": 17, + "interval": "2s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "hideEmpty": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 3, + "links": [], + "maxDataPoints": 1000, + "nullPointMode": "null", + "options": { + "alertThreshold": false + }, + "percentage": false, + "pluginVersion": "8.4.7", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$tag_scenario", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "scenario" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "count" + }, + { + "params": [ + "*1000 / $__interval_ms" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Requests per Second", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:167", + "format": "ops", + "logBase": 1, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:168", + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "fill": 1, + "fillGradient": 8, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 35 + }, + "hiddenSeries": false, + "id": 225, + "interval": "2s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "hideEmpty": true, + "hideZero": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "avg", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 3, + "links": [], + "maxDataPoints": 800, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.4.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "$tag_scenario - received", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "scenario" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "data_received", + "orderByTime": "ASC", + "policy": "default", + "refId": "data_recieved", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "sum" + }, + { + "params": [ + "*1000 / $__interval_ms" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + }, + { + "alias": "$tag_scenario - sent", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "scenario" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "data_sent", + "orderByTime": "ASC", + "policy": "default", + "refId": "data_sent", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "sum" + }, + { + "params": [ + "* 1000 / $__interval_ms" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Network (avg)", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:608", + "format": "binBps", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:609", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 30, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 3, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Num Errors" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#BF1B00", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 44 + }, + "id": 7, + "interval": "2s", + "links": [], + "maxDataPoints": 1000, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "table", + "placement": "right" + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "8.3.2", + "targets": [ + { + "alias": "$tag_scenario", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "scenario" + ], + "type": "tag" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http_req_failed", + "orderByTime": "ASC", + "policy": "default", + "refId": "C", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "sum" + }, + { + "params": [ + " * 1000 / $__interval_ms" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "title": "Errors Per Second", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 52 + }, + "id": 89, + "panels": [], + "title": "${Measurement} for scenario", + "type": "row" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "description": "Grouped by 1 sec intervals", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 56, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "max" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#c73905", + "mode": "fixed" + } + }, + { + "id": "custom.fillBelowTo", + "value": "99%" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "99%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#d11c97", + "mode": "fixed" + } + }, + { + "id": "custom.fillBelowTo", + "value": "95%" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "95%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#bc28d7", + "mode": "fixed" + } + }, + { + "id": "custom.fillBelowTo", + "value": "90%" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "90%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#7335dc", + "mode": "fixed" + } + }, + { + "id": "custom.fillBelowTo", + "value": "85%" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "85%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "80%" + }, + { + "id": "color", + "value": { + "fixedColor": "#4353e2", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "80%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "75%" + }, + { + "id": "color", + "value": { + "fixedColor": "#51a8e7", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "75%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "50%" + }, + { + "id": "color", + "value": { + "fixedColor": "#60ece5", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "50%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "25%" + }, + { + "id": "color", + "value": { + "fixedColor": "#6ff2ad", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "25%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "min" + }, + { + "id": "color", + "value": { + "fixedColor": "#7ff77f", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "min" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#c4fd90", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "rps" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "hidden" + }, + { + "id": "custom.lineInterpolation", + "value": "smooth" + }, + { + "id": "unit", + "value": "reqps" + }, + { + "id": "color", + "value": { + "fixedColor": "#000000", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 53 + }, + "id": 91, + "interval": ">1s", + "links": [], + "maxPerRow": 2, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "right", + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "8.3.2", + "repeat": "scenario", + "repeatDirection": "v", + "targets": [ + { + "alias": "rps", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "count" + }, + { + "params": [ + " * 1000 / $__interval_ms" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + }, + { + "alias": "$col", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "http_req_duration", + "orderByTime": "ASC", + "policy": "default", + "query": "SELECT max(\"value\") AS \"max\", percentile(\"value\", 99) AS \"99%\", percentile(\"value\", 95) AS \"95%\", percentile(\"value\", 90) AS \"90%\", percentile(\"value\", 85) AS \"85%\", percentile(\"value\", 80) AS \"80%\", percentile(\"value\", 75) AS \"75%\", percentile(\"value\", 50) AS \"50%\", percentile(\"value\", 25) AS \"25%\", min(\"value\") AS \"min\" FROM /^${Measurement:regex}$/ WHERE (\"name\" =~ /^${URL:raw}$/ AND \"scenario\" =~ /^$scenario$/) AND $timeFilter GROUP BY time($__interval) fill(null)", + "rawQuery": true, + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "max" + }, + { + "params": [ + "max" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "99" + ], + "type": "percentile" + }, + { + "params": [ + "99%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "95" + ], + "type": "percentile" + }, + { + "params": [ + "95%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "90" + ], + "type": "percentile" + }, + { + "params": [ + "90%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "85" + ], + "type": "percentile" + }, + { + "params": [ + "85%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "80" + ], + "type": "percentile" + }, + { + "params": [ + "80%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "75" + ], + "type": "percentile" + }, + { + "params": [ + "75%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "50" + ], + "type": "percentile" + }, + { + "params": [ + "50%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "25" + ], + "type": "percentile" + }, + { + "params": [ + "25%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "min" + }, + { + "params": [ + "min" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "title": "$scenario", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1 + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "max" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#c73905", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "99%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#d11c97", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "95%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#bc28d7", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "90%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#7335dc", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "85%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#4353e2", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "80%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#51a8e7", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "75%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#60ece5", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "50%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#6ff2ad", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "25%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#7ff77f", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "min" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#c4fd90", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 53 + }, + "id": 170, + "interval": ">1s", + "links": [], + "maxPerRow": 4, + "options": { + "bucketOffset": 0, + "legend": { + "calcs": [], + "displayMode": "hidden", + "placement": "bottom" + } + }, + "pluginVersion": "8.3.2", + "repeat": "scenario", + "repeatDirection": "v", + "targets": [ + { + "alias": "$col", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [], + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + } + ] + ], + "tags": [ + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "title": "$scenario", + "transformations": [], + "transparent": true, + "type": "histogram" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 62 + }, + "id": 172, + "panels": [], + "title": "${Measurement} for Name", + "type": "row" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 56, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "max" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#c73905", + "mode": "fixed" + } + }, + { + "id": "custom.fillBelowTo", + "value": "99%" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "99%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#d11c97", + "mode": "fixed" + } + }, + { + "id": "custom.fillBelowTo", + "value": "95%" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "95%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#bc28d7", + "mode": "fixed" + } + }, + { + "id": "custom.fillBelowTo", + "value": "90%" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "90%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#7335dc", + "mode": "fixed" + } + }, + { + "id": "custom.fillBelowTo", + "value": "85%" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "85%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "80%" + }, + { + "id": "color", + "value": { + "fixedColor": "#4353e2", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "80%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "75%" + }, + { + "id": "color", + "value": { + "fixedColor": "#51a8e7", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "75%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "50%" + }, + { + "id": "color", + "value": { + "fixedColor": "#60ece5", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "50%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "25%" + }, + { + "id": "color", + "value": { + "fixedColor": "#6ff2ad", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "25%" + }, + "properties": [ + { + "id": "custom.fillBelowTo", + "value": "min" + }, + { + "id": "color", + "value": { + "fixedColor": "#7ff77f", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "min" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#c4fd90", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "rps" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "hidden" + }, + { + "id": "color", + "value": { + "fixedColor": "#000000", + "mode": "fixed" + } + }, + { + "id": "unit", + "value": "reqps" + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 63 + }, + "id": 204, + "interval": ">1s", + "links": [], + "maxPerRow": 2, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "right", + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "8.3.2", + "repeat": "name", + "repeatDirection": "v", + "targets": [ + { + "alias": "rps", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "count" + }, + { + "params": [ + "* 1000 / $__interval_ms" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/^$name$/" + } + ] + }, + { + "alias": "$col", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "max" + }, + { + "params": [ + "max" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "99" + ], + "type": "percentile" + }, + { + "params": [ + "99%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "95" + ], + "type": "percentile" + }, + { + "params": [ + "95%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "90" + ], + "type": "percentile" + }, + { + "params": [ + "90%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "85" + ], + "type": "percentile" + }, + { + "params": [ + "85%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "80" + ], + "type": "percentile" + }, + { + "params": [ + "80%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "75" + ], + "type": "percentile" + }, + { + "params": [ + "75%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "50" + ], + "type": "percentile" + }, + { + "params": [ + "50%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [ + "25" + ], + "type": "percentile" + }, + { + "params": [ + "25%" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "min" + }, + { + "params": [ + "min" + ], + "type": "alias" + } + ] + ], + "tags": [ + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/^$name$/" + } + ] + } + ], + "title": "$name", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1 + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "max" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#c73905", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "99%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#d11c97", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "95%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#bc28d7", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "90%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#7335dc", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "85%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#4353e2", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "80%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#51a8e7", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "75%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#60ece5", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "50%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#6ff2ad", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "25%" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#7ff77f", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "min" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#c4fd90", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 63 + }, + "id": 174, + "interval": ">1s", + "links": [], + "maxPerRow": 4, + "options": { + "bucketOffset": 0, + "legend": { + "calcs": [], + "displayMode": "hidden", + "placement": "bottom" + } + }, + "pluginVersion": "8.3.2", + "repeat": "name", + "repeatDirection": "v", + "targets": [ + { + "alias": "$col", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [], + "measurement": "/^$Measurement$/", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + } + ] + ], + "tags": [ + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + }, + { + "condition": "AND", + "key": "name", + "operator": "=~", + "value": "/^$name$/" + } + ] + } + ], + "title": "$name", + "transformations": [], + "transparent": true, + "type": "histogram" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 81 + }, + "id": 78, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "description": "Grouped by 1 sec intervals", + "fieldConfig": { + "defaults": { + "unit": "ms" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 10, + "w": 24, + "x": 0, + "y": 82 + }, + "hiddenSeries": false, + "id": 76, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "hideEmpty": true, + "max": true, + "min": false, + "rightSide": true, + "show": true, + "sort": "max", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 3, + "links": [], + "maxDataPoints": 400, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.4.7", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "duration", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http_req_duration", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + }, + { + "alias": "waiting", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http_req_waiting", + "orderByTime": "ASC", + "policy": "default", + "refId": "a1", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + }, + { + "alias": "blocked", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http_req_blocked", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + }, + { + "alias": "connecting", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http_req_connecting", + "orderByTime": "ASC", + "policy": "default", + "refId": "C", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + }, + { + "alias": "receiving", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http_req_receiving", + "orderByTime": "ASC", + "policy": "default", + "refId": "D", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + }, + { + "alias": "sending", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http_req_sending", + "orderByTime": "ASC", + "policy": "default", + "refId": "E", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + }, + { + "alias": "tls handshaking", + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "dsType": "influxdb", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "measurement": "http_req_tls_handshaking", + "orderByTime": "ASC", + "policy": "default", + "refId": "G", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "name", + "operator": "=~", + "value": "/^${URL:raw}$/" + }, + { + "condition": "AND", + "key": "scenario", + "operator": "=~", + "value": "/^$scenario$/" + } + ] + } + ], + "thresholds": [], + "timeRegions": [], + "title": "HTTP only - avg (over time)", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "transformations": [], + "transparent": true, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:303", + "format": "ms", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:304", + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + } + ], + "title": "Custom HTTP Metrics", + "type": "row" + } + ], + "refresh": false, + "schemaVersion": 35, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "k6", + "value": "k6" + }, + "hide": 0, + "includeAll": false, + "multi": false, + "name": "source", + "options": [], + "query": "influxdb", + "queryValue": "", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, + { + "current": {}, + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "definition": "SHOW MEASUREMENTS", + "hide": 0, + "includeAll": false, + "multi": false, + "name": "Measurement", + "options": [], + "query": "SHOW MEASUREMENTS", + "refresh": 1, + "regex": "/(Duration Trend|http_req_duration|grpc_req_duration|latency|ws_connecting|ws_session_duration)/", + "skipUrlSync": false, + "sort": 1, + "type": "query" + }, + { + "allValue": ".*", + "current": {}, + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "definition": "SELECT \"scenario\"\nFROM\n(SELECT last(\"value\")\n FROM \"${Measurement}\"\n GROUP BY \"scenario\")\nWHERE $timeFilter", + "hide": 0, + "includeAll": true, + "multi": true, + "name": "scenario", + "options": [], + "query": "SELECT \"scenario\"\nFROM\n(SELECT last(\"value\")\n FROM \"${Measurement}\"\n GROUP BY \"scenario\")\nWHERE $timeFilter", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query" + }, + { + "current": { + "selected": true, + "text": ".+", + "value": ".+" + }, + "hide": 0, + "label": "URL", + "name": "URL", + "options": [ + { + "selected": true, + "text": ".+", + "value": ".+" + } + ], + "query": ".+", + "skipUrlSync": false, + "type": "textbox" + }, + { + "allValue": "", + "current": {}, + "datasource": { + "type": "influxdb", + "uid": "${DS_K6}" + }, + "definition": "SELECT \"name\"\nFROM\n(SELECT last(\"value\")\n FROM \"${Measurement}\"\n WHERE \"name\" =~ /^${URL:raw}$/ AND \"scenario\" =~ /^${scenario:regex}$/\n GROUP BY \"name\")\nWHERE $timeFilter", + "hide": 0, + "includeAll": true, + "multi": true, + "name": "name", + "options": [], + "query": "SELECT \"name\"\nFROM\n(SELECT last(\"value\")\n FROM \"${Measurement}\"\n WHERE \"name\" =~ /^${URL:raw}$/ AND \"scenario\" =~ /^${scenario:regex}$/\n GROUP BY \"name\")\nWHERE $timeFilter", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "50", + "value": "50" + }, + "description": "Time for APDEX", + "hide": 0, + "name": "T", + "options": [ + { + "selected": true, + "text": "50", + "value": "50" + } + ], + "query": "50", + "skipUrlSync": false, + "type": "textbox" + } + ] + }, + "time": { + "from": "2024-08-28T15:16:48.689Z", + "to": "2024-08-28T15:30:00.761Z" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "5m", + "30m" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "browser", + "title": "k6 Load Testing Results Simple filters", + "uid": "EoTrVz6Iz", + "version": 5, + "weekStart": "" +} \ No newline at end of file diff --git a/rust-containers-k8s/kubernetes/k6/run.fish b/rust-containers-k8s/kubernetes/k6/run.fish new file mode 100755 index 0000000..906d463 --- /dev/null +++ b/rust-containers-k8s/kubernetes/k6/run.fish @@ -0,0 +1,7 @@ +#!/usr/bin/env fish + +set --local SCRIPT_DIR (dirname (realpath (status -f))) + +cd $SCRIPT_DIR + +k6 run script.js --out influxdb='http://localhost:8181/k6' diff --git a/rust-containers-k8s/kubernetes/k6/script.js b/rust-containers-k8s/kubernetes/k6/script.js new file mode 100644 index 0000000..24f5949 --- /dev/null +++ b/rust-containers-k8s/kubernetes/k6/script.js @@ -0,0 +1,47 @@ +import http from "k6/http"; +import { sleep, check } from "k6"; + +export const options = { + vus: 100, + thresholds: { + // http errors should be less than 1%, otherwise abort the test + http_req_failed: [{ threshold: "rate<0.01", abortOnFail: true }], + // 99% of requests should be below 200ms + http_req_duration: ["p(99)<200"], + }, + scenarios: { + average_load: { + executor: "ramping-vus", + stages: [ + { duration: "5s", target: 50 }, + { duration: "10s", target: 100 }, + { duration: "10s", target: 200 }, + { duration: "10s", target: 300 }, + { duration: "10s", target: 400 }, + { duration: "10s", target: 500 }, + { duration: "10s", target: 0 }, + ], + }, + }, +}; + +export default function () { + const url = "http://localhost:8081/api/order"; + const payload = JSON.stringify({ + items: [{ sku: "iphone_13", price: 1, quantity: 1 }], + }); + const params = { + headers: { + "Content-Type": "application/json", + }, + }; + check(http.post(url, payload, params), { + "status is 201": (res) => res.status === 201, + }); + + check(http.get(url), { + "status is 200": (res) => res.status === 200, + }); + + sleep(1); +} diff --git a/rust-containers-k8s/kubernetes/local_k3d/README.md b/rust-containers-k8s/kubernetes/local_k3d/README.md index f99c8ee..e503d43 100644 --- a/rust-containers-k8s/kubernetes/local_k3d/README.md +++ b/rust-containers-k8s/kubernetes/local_k3d/README.md @@ -3,7 +3,7 @@ 1. Create the cluster with a registry ```fish - ./create.fish + ../../../local_k3d/create.fish ``` 1. Add the registry to your local /etc/hosts @@ -47,7 +47,7 @@ 1. Delete the cluster ```fish - ./destroy.fish + ../../../local_k3d/destroy.fish ``` ## Test diff --git a/rust-containers-k8s/kubernetes/local_k3d/create.fish b/rust-containers-k8s/kubernetes/local_k3d/create.fish deleted file mode 100755 index bd12c9b..0000000 --- a/rust-containers-k8s/kubernetes/local_k3d/create.fish +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env fish - -function section - echo - string pad --right --char=— -w$COLUMNS "———— $argv ————" -end - -section "starting registry" -k3d registry create platform-poc.localhost --port 5001 - -section "starting platform-poc cluster" -k3d cluster create platform-poc \ - --agents 2 \ - --registry-use k3d-platform-poc.localhost:5001 \ - --api-port 6550 \ - -p "8081:80@loadbalancer" - -section configuration -kubectl cluster-info diff --git a/rust-containers-k8s/order-service/.sqlx/query-6bf59dda6e5db7bc3235366cb1a42a3e76b37bc85086fb71c1944d9d8bb5a38c.json b/rust-containers-k8s/order-service/.sqlx/query-6bf59dda6e5db7bc3235366cb1a42a3e76b37bc85086fb71c1944d9d8bb5a38c.json new file mode 100644 index 0000000..0c551a8 --- /dev/null +++ b/rust-containers-k8s/order-service/.sqlx/query-6bf59dda6e5db7bc3235366cb1a42a3e76b37bc85086fb71c1944d9d8bb5a38c.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO t_orders_order_line_items_list (order_id, order_line_items_list_id)\n VALUES ( $1, $2 )\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + }, + "nullable": [] + }, + "hash": "6bf59dda6e5db7bc3235366cb1a42a3e76b37bc85086fb71c1944d9d8bb5a38c" +} diff --git a/rust-containers-k8s/order-service/.sqlx/query-bc8c39e428aaaa676dac2880288bfe7a855116c8f87b0a0f00c480e4a068813f.json b/rust-containers-k8s/order-service/.sqlx/query-bc8c39e428aaaa676dac2880288bfe7a855116c8f87b0a0f00c480e4a068813f.json new file mode 100644 index 0000000..9a1f6c7 --- /dev/null +++ b/rust-containers-k8s/order-service/.sqlx/query-bc8c39e428aaaa676dac2880288bfe7a855116c8f87b0a0f00c480e4a068813f.json @@ -0,0 +1,24 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO t_order_line_items (price, quantity, sku_code)\n VALUES ( $1, $2, $3 )\n RETURNING id\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Numeric", + "Int4", + "Varchar" + ] + }, + "nullable": [ + false + ] + }, + "hash": "bc8c39e428aaaa676dac2880288bfe7a855116c8f87b0a0f00c480e4a068813f" +} diff --git a/rust-containers-k8s/order-service/.sqlx/query-c94e07fc4cce2cb16f1118d2221709a8d6aaf99a44efe29c6f39b0204c3e33a7.json b/rust-containers-k8s/order-service/.sqlx/query-c94e07fc4cce2cb16f1118d2221709a8d6aaf99a44efe29c6f39b0204c3e33a7.json new file mode 100644 index 0000000..0765f27 --- /dev/null +++ b/rust-containers-k8s/order-service/.sqlx/query-c94e07fc4cce2cb16f1118d2221709a8d6aaf99a44efe29c6f39b0204c3e33a7.json @@ -0,0 +1,50 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT\n \"order\".id as order_id,\n \"order\".order_number,\n \"line_items\".id as item_id,\n \"line_items\".sku_code,\n \"line_items\".price,\n \"line_items\".quantity\nFROM\n t_order_line_items as line_items\n JOIN t_orders_order_line_items_list as order_lines ON \"order_lines\".order_line_items_list_id = \"line_items\".id\n JOIN t_orders as \"order\" ON \"order\".id = \"order_lines\".order_id\nLIMIT\n 100;\n", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "order_id", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "order_number", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "item_id", + "type_info": "Int8" + }, + { + "ordinal": 3, + "name": "sku_code", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "price", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "quantity", + "type_info": "Int4" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + true, + false, + true, + true, + true + ] + }, + "hash": "c94e07fc4cce2cb16f1118d2221709a8d6aaf99a44efe29c6f39b0204c3e33a7" +} diff --git a/rust-containers-k8s/order-service/.sqlx/query-e397a801966d47a99b0b3b109458f1f538bea67b3adb2e82304f7d4278b5225f.json b/rust-containers-k8s/order-service/.sqlx/query-e397a801966d47a99b0b3b109458f1f538bea67b3adb2e82304f7d4278b5225f.json new file mode 100644 index 0000000..8cbd40a --- /dev/null +++ b/rust-containers-k8s/order-service/.sqlx/query-e397a801966d47a99b0b3b109458f1f538bea67b3adb2e82304f7d4278b5225f.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO t_orders (order_number)\n VALUES ( $1)\n RETURNING id\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Varchar" + ] + }, + "nullable": [ + false + ] + }, + "hash": "e397a801966d47a99b0b3b109458f1f538bea67b3adb2e82304f7d4278b5225f" +} diff --git a/rust-containers-k8s/order-service/sql/all_orders.sql b/rust-containers-k8s/order-service/sql/all_orders.sql index 7ffe516..16824b4 100644 --- a/rust-containers-k8s/order-service/sql/all_orders.sql +++ b/rust-containers-k8s/order-service/sql/all_orders.sql @@ -1,9 +1,13 @@ -SELECT "order".id as order_id, - "order".order_number, - "line_items".id as item_id, - "line_items".sku_code, - "line_items".price, - "line_items".quantity -FROM t_order_line_items as line_items - JOIN t_orders_order_line_items_list as order_lines ON "order_lines".order_line_items_list_id = "line_items".id - JOIN t_orders as "order" ON "order".id = "order_lines".order_id +SELECT + "order".id as order_id, + "order".order_number, + "line_items".id as item_id, + "line_items".sku_code, + "line_items".price, + "line_items".quantity +FROM + t_order_line_items as line_items + JOIN t_orders_order_line_items_list as order_lines ON "order_lines".order_line_items_list_id = "line_items".id + JOIN t_orders as "order" ON "order".id = "order_lines".order_id +LIMIT + 10; diff --git a/wasm-components/http-controller/src/lib.rs b/wasm-components/http-controller/src/lib.rs index 869d388..39d3f41 100644 --- a/wasm-components/http-controller/src/lib.rs +++ b/wasm-components/http-controller/src/lib.rs @@ -34,16 +34,16 @@ fn handler(request: Request) -> Result { let mut router = Router::new(); router - .add("/data-init/:action", Handlers::DataInit) + .add("/api/data-init/:action", Handlers::DataInit) .expect("adding route"); router - .add("/inventory", Handlers::Inventory) + .add("/api/inventory", Handlers::Inventory) .expect("adding route"); router - .add("/orders", Handlers::Orders) + .add("/api/order", Handlers::Orders) .expect("adding route"); router - .add("/products", Handlers::Products) + .add("/api/product", Handlers::Products) .expect("adding route"); let Some(m) = router.best_match(request.path()) else {