Skip to content

Commit 569f136

Browse files
committed
chore: add e2e mem/cpu metrics to DD
1 parent c0429b0 commit 569f136

File tree

2 files changed

+92
-54
lines changed

2 files changed

+92
-54
lines changed

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

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ jobs:
215215
tags=${{ needs.setup.outputs.tags }}
216216
" > environment.properties
217217
218-
- name: Convert metrics JSON to Prometheus format
218+
- name: Convert metrics JSON to Datadog format
219219
working-directory: './packages/e2e-tests/tools/'
220220
run: |
221-
./convert_metrics_to_prometheus.sh "${{ github.workflow }}" "${{ github.run_id }}" ../../../artifacts/metrics
221+
./convert_metrics_to_datadog.sh "${{ github.workflow }}" "${{ github.run_id }}" ../../../artifacts/metrics "${{ secrets.DATADOG_API_KEY }}"
222222
223223
- name: Publish allure report to S3
224224
uses: andrcuns/[email protected]
@@ -269,67 +269,21 @@ jobs:
269269
name: performance-metrics
270270
path: ./artifacts/metrics
271271

272-
- name: Serve metrics file locally
272+
- name: Send E2E metrics to Datadog
273273
run: |
274-
cat <<'PY' > serve_metrics.py
275-
import http.server, socketserver, pathlib, sys
276-
FILE = pathlib.Path('./artifacts/metrics/prometheus.txt')
277-
class H(http.server.SimpleHTTPRequestHandler):
278-
def do_GET(self):
279-
if self.path == './artifacts/metrics':
280-
content = FILE.read_bytes() if FILE.exists() else b'# metrics not ready\n'
281-
self.send_response(200)
282-
self.end_headers()
283-
self.wfile.write(content)
284-
else:
285-
self.send_error(404)
286-
with socketserver.TCPServer(('0.0.0.0', 9101), H) as s:
287-
print('Serving metrics on :9101/metrics', file=sys.stderr)
288-
s.serve_forever()
289-
PY
290-
python serve_metrics.py &
274+
echo "📊 E2E metrics have been sent to Datadog via the conversion script"
275+
echo "📁 Datadog payload saved to: ./artifacts/metrics/datadog_payload.json"
276+
echo "🔍 Check the previous step for detailed metrics information"
291277
292278
# ------------------------------------------------------------------------
293279
# 3) Write Alloy (River) config — scrape localhost:9101 and remote_write
294280
# ------------------------------------------------------------------------
295-
- name: Generate alloy.river
296-
env:
297-
GRAFANA_CLOUD_USERNAME: ${{ secrets.GRAFANA_ALLOY_USERNAME }}
298-
GRAFANA_CLOUD_API_KEY: ${{ secrets.GRAFANA_ALLOY_API_KEY }}
299-
run: |
300-
mkdir -p alloy
301-
cat > alloy/alloy.river <<RIVER
302-
prometheus.remote_write "gc" {
303-
endpoint {
304-
url = "https://prometheus-us-central1.grafana.net/api/prom/push"
305-
basic_auth {
306-
username = env("GRAFANA_CLOUD_USERNAME")
307-
password = env("GRAFANA_CLOUD_API_KEY")
308-
}
309-
}
310-
}
311-
312-
prometheus.scrape "e2e" {
313-
targets = [{
314-
__address__ = "127.0.0.1:9101",
315-
}]
316-
forward_to = [prometheus.remote_write.gc.receiver]
317-
}
318-
RIVER
281+
319282

320283
# ------------------------------------------------------------------------
321284
# 4) Launch Alloy for ~45 s to scrape + push the data, then shut it down.
322285
# ------------------------------------------------------------------------
323-
- name: Run Alloy and push metrics
324-
run: |
325-
docker run --rm \
326-
-e ALLOY_CONFIG=/etc/alloy.river \
327-
-v "$PWD/alloy/alloy.river:/etc/alloy.river:ro" \
328-
grafana/alloy:latest run /etc/alloy.river &
329-
ALLOY_PID=$!
330-
# wait for two scrape cycles + remote write
331-
sleep 45
332-
kill "$ALLOY_PID" || true
286+
333287

334288
# - name: Create Prometheus config
335289
# env:

docs/e2e-metrics-dashboard.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"title": "Lace E2E Metrics Dashboard",
3+
"description": "E2E test performance metrics dashboard",
4+
"widgets": [
5+
{
6+
"definition": {
7+
"title": "E2E CPU Usage (seconds)",
8+
"title_size": "16",
9+
"title_align": "left",
10+
"type": "query_value",
11+
"requests": [
12+
{
13+
"response_format": "scalar",
14+
"queries": [
15+
{
16+
"data_source": "metrics",
17+
"name": "query1",
18+
"query": "avg:lace.e2e.cpu.seconds_total{service:lace-wallet}",
19+
"aggregator": "avg"
20+
}
21+
],
22+
"formulas": [
23+
{
24+
"formula": "query1"
25+
}
26+
]
27+
}
28+
],
29+
"autoscale": true,
30+
"precision": 2,
31+
"timeseries_background": {
32+
"type": "area"
33+
}
34+
},
35+
"layout": {
36+
"x": 0,
37+
"y": 0,
38+
"width": 2,
39+
"height": 2
40+
}
41+
},
42+
{
43+
"definition": {
44+
"title": "E2E Memory Usage (MB)",
45+
"title_size": "16",
46+
"title_align": "left",
47+
"type": "query_value",
48+
"requests": [
49+
{
50+
"response_format": "scalar",
51+
"queries": [
52+
{
53+
"data_source": "metrics",
54+
"name": "query1",
55+
"query": "avg:lace.e2e.memory.rss_bytes{service:lace-wallet}",
56+
"aggregator": "avg"
57+
}
58+
],
59+
"formulas": [
60+
{
61+
"formula": "query1 / 1048576"
62+
}
63+
]
64+
}
65+
],
66+
"autoscale": true,
67+
"precision": 1,
68+
"timeseries_background": {
69+
"type": "area"
70+
}
71+
},
72+
"layout": {
73+
"x": 2,
74+
"y": 0,
75+
"width": 2,
76+
"height": 2
77+
}
78+
}
79+
],
80+
"template_variables": [],
81+
"layout_type": "ordered",
82+
"notify_list": [],
83+
"reflow_type": "fixed"
84+
}

0 commit comments

Comments
 (0)