Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit b0581fe

Browse files
authored
Merge pull request #35 from jwcastillo/set_k6_repo_structure
chore: set folder structure like k6 repo
2 parents 48bf738 + a334561 commit b0581fe

File tree

9 files changed

+74
-38
lines changed

9 files changed

+74
-38
lines changed

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ services:
2828
- GF_AUTH_ANONYMOUS_ENABLED=true
2929
- GF_AUTH_BASIC_ENABLED=false
3030
volumes:
31-
- ./example/config-datasources.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
32-
- ./example/config-dashboards.yaml:/etc/grafana/provisioning/dashboards/dashboards.yaml
33-
- ./example/dashboards:/var/lib/grafana/dashboards
31+
- ./grafana:/etc/grafana/provisioning/
3432

3533
k6:
3634
build: .
@@ -43,3 +41,5 @@ services:
4341
- K6_OUT=output-prometheus-remote
4442
depends_on:
4543
- prometheus
44+
volumes:
45+
- ./samples:/scripts
File renamed without changes.

example/dashboards/dashboard-results.json renamed to grafana/dashboards/dashboard-results.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"editable": true,
2525
"fiscalYearStartMonth": 0,
2626
"graphTooltip": 0,
27-
"iteration": 1657475182972,
27+
"iteration": 1660431009407,
2828
"links": [],
2929
"liveNow": false,
3030
"panels": [
@@ -1562,9 +1562,9 @@
15621562
{
15631563
"allValue": "",
15641564
"current": {
1565-
"selected": true,
1566-
"text": "test-1657474791",
1567-
"value": "test-1657474791"
1565+
"selected": false,
1566+
"text": "All",
1567+
"value": "$__all"
15681568
},
15691569
"datasource": {
15701570
"type": "prometheus",
@@ -1581,7 +1581,7 @@
15811581
"query": "label_values(testid)",
15821582
"refId": "StandardVariableQuery"
15831583
},
1584-
"refresh": 1,
1584+
"refresh": 2,
15851585
"regex": "",
15861586
"skipUrlSync": false,
15871587
"sort": 1,
@@ -1624,6 +1624,6 @@
16241624
"timezone": "",
16251625
"title": "Test Result",
16261626
"uid": "a21-pyAWz",
1627-
"version": 3,
1627+
"version": 1,
16281628
"weekStart": ""
1629-
}
1629+
}

example/dashboards/dashboard-tests.json renamed to grafana/dashboards/dashboard-tests.json

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"editable": true,
2525
"fiscalYearStartMonth": 0,
2626
"graphTooltip": 0,
27+
"iteration": 1660431147457,
2728
"links": [],
2829
"liveNow": false,
2930
"panels": [
@@ -143,8 +144,8 @@
143144
"type": "prometheus",
144145
"uid": "PEDF09670F151C95C"
145146
},
146-
"editorMode": "builder",
147-
"expr": "k6_http_reqs",
147+
"editorMode": "code",
148+
"expr": "k6_http_reqs{testid=~\"$testid\"}",
148149
"format": "table",
149150
"legendFormat": "__auto",
150151
"range": true,
@@ -251,7 +252,31 @@
251252
"style": "dark",
252253
"tags": [],
253254
"templating": {
254-
"list": []
255+
"list": [
256+
{
257+
"current": {
258+
"selected": true,
259+
"text": "All",
260+
"value": "$__all"
261+
},
262+
"definition": "label_values(testid)",
263+
"hide": 0,
264+
"includeAll": true,
265+
"label": "Test ID",
266+
"multi": false,
267+
"name": "testid",
268+
"options": [],
269+
"query": {
270+
"query": "label_values(testid)",
271+
"refId": "StandardVariableQuery"
272+
},
273+
"refresh": 2,
274+
"regex": "",
275+
"skipUrlSync": false,
276+
"sort": 1,
277+
"type": "query"
278+
}
279+
]
255280
},
256281
"time": {
257282
"from": "now-1h",
@@ -261,6 +286,6 @@
261286
"timezone": "",
262287
"title": "Test Runs List",
263288
"uid": "UoYDJHJZk",
264-
"version": 2,
289+
"version": 1,
265290
"weekStart": ""
266-
}
291+
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
# For configuration options, see
1+
# For configuration options, see
22
# https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards
33

44
apiVersion: 1
55

66
providers:
77
# We're defining a directory from which to load file-based dashboards
8-
- name: 'a unique provider name'
8+
- name: 'prometheus-in-docker'
99
type: file
1010
disableDeletion: false
1111
updateIntervalSeconds: 10
12-
allowUiUpdates: false
12+
editable: true
1313
options:
14-
path: /var/lib/grafana/dashboards
15-
foldersFromFilesStructure: true
14+
path: /etc/grafana/provisioning/dashboards

example/dashboards/default.json renamed to grafana/dashboards/default.json

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"editable": true,
2525
"fiscalYearStartMonth": 0,
2626
"graphTooltip": 1,
27-
"iteration": 1657476390215,
27+
"iteration": 1660431508579,
2828
"links": [],
2929
"liveNow": true,
3030
"panels": [
@@ -796,8 +796,7 @@
796796
"mode": "absolute",
797797
"steps": [
798798
{
799-
"color": "green",
800-
"value": null
799+
"color": "green"
801800
},
802801
{
803802
"color": "red",
@@ -886,8 +885,7 @@
886885
"mode": "absolute",
887886
"steps": [
888887
{
889-
"color": "green",
890-
"value": null
888+
"color": "green"
891889
}
892890
]
893891
},
@@ -942,8 +940,7 @@
942940
"mode": "absolute",
943941
"steps": [
944942
{
945-
"color": "green",
946-
"value": null
943+
"color": "green"
947944
}
948945
]
949946
},
@@ -1027,8 +1024,7 @@
10271024
"mode": "absolute",
10281025
"steps": [
10291026
{
1030-
"color": "green",
1031-
"value": null
1027+
"color": "green"
10321028
}
10331029
]
10341030
},
@@ -1231,8 +1227,7 @@
12311227
"mode": "absolute",
12321228
"steps": [
12331229
{
1234-
"color": "green",
1235-
"value": null
1230+
"color": "green"
12361231
}
12371232
]
12381233
}
@@ -1388,7 +1383,7 @@
13881383
{
13891384
"allValue": "http.*",
13901385
"current": {
1391-
"selected": true,
1386+
"selected": false,
13921387
"text": "All",
13931388
"value": "$__all"
13941389
},
@@ -1406,15 +1401,15 @@
14061401
"query": "label_values(url)",
14071402
"refId": "StandardVariableQuery"
14081403
},
1409-
"refresh": 1,
1404+
"refresh": 2,
14101405
"regex": "",
14111406
"skipUrlSync": false,
14121407
"sort": 0,
14131408
"type": "query"
14141409
},
14151410
{
14161411
"current": {
1417-
"selected": true,
1412+
"selected": false,
14181413
"text": "All",
14191414
"value": "$__all"
14201415
},
@@ -1432,7 +1427,7 @@
14321427
"query": "label_values(scenario)",
14331428
"refId": "StandardVariableQuery"
14341429
},
1435-
"refresh": 1,
1430+
"refresh": 2,
14361431
"regex": "",
14371432
"skipUrlSync": false,
14381433
"sort": 0,
@@ -1543,7 +1538,7 @@
15431538
"query": "label_values(method)",
15441539
"refId": "StandardVariableQuery"
15451540
},
1546-
"refresh": 1,
1541+
"refresh": 2,
15471542
"regex": "",
15481543
"skipUrlSync": false,
15491544
"sort": 0,
@@ -1559,6 +1554,6 @@
15591554
"timezone": "",
15601555
"title": "PRW output of k6",
15611556
"uid": "5cQoNs67k",
1562-
"version": 2,
1557+
"version": 1,
15631558
"weekStart": ""
1564-
}
1559+
}
File renamed without changes.

samples/http_2.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import http from "k6/http";
2+
import { check } from "k6";
3+
4+
export const options = {
5+
vus: 10,
6+
duration: '10s',
7+
thresholds: {
8+
'http_reqs{expected_response:true}': ['rate>10'],
9+
},
10+
};
11+
12+
export default function () {
13+
check(http.get("https://test-api.k6.io/"), {
14+
"status is 200": (r) => r.status == 200,
15+
"protocol is HTTP/2": (r) => r.proto == "HTTP/2.0",
16+
});
17+
}
File renamed without changes.

0 commit comments

Comments
 (0)