Skip to content

Commit 7fc2964

Browse files
committed
Update Datadog API key and trigger workflow test
1 parent 60948df commit 7fc2964

File tree

9 files changed

+673
-7
lines changed

9 files changed

+673
-7
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
run: |
1818
if [ -n "${{ secrets.DATADOG_API_KEY }}" ]; then
1919
echo "Sending metrics to Datadog..."
20-
response=$(curl -s -w "%{http_code}" -X POST "https://api.us5.datadoghq.com/api/v1/series" \
20+
response=$(curl -s -w "%{http_code}" -X POST "https://api.datadoghq.com/api/v1/series" \
2121
-H "Content-Type: application/json" \
2222
-H "DD-API-KEY: ${{ secrets.DATADOG_API_KEY }}" \
2323
-d '{
@@ -106,7 +106,7 @@ jobs:
106106
run: |
107107
if [ -n "${{ secrets.DATADOG_API_KEY }}" ]; then
108108
echo "Sending build metrics to Datadog..."
109-
response=$(curl -s -w "%{http_code}" -X POST "https://api.us5.datadoghq.com/api/v1/series" \
109+
response=$(curl -s -w "%{http_code}" -X POST "https://api.datadoghq.com/api/v1/series" \
110110
-H "Content-Type: application/json" \
111111
-H "DD-API-KEY: ${{ secrets.DATADOG_API_KEY }}" \
112112
-d '{
@@ -190,7 +190,7 @@ jobs:
190190
run: |
191191
if [ -n "${{ secrets.DATADOG_API_KEY }}" ]; then
192192
echo "Sending test metrics to Datadog..."
193-
response=$(curl -s -w "%{http_code}" -X POST "https://api.us5.datadoghq.com/api/v1/series" \
193+
response=$(curl -s -w "%{http_code}" -X POST "https://api.datadoghq.com/api/v1/series" \
194194
-H "Content-Type: application/json" \
195195
-H "DD-API-KEY: ${{ secrets.DATADOG_API_KEY }}" \
196196
-d '{
@@ -293,7 +293,7 @@ jobs:
293293
run: |
294294
if [ -n "${{ secrets.DATADOG_API_KEY }}" ]; then
295295
echo "Sending release metrics to Datadog..."
296-
response=$(curl -s -w "%{http_code}" -X POST "https://api.us5.datadoghq.com/api/v1/series" \
296+
response=$(curl -s -w "%{http_code}" -X POST "https://api.datadoghq.com/api/v1/series" \
297297
-H "Content-Type: application/json" \
298298
-H "DD-API-KEY: ${{ secrets.DATADOG_API_KEY }}" \
299299
-d '{
@@ -317,7 +317,7 @@ jobs:
317317
run: |
318318
if [ -n "${{ secrets.DATADOG_API_KEY }}" ]; then
319319
echo "Sending final metrics to Datadog..."
320-
response=$(curl -s -w "%{http_code}" -X POST "https://api.us5.datadoghq.com/api/v1/events" \
320+
response=$(curl -s -w "%{http_code}" -X POST "https://api.datadoghq.com/api/v1/events" \
321321
-H "Content-Type: application/json" \
322322
-H "DD-API-KEY: ${{ secrets.DATADOG_API_KEY }}" \
323323
-d '{

datadog-metrics-guide.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Datadog Metrics Guide for Lace CI
2+
3+
## **Good News: Your Datadog Integration is Working!**
4+
5+
Your API key is valid and the workflow is successfully sending both **metrics** and **events** to Datadog.
6+
7+
## 📊 **Metrics Being Sent**
8+
9+
The workflow sends these metrics to Datadog:
10+
11+
### 1. **CI Pipeline Metrics**
12+
- **Metric Name**: `github.ci.pipeline.duration`
13+
- **Tags**: `service:lace-wallet`, `env:ci`, `workflow:ci`, `job:datadog-ci`
14+
- **Type**: Gauge
15+
- **Description**: Duration of CI pipeline execution
16+
17+
- **Metric Name**: `github.ci.pipeline.status`
18+
- **Tags**: `service:lace-wallet`, `env:ci`, `workflow:ci`, `job:datadog-ci`, `status:success/failure`
19+
- **Type**: Gauge
20+
- **Description**: Success/failure status of CI pipeline
21+
22+
### 2. **Build Metrics**
23+
- **Metric Name**: `lace.build.packages`
24+
- **Tags**: `service:lace-wallet`, `env:ci`, `workflow:ci`, `status:success/failure`
25+
- **Type**: Gauge
26+
- **Description**: Build package completion status
27+
28+
### 3. **Test Metrics**
29+
- **Metric Name**: `lace.tests.unit`
30+
- **Tags**: `service:lace-wallet`, `env:ci`, `workflow:ci`, `status:success/failure`
31+
- **Type**: Gauge
32+
- **Description**: Unit test execution status
33+
34+
### 4. **Release Metrics**
35+
- **Metric Name**: `lace.release.package`
36+
- **Tags**: `service:lace-wallet`, `env:ci`, `workflow:release-pkg`, `status:success/failure`
37+
- **Type**: Gauge
38+
- **Description**: Release package creation status
39+
40+
## 🔍 **How to Find These Metrics in Datadog**
41+
42+
### **Method 1: Metrics Explorer**
43+
1. Go to **Metrics****Explorer** in Datadog
44+
2. Search for these metric names:
45+
- `github.ci.pipeline.duration`
46+
- `github.ci.pipeline.status`
47+
- `lace.build.packages`
48+
- `lace.tests.unit`
49+
- `lace.release.package`
50+
51+
### **Method 2: Query by Service**
52+
1. Go to **Metrics****Explorer**
53+
2. Filter by: `service:lace-wallet`
54+
3. This will show all metrics tagged with your service
55+
56+
### **Method 3: Query by Environment**
57+
1. Go to **Metrics****Explorer**
58+
2. Filter by: `env:ci`
59+
3. This will show all CI-related metrics
60+
61+
### **Method 4: Events Section**
62+
1. Go to **Events** in Datadog
63+
2. Look for events with title: "Lace CI Pipeline Complete"
64+
3. Filter by: `service:lace-wallet`
65+
66+
## 📈 **Sample Queries for Dashboards**
67+
68+
### **Pipeline Success Rate**
69+
```
70+
sum:github.ci.pipeline.status{status:success,service:lace-wallet} / sum:github.ci.pipeline.status{service:lace-wallet}
71+
```
72+
73+
### **Average Pipeline Duration**
74+
```
75+
avg:github.ci.pipeline.duration{service:lace-wallet}
76+
```
77+
78+
### **Build Success Rate**
79+
```
80+
sum:lace.build.packages{status:success,service:lace-wallet} / sum:lace.build.packages{service:lace-wallet}
81+
```
82+
83+
### **Test Success Rate**
84+
```
85+
sum:lace.tests.unit{status:success,service:lace-wallet} / sum:lace.tests.unit{service:lace-wallet}
86+
```
87+
88+
## 🚨 **Troubleshooting**
89+
90+
### **If you can't see metrics:**
91+
1. **Wait 5-10 minutes** - Metrics can take time to appear
92+
2. **Check the time range** - Make sure you're looking at recent data
93+
3. **Verify tags** - Use the exact tag combinations listed above
94+
4. **Check for typos** - Metric names are case-sensitive
95+
96+
### **If you see events but not metrics:**
97+
1. **Check the workflow logs** - Look for "Sending metrics to Datadog..." messages
98+
2. **Verify API responses** - Should show HTTP 202 for success
99+
3. **Check metric names** - Use the exact names listed above
100+
101+
## 🎯 **Next Steps**
102+
103+
1. **Create a dashboard** using the sample queries above
104+
2. **Set up alerts** for pipeline failures
105+
3. **Monitor trends** in build and test performance
106+
4. **Share the dashboard** with your team
107+
108+
## 📞 **Support**
109+
110+
If you still can't see the metrics:
111+
1. Check the workflow logs for any error messages
112+
2. Verify the metric names in the Datadog Metrics Explorer
113+
3. Try the sample queries above
114+
4. Contact Datadog support if needed

debug-metric-sending.sh

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#!/bin/bash
2+
3+
# Comprehensive debugging for Datadog metrics
4+
echo "🔍 Debugging Datadog Metric Sending..."
5+
6+
if [ -z "$DATADOG_API_KEY" ]; then
7+
echo "❌ DATADOG_API_KEY not set"
8+
exit 1
9+
fi
10+
11+
echo "✅ Using API Key: ${DATADOG_API_KEY:0:8}..."
12+
13+
# Test 1: Simple metric with minimal data
14+
echo ""
15+
echo "📊 Test 1: Simple metric..."
16+
response1=$(curl -s -w "%{http_code}" -X POST "https://api.datadoghq.com/api/v1/series" \
17+
-H "Content-Type: application/json" \
18+
-H "DD-API-KEY: $DATADOG_API_KEY" \
19+
-d '{
20+
"series": [{
21+
"metric": "test.simple",
22+
"points": [[$(date +%s), 1]],
23+
"type": "gauge"
24+
}]
25+
}')
26+
27+
http_code1="${response1: -3}"
28+
response_body1="${response1%???}"
29+
30+
echo "HTTP Code: $http_code1"
31+
echo "Response: $response_body1"
32+
33+
# Test 2: Metric with tags
34+
echo ""
35+
echo "📊 Test 2: Metric with tags..."
36+
response2=$(curl -s -w "%{http_code}" -X POST "https://api.datadoghq.com/api/v1/series" \
37+
-H "Content-Type: application/json" \
38+
-H "DD-API-KEY: $DATADOG_API_KEY" \
39+
-d '{
40+
"series": [{
41+
"metric": "test.with.tags",
42+
"points": [[$(date +%s), 2]],
43+
"tags": ["test:true"],
44+
"type": "gauge"
45+
}]
46+
}')
47+
48+
http_code2="${response2: -3}"
49+
response_body2="${response2%???}"
50+
51+
echo "HTTP Code: $http_code2"
52+
echo "Response: $response_body2"
53+
54+
# Test 3: Metric with service tag
55+
echo ""
56+
echo "📊 Test 3: Metric with service tag..."
57+
response3=$(curl -s -w "%{http_code}" -X POST "https://api.datadoghq.com/api/v1/series" \
58+
-H "Content-Type: application/json" \
59+
-H "DD-API-KEY: $DATADOG_API_KEY" \
60+
-d '{
61+
"series": [{
62+
"metric": "test.service",
63+
"points": [[$(date +%s), 3]],
64+
"tags": ["service:test-service"],
65+
"type": "gauge"
66+
}]
67+
}')
68+
69+
http_code3="${response3: -3}"
70+
response_body3="${response3%???}"
71+
72+
echo "HTTP Code: $http_code3"
73+
echo "Response: $response_body3"
74+
75+
# Test 4: Check API key validity
76+
echo ""
77+
echo "🔑 Test 4: Checking API key validity..."
78+
validate_response=$(curl -s -w "%{http_code}" -X GET "https://api.datadoghq.com/api/v1/validate" \
79+
-H "DD-API-KEY: $DATADOG_API_KEY")
80+
81+
validate_http_code="${validate_response: -3}"
82+
validate_response_body="${validate_response%???}"
83+
84+
echo "HTTP Code: $validate_http_code"
85+
echo "Response: $validate_response_body"
86+
87+
# Test 5: Check organization info
88+
echo ""
89+
echo "🏢 Test 5: Checking organization info..."
90+
org_response=$(curl -s -w "%{http_code}" -X GET "https://api.datadoghq.com/api/v1/org" \
91+
-H "DD-API-KEY: $DATADOG_API_KEY")
92+
93+
org_http_code="${org_response: -3}"
94+
org_response_body="${org_response%???}"
95+
96+
echo "HTTP Code: $org_http_code"
97+
echo "Response: $org_response_body"
98+
99+
# Summary
100+
echo ""
101+
echo "📊 SUMMARY:"
102+
echo "Test 1 (Simple): $([ "$http_code1" = "202" ] && echo "" || echo "")"
103+
echo "Test 2 (Tags): $([ "$http_code2" = "202" ] && echo "" || echo "")"
104+
echo "Test 3 (Service): $([ "$http_code3" = "202" ] && echo "" || echo "")"
105+
echo "API Key Valid: $([ "$validate_http_code" = "200" ] && echo "" || echo "")"
106+
echo "Org Info: $([ "$org_http_code" = "200" ] && echo "" || echo "")"
107+
108+
echo ""
109+
echo "🔍 Next Steps:"
110+
echo "1. Check if you see 'test.simple' in Datadog Metrics Explorer"
111+
echo "2. Check if you see 'test.with.tags' in Datadog Metrics Explorer"
112+
echo "3. Check if you see 'test.service' in Datadog Metrics Explorer"
113+
echo "4. Wait 5-10 minutes for metrics to appear"
114+
echo "5. Make sure you're looking at 'Last 1 hour' time range"

find-datadog-org.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
# Find which Datadog organization this API key belongs to
4+
echo "🔍 Finding Datadog Organization..."
5+
6+
if [ -z "$DATADOG_API_KEY" ]; then
7+
echo "❌ DATADOG_API_KEY not set"
8+
exit 1
9+
fi
10+
11+
echo "✅ Using API Key: ${DATADOG_API_KEY:0:8}..."
12+
13+
# Try different Datadog sites
14+
sites=("datadoghq.com" "datadoghq.eu" "us3.datadoghq.com" "us5.datadoghq.com" "ap1.datadoghq.com")
15+
16+
for site in "${sites[@]}"; do
17+
echo ""
18+
echo "🌐 Testing site: $site"
19+
20+
# Test metrics endpoint
21+
response=$(curl -s -w "%{http_code}" -X POST "https://api.$site/api/v1/series" \
22+
-H "Content-Type: application/json" \
23+
-H "DD-API-KEY: $DATADOG_API_KEY" \
24+
-d '{
25+
"series": [{
26+
"metric": "test.site.check",
27+
"points": [[$(date +%s), 1]],
28+
"tags": ["site:'$site'"],
29+
"type": "gauge"
30+
}]
31+
}')
32+
33+
http_code="${response: -3}"
34+
response_body="${response%???}"
35+
36+
echo "HTTP Code: $http_code"
37+
echo "Response: $response_body"
38+
39+
if [ "$http_code" = "202" ]; then
40+
echo "✅ SUCCESS! This API key works with $site"
41+
echo ""
42+
echo "🎯 Go to: https://app.$site"
43+
echo "📊 Look for metric: test.site.check"
44+
echo "🏷️ Filter by tag: site:$site"
45+
break
46+
else
47+
echo "❌ Failed with $site"
48+
fi
49+
done
50+
51+
echo ""
52+
echo "🔍 If none of the sites work, try:"
53+
echo "1. Check your Datadog account settings"
54+
echo "2. Verify the API key is for the correct organization"
55+
echo "3. Contact your Datadog admin"

find-datadog-site.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
echo "🔍 Finding your Datadog site..."
4+
5+
if [ -z "$DATADOG_API_KEY" ]; then
6+
echo "❌ DATADOG_API_KEY not set"
7+
exit 1
8+
fi
9+
10+
echo "✅ Using API Key: ${DATADOG_API_KEY:0:8}..."
11+
12+
# Test different Datadog sites
13+
sites=("datadoghq.com" "us3.datadoghq.com" "us5.datadoghq.com" "ap1.datadoghq.com" "datadoghq.eu")
14+
15+
for site in "${sites[@]}"; do
16+
echo ""
17+
echo "🌐 Testing site: $site"
18+
19+
# Test metrics endpoint
20+
response=$(curl -s -w "%{http_code}" -X POST "https://api.$site/api/v1/series" \
21+
-H "Content-Type: application/json" \
22+
-H "DD-API-KEY: $DATADOG_API_KEY" \
23+
-d '{
24+
"series": [{
25+
"metric": "test.site.check",
26+
"points": [[$(date +%s), 1]],
27+
"tags": ["site:'$site'"],
28+
"type": "gauge"
29+
}]
30+
}')
31+
32+
http_code="${response: -3}"
33+
response_body="${response%???}"
34+
35+
echo "HTTP Code: $http_code"
36+
echo "Response: $response_body"
37+
38+
if [ "$http_code" = "202" ]; then
39+
echo "✅ SUCCESS! This API key works with $site"
40+
echo ""
41+
echo "🎯 Go to: https://app.$site"
42+
echo "📊 Look for metric: test.site.check"
43+
echo "🏷️ Filter by tag: site:$site"
44+
break
45+
else
46+
echo "❌ Failed with $site"
47+
fi
48+
done
49+
50+
echo ""
51+
echo "🔍 If none of the sites work, try:"
52+
echo "1. Check your Datadog account settings"
53+
echo "2. Verify the API key is for the correct organization"
54+
echo "3. Contact your Datadog admin"

0 commit comments

Comments
 (0)