Skip to content

Commit 916a36e

Browse files
committed
chore: working datadog api
1 parent 53a36f7 commit 916a36e

File tree

1 file changed

+73
-4
lines changed

1 file changed

+73
-4
lines changed

docs/datadog-setup.md

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This is a simple guide to add Datadog monitoring to your Lace CI/CD pipelines.
88
1. Create account at [datadoghq.com](https://datadoghq.com) (free tier available)
99
2. Go to **Organization Settings****API Keys**
1010
3. Create new API key named "Lace CI Integration"
11+
4. **Important**: Ensure the key has "Metrics Write" permission
1112

1213
### 2. Add GitHub Secret
1314
1. Go to your Lace repository on GitHub
@@ -19,6 +20,34 @@ This is a simple guide to add Datadog monitoring to your Lace CI/CD pipelines.
1920
### 3. Use the New Workflow
2021
Replace your current `ci.yml` with `ci-with-datadog.yml` or add Datadog to existing workflows.
2122

23+
## API Integration Details
24+
25+
### Datadog v2 API Format
26+
The working payload format for Datadog v2 API:
27+
28+
```json
29+
{
30+
"series": [{
31+
"metric": "test.datadog.integration",
32+
"points": [{"timestamp": 1703123456, "value": 42}],
33+
"tags": ["service:lace-wallet", "env:test", "workflow:test-datadog"]
34+
}]
35+
}
36+
```
37+
38+
### Key Requirements
39+
- **Timestamp**: Must be Unix timestamp (seconds since epoch)
40+
- **Points format**: Array of `{"timestamp": X, "value": Y}` objects
41+
- **Tags**: Array of strings in `key:value` format
42+
- **Headers**:
43+
- `Content-Type: application/json`
44+
- `DD-API-KEY: your-api-key`
45+
46+
### API Endpoint
47+
```
48+
POST https://api.us5.datadoghq.com/api/v2/series
49+
```
50+
2251
## What You'll Get
2352

2453
### 📊 **One Dashboard for All Pipelines**
@@ -74,21 +103,61 @@ sum:github.ci.pipeline.status{status:failure,service:lace-wallet} / sum:github.c
74103
avg:github.ci.job.duration{service:lace-wallet,workflow:ci} > 1800
75104
```
76105

106+
## Troubleshooting
107+
108+
### Common Issues
109+
110+
1. **HTTP 403 Forbidden**
111+
- Check API key permissions (needs "Metrics Write")
112+
- Verify API key is correct
113+
- Ensure you're using the right Datadog site (us5.datadoghq.com)
114+
115+
2. **HTTP 400 Bad Request**
116+
- Check JSON payload format
117+
- Ensure timestamps are Unix timestamps (seconds, not milliseconds)
118+
- Verify tags are in correct format
119+
120+
3. **HTTP 401 Unauthorized**
121+
- API key is invalid or expired
122+
- Check if the key has proper permissions
123+
124+
### Testing Your Integration
125+
126+
Use the `test-datadog.yml` workflow to verify your setup:
127+
128+
1. **Manual trigger**: Go to Actions → Test Datadog v2 API → Run workflow
129+
2. **Check logs**: Look for "✅ SUCCESS: Metrics sent successfully to Datadog!"
130+
3. **Verify in Datadog**:
131+
- Go to Metrics Explorer
132+
- Search for `test.datadog.integration`
133+
- Set time range to "Last 1 hour"
134+
- Look for metrics with tags: `service:lace-wallet, env:test`
135+
136+
### Debugging Tips
137+
138+
- The test workflow provides detailed logging
139+
- Check HTTP status codes (202 = success)
140+
- Validate JSON payload with `jq`
141+
- Monitor response times for performance issues
142+
77143
## Files Created
78144

79-
1. **`.github/workflows/datadog-ci.yml`** - Reusable Datadog workflow
80-
2. **`.github/workflows/ci-with-datadog.yml`** - CI with Datadog integration
81-
3. **`docs/datadog-setup.md`** - This guide
145+
1. **`.github/workflows/test-datadog.yml`** - Test workflow for Datadog integration
146+
2. **`.github/workflows/datadog-ci.yml`** - Reusable Datadog workflow
147+
3. **`.github/workflows/ci-with-datadog.yml`** - CI with Datadog integration
148+
4. **`docs/datadog-setup.md`** - This guide
82149

83150
## Next Steps
84151

85152
1. **Set up your Datadog account** and API key
86153
2. **Add the secret** to GitHub
87-
3. **Test the integration** with a small PR
154+
3. **Test the integration** using the test workflow
88155
4. **Create dashboards** using the queries above
89156
5. **Set up alerts** for critical failures
157+
6. **Integrate with your main CI/CD** workflows
90158

91159
## Support
92160

93161
- [Datadog CI Documentation](https://docs.datadoghq.com/continuous_integration/)
94162
- [GitHub Actions Integration](https://github.com/DataDog/github-action-metrics)
163+
- [Datadog v2 API Reference](https://docs.datadoghq.com/api/latest/metrics/)

0 commit comments

Comments
 (0)