@@ -3,7 +3,7 @@ name: Test Datadog v2 API
3
3
on :
4
4
workflow_dispatch :
5
5
push :
6
- branches : [ berno_prom_metrics ]
6
+ branches : [ main, test/ berno_prom_metrics ]
7
7
8
8
jobs :
9
9
test-datadog :
@@ -27,26 +27,33 @@ jobs:
27
27
if [ -n "${{ secrets.DATADOG_API_KEY }}" ]; then
28
28
echo "β
API Key is set, proceeding with test..."
29
29
30
- # Get current timestamp
31
- timestamp=$(date +%s)
32
- echo "π
Using timestamp: $timestamp"
33
-
34
- # Prepare the JSON payload
30
+ # Prepare the JSON payload (let Datadog use current time)
35
31
json_payload="{
36
32
\"series\": [{
37
33
\"metric\": \"test.datadog.integration\",
38
- \"points\": [{\"timestamp\": $timestamp , \"value\": 42}],
34
+ \"points\": [{\"timestamp\": $(date +%s) , \"value\": 42}],
39
35
\"tags\": [\"service:lace-wallet\", \"env:test\", \"workflow:test-datadog\", \"repo:${{ github.repository }}\", \"branch:${{ github.ref_name }}\", \"commit:${{ github.sha }}\"]
40
36
}, {
41
- \"metric\": \"test.datadog.timestamp \",
42
- \"points\": [{\"timestamp\": $timestamp , \"value\": $timestamp }],
37
+ \"metric\": \"test.datadog.simple \",
38
+ \"points\": [{\"timestamp\": $(date +%s) , \"value\": 100 }],
43
39
\"tags\": [\"service:lace-wallet\", \"env:test\", \"workflow:test-datadog\"]
40
+ }, {
41
+ \"metric\": \"test.datadog.workflow.duration\",
42
+ \"points\": [{\"timestamp\": $(date +%s), \"value\": ${{ github.run_duration }}}],
43
+ \"tags\": [\"service:lace-wallet\", \"env:test\", \"workflow:test-datadog\", \"job:test-datadog\"]
44
+ }, {
45
+ \"metric\": \"test.datadog.success\",
46
+ \"points\": [{\"timestamp\": $(date +%s), \"value\": 1}],
47
+ \"tags\": [\"service:lace-wallet\", \"env:test\", \"workflow:test-datadog\", \"status:success\"]
44
48
}]
45
49
}"
46
50
47
51
echo "π€ Sending JSON payload:"
48
52
echo "$json_payload"
49
53
echo ""
54
+ echo "π JSON validation:"
55
+ echo "$json_payload" | jq '.' 2>/dev/null && echo "β
JSON is valid" || echo "β JSON is invalid"
56
+ echo ""
50
57
51
58
# Send metrics to Datadog v2 API
52
59
echo "π Sending request to Datadog v2 API..."
0 commit comments