Skip to content

Commit cc0e20d

Browse files
committed
chore: add prom metrics uploader to e2e
1 parent c596bdf commit cc0e20d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/e2e-tests-linux-split.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ jobs:
249249
SLACK_TITLE: 'Test automation results :rocket:'
250250
SLACK_USERNAME: lace-qa-bot
251251
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
252+
PUSH_URL: ${{ secrets.GRAFANA_PUSH_URL }} # e.g., https://prometheus-us-central1.grafana.net/api/prom/push
253+
PUSH_USER: ${{ secrets.GRAFANA_USERNAME }} # e.g., 787878
254+
PUSH_PASS: ${{ secrets.GRAFANA_PASSWORD }} # e.g., eyJrIjoxxxxxxxxxxxxxxyMX0=
252255

253256
- name: Deleting chrome tmp files
254257
id: clean-chrome-tmp-files
@@ -268,3 +271,33 @@ jobs:
268271
with:
269272
name: performance-metrics
270273
path: ./artifacts/metrics
274+
275+
- name: Create Prometheus config
276+
run: |
277+
cat >prometheus.yml <<EOF
278+
global:
279+
scrape_interval: 15s
280+
scrape_configs:
281+
- job_name: 'e2e-perf-metrics'
282+
static_configs:
283+
- targets: ['http-server:8000']
284+
metrics_path: '/artifacts/metrics/prometheus.txt'
285+
remote_write:
286+
- url: "$PUSH_URL"
287+
basic_auth:
288+
username: "$PUSH_USER"
289+
password: "$PUSH_PASS"
290+
EOF
291+
cat ./artifacts/metrics/prometheus.txt
292+
293+
- name: Start Python HTTP server
294+
run: |
295+
docker run -d --name http-server -v $(pwd):/app -w /app -p 8000:8000 python:3.11-slim python -m http.server 8000 > http.log 2>&1
296+
297+
- name: Run Prometheus
298+
run: |
299+
docker run -d --name prometheus -v $(pwd):/etc/prometheus -p 9090:9090 --link http-server prom/prometheus:latest --config.file=/etc/prometheus/prometheus.yml --web.listen-address=:9090 > prom.log 2>&1
300+
sleep 60
301+
# Uncomment for troubleshooting.
302+
curl http://localhost:9090/api/v1/query?query=e2e_cpu_seconds_total
303+

0 commit comments

Comments
 (0)