You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`QuickPizza` is a web application, used for demonstrations and workshops, that generates new and exciting pizza combinations!
7
+
**QuickPizza** is a simple web application, used for demonstrations and workshops, that generates new and exciting pizza combinations!
8
8
9
-
The app is built using [SvelteKit](https://kit.svelte.dev/) for the frontend and [Go](https://go.dev/) for the backend.
10
9
11
-
The tests written for `QuickPizza` demonstrates the basic and advanced functionalities of k6, ranging from a basic load test to using different modules and extensions. QuickPizza is used in the the [k6-oss-workshop](https://github.com/grafana/k6-oss-workshop).
10
+
You can run QuickPizza locally or deploy it to your own infrastructure. For demo purposes, QuickPizza is also publicly available at:
11
+
1.[quickpizza.grafana.com](https://quickpizza.grafana.com/)— Use this environment to run small-scale performance tests like the ones in the [k6 folder](./k6/).
12
+
2.[quickpizza-demo.grafana.fun](https://quickpizza.grafana.com/) — Install the [SRE Demo environment](https://grafana.com/docs/grafana-cloud/get-started/#install-demo-data-sources-and-dashboards) to observe this deployment, or explore it in [Grafana Play](https://play.grafana.org/d/d2e206e1-f72b-448c-83d8-657831c2ea6d/).
12
13
13
-
## Requirements
14
-
15
-
-[Docker](https://docs.docker.com/get-docker/)
16
-
-[Grafana k6](https://grafana.com/docs/k6/latest/set-up/install-k6/) (v0.53.0 or higher)
14
+
The QuickPizza tests showcase key k6 features, from basic usage to custom modules and extensions.
17
15
18
-
## Run locally with Docker
19
-
20
-
To run the app locally with Docker, run the command:
21
-
22
-
```bash
23
-
docker run --rm -it -p 3333:3333 ghcr.io/grafana/quickpizza-local:latest
24
-
```
25
-
26
-
or build image from the repo:
27
-
28
-
```bash
29
-
docker run --rm -it -p 3333:3333 $(docker build -q .)
30
-
```
16
+
## Requirements
31
17
32
-
That's it!
18
+
-[Grafana k6](https://grafana.com/docs/k6/latest/set-up/install-k6/) (v1.0.0 or higher) to run the k6 tests used in this project to test QuickPizza.
19
+
-[Docker](https://docs.docker.com/get-docker/) to run QuickPizza [locally](#run-locally-with-docker).
20
+
-[Docker Compose](https://docs.docker.com/get-docker/) to run and instrument QuickPizza, storing metrics, logs, traces, and profiling data using the Grafana Observability stack. You can either [store this data locally](#run-and-observe-locally-with-docker-compose-) or send it to [Grafana Cloud](#run-locally-and-observe-with-grafana-cloud-️).
33
21
34
-
Now you can go to [localhost:3333](http://localhost:3333) and get some pizza recommendations!
35
22
36
23
## Use k6 to test QuickPizza
37
24
@@ -40,7 +27,6 @@ All tests live in the `k6` folder. Within this folder, you will find the followi
40
27
-[foundations](k6/foundations/) - covers the basic functionalities of k6.
41
28
-[browser](k6/browser/) - covers the [k6 browser module](https://grafana.com/docs/k6/latest/using-k6-browser/) for browser and web performance testing.
42
29
-[extensions](k6/extensions/) - covers basic tests using [k6 extensions](https://grafana.com/docs/k6/latest/extensions/).
43
-
-[disruptor](k6/disruptor/) - covers a more deep-dive look on how to use [xk6-disruptor](https://grafana.com/docs/k6/latest/testing-guides/injecting-faults-with-xk6-disruptor/first-steps/) for failure injection testing.
44
30
45
31
To run tests on the `foundations` folder, you can use the following commands:
46
32
@@ -49,16 +35,10 @@ cd k6/foundations
49
35
k6 run 01.basic.js
50
36
```
51
37
52
-
If you want to run one iteration with one virtual user, you can use the following command:
53
-
54
-
```bash
55
-
k6 run --iterations 1 --vus 1 01.basic.js
56
-
```
57
-
58
-
If QuickPizza is [deployed remotely](#deploy-quickpizza-docker-image), then pass the hostname and port through the `BASE_URL` environment variable as follows:
38
+
If QuickPizza is publicly available , then pass the hostname and port through the `BASE_URL` environment variable as follows:
59
39
60
40
```bash
61
-
k6 run -e BASE_URL=https://acmecorp.dev:3333 01.basic.js
41
+
k6 run -e BASE_URL=https://quickpizza.grafana.com 01.basic.js
62
42
```
63
43
64
44
<details>
@@ -99,21 +79,31 @@ k6 run -e BASE_URL=https://acmecorp.dev:3333 01.basic.js
99
79
```
100
80
</details>
101
81
102
-
### Collect Telemetry (Docker Compose)
103
82
104
-
Testing something you can't observe is only half the fun. QuickPizza is instrumented using best practices to record logs, emit metrics, traces and allow profiling. You can either collect and [store this data locally](#local-setup) or send it to [Grafana Cloud](#grafana-cloud).
83
+
## Run locally with Docker
105
84
106
-
### Enabling Debug Logging
85
+
To run the app locally with Docker, run the command:
107
86
108
-
If you encounter any issues during operation, you can enable debug logging by setting the following environment variable:
87
+
```bash
88
+
docker run --rm -it -p 3333:3333 ghcr.io/grafana/quickpizza-local:latest
89
+
```
90
+
91
+
or build image from the repo:
109
92
110
-
```shell
111
-
export QUICKPIZZA_LOG_LEVEL=debug
93
+
```bash
94
+
docker run --rm -it -p 3333:3333 $(docker build -q .)
112
95
```
113
96
114
-
---
97
+
That's it!
98
+
99
+
Now you can go to [localhost:3333](http://localhost:3333) and get some pizza recommendations!
100
+
101
+
102
+
103
+
> Testing something you can't observe is only half the fun! 🔍✨ QuickPizza is instrumented using best practices to record logs, emit metrics, traces and allow profiling. Get ready to dive deep into observability! 🚀
104
+
105
+
## Run and observe locally with Grafana OSS 🐳📊
115
106
116
-
## Local Setup
117
107
118
108
The [docker-compose-local.yaml](./docker-compose-local.yaml) file is set up to run and orchestrate the QuickPizza, Grafana, Tempo, Loki, Prometheus, Pyroscope, and Grafana Alloy containers.
119
109
@@ -127,25 +117,11 @@ docker compose -f docker-compose-local.yaml up -d
127
117
128
118
Like before, QuickPizza is available at [localhost:3333](http://localhost:3333). It's time to discover some fancy pizzas!
129
119
130
-
Then, you can visit the Grafana instance running at [localhost:3000](http://localhost:3000) to access QuickPizza data.
131
-
132
-
Please refer to [alloy-local.river](./contrib/alloy-local.river) and [docker-compose-local.yaml](./docker-compose-local.yaml) to find the labels applied to the telemetry data.
133
-
134
-
### Correlate Pyroscope Data with k6 Tests
135
-
136
-
Whenever there is a Pyroscope instance endpoint provided via the `QUICKPIZZA_PYROSCOPE_ENDPOINT` environment variable, the QuickPizza app will emit and push profiling data to Pyroscope. You can visualize the profiling data with the Pyroscope data source in Grafana and the [Explore Profiles](https://grafana.com/docs/grafana/latest/explore/simplified-exploration/profiles/) Grafana [Plugin](https://grafana.com/grafana/plugins/grafana-pyroscope-app/).
137
-
138
-
> [!TIP]
139
-
> To send Data to Pyroscope directly for a Local Setup, use the value `http://pyroscope:4040` for the `QUICKPIZZA_PYROSCOPE_ENDPOINT` environment variable
140
-
141
-
To correlate the profiling data with the k6 test results, use the [k6 Pyroscope library](https://grafana.com/docs/k6/next/javascript-api/jslib/http-instrumentation-pyroscope/).
120
+
Then, you can visit the Grafana instance running at [localhost:3000](http://localhost:3000) and use **Explore** or **Drilldown apps** to access QuickPizza data.
142
121
143
-

Additional variables are available to configure the Tags/Labels for the Profiles:
146
-
147
-
-`QUICKPIZZA_PYROSCOPE_NAME` - the value of the `service_name` Label in Pyroscope (uses `quickpizza` by default).
148
-
-`QUICKPIZZA_PYROSCOPE_NAMESPACE` - the value of the `namespace` Label in Pyroscope (uses `quickpizza` by default).
124
+
To find the labels applied to the telemetry data, refer to [alloy-local.river](./contrib/alloy-local.river) and [docker-compose-local.yaml](./docker-compose-local.yaml).
149
125
150
126
### Send k6 Test Results to Prometheus and visualize them in Grafana with prebuilt dashboards
151
127
@@ -161,7 +137,7 @@ The local Grafana instance includes the [k6 Prometheus](https://grafana.com/graf
161
137
162
138
For detailed instructions about the different options of the k6 Prometheus output, refer to the [k6 output guide for Prometheus remote write](https://grafana.com/docs/k6/latest/results-output/real-time/prometheus-remote-write/).
163
139
164
-
## Grafana Cloud
140
+
## Run locally and observe with Grafana Cloud 🐳️☁📊
165
141
166
142
The [docker-compose-cloud.yaml](./docker-compose-cloud.yaml) file is set up to run the QuickPizza and Grafana Alloy containers.
167
143
@@ -238,66 +214,3 @@ k6 run -o experimental-prometheus-rw script.js
238
214
239
215
For detailed instructions, refer to the [k6 output guide for Grafana Cloud Prometheus](https://grafana.com/docs/k6/latest/results-output/real-time/grafana-cloud-prometheus/).
240
216
241
-
---
242
-
243
-
## Deploy QuickPizza Docker image
244
-
245
-
The [Dockerfile](./Dockerfile) contains the setup for running QuickPizza without collecting data with Grafana Alloy.
246
-
247
-
You can use the Dockerfile or build a Docker image to deploy the QuickPizza app on any cloud provider that supports Docker deployments. For simplicity, here are the `Fly.io` instructions:
248
-
249
-
1.[Authenticate using the fly CLI](https://fly.io/docs/speedrun/).
250
-
2. Then, run the CLI to deploy the application and set up the internal port `3333` that the server listens to.
251
-
252
-
```bash
253
-
fly launch --internal-port 3333 --now
254
-
```
255
-
256
-
For deployments on remote servers, you need to pass the `BASE_URL` environment variable when running the k6 tests as follows:
257
-
258
-
```bash
259
-
k6 run -e BASE_URL=https://acmecorp.dev:3333 01.basic.js
260
-
```
261
-
262
-
## Use an external database
263
-
264
-
By default, QuickPizza stores all its data in an in-memory SQLite database. This allows for a quick start while still closely resembling a real world application. If you want to add an external database, you can set the `QUICKPIZZA_DB` environment variable to a supported connection string. Currently only PostgreSQL and SQLite is supported.
If you want to run a test that uses [xk6-disruptor](https://grafana.com/docs/k6/latest/testing-guides/injecting-faults-with-xk6-disruptor/first-steps/), or want to experiment with distributed tracing, you will need to deploy QuickPizza to Kubernetes.
278
-
279
-
For a detailed setup instructions, see the [QuickPizza Kubernetes guide](./docs/kubernetes-setup.md).
280
-
281
-
## Injecting Errors from Client via Headers
282
-
283
-
You can introduce errors from the client side using custom headers. Below is a list of the currently supported error headers:
284
-
285
-
- **x-error-record-recommendation**: Triggers an error when recording a recommendation. The header value should be the error message.
286
-
- **x-error-record-recommendation-percentage**: Specifies the percentage chance of an error occurring when recording a recommendation, if x-error-record-recommendation is also included. The header value should be a number between 0 and 100.
287
-
- **x-delay-record-recommendation**: Introduces a delay when recording a recommendation. The header value should specify the delay duration and unit. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w", "y".
288
-
- **x-delay-record-recommendation-percentage**: Specifies the percentage chance of a delay occurring when recording a recommendation, if x-delay-record-recommendation is also included. The header value should be a number between 0 and 100.
289
-
- **x-error-get-ingredients**: Triggers an error when retrieving ingredients. The header value should be the error message.
290
-
- **x-error-get-ingredients-percentage**: Specifies the percentage chance of an error occurring when retrieving ingredients, if x-error-get-ingredients is also included. The header value should be a number between 0 and 100.
291
-
- **x-delay-get-ingredients**: Introduces a delay when retrieving ingredients. The header value should specify the delay duration and unit. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w", "y".
292
-
- **x-delay-get-ingredients-percentage**: Specifies the percentage chance of a delay occurring when retrieving ingredients, if x-delay-get-ingredients is also included. The header value should be a number between 0 and 100.
The [Dockerfile](./Dockerfile) contains the setup for running QuickPizza without collecting data with Grafana Alloy.
4
+
5
+
You can use the Dockerfile or build a Docker image to deploy the QuickPizza app on any cloud provider that supports Docker deployments. For simplicity, here are the `Fly.io` instructions:
6
+
7
+
1.[Authenticate using the fly CLI](https://fly.io/docs/speedrun/).
8
+
2. Then, run the CLI to deploy the application and set up the internal port `3333` that the server listens to.
9
+
10
+
```bash
11
+
fly launch --internal-port 3333 --now
12
+
```
13
+
14
+
For deployments on remote servers, you need to pass the `BASE_URL` environment variable when running the k6 tests as follows:
15
+
16
+
```bash
17
+
k6 run -e BASE_URL=https://acmecorp.dev:3333 01.basic.js
You can introduce errors from the client side using custom headers. Below is a list of the currently supported error headers:
4
+
5
+
-**x-error-record-recommendation**: Triggers an error when recording a recommendation. The header value should be the error message.
6
+
-**x-error-record-recommendation-percentage**: Specifies the percentage chance of an error occurring when recording a recommendation, if x-error-record-recommendation is also included. The header value should be a number between 0 and 100.
7
+
-**x-delay-record-recommendation**: Introduces a delay when recording a recommendation. The header value should specify the delay duration and unit. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w", "y".
8
+
-**x-delay-record-recommendation-percentage**: Specifies the percentage chance of a delay occurring when recording a recommendation, if x-delay-record-recommendation is also included. The header value should be a number between 0 and 100.
9
+
-**x-error-get-ingredients**: Triggers an error when retrieving ingredients. The header value should be the error message.
10
+
-**x-error-get-ingredients-percentage**: Specifies the percentage chance of an error occurring when retrieving ingredients, if x-error-get-ingredients is also included. The header value should be a number between 0 and 100.
11
+
-**x-delay-get-ingredients**: Introduces a delay when retrieving ingredients. The header value should specify the delay duration and unit. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w", "y".
12
+
-**x-delay-get-ingredients-percentage**: Specifies the percentage chance of a delay occurring when retrieving ingredients, if x-delay-get-ingredients is also included. The header value should be a number between 0 and 100.
By default, QuickPizza stores all its data in an in-memory SQLite database. This allows for a quick start while still closely resembling a real world application. If you want to add an external database, you can set the `QUICKPIZZA_DB` environment variable to a supported connection string. Currently only PostgreSQL and SQLite is supported.
0 commit comments