curl --location 'https://api.flashcat.cloud/api/v1/northstar/metric/upsert' \
--header 'X-User-Token: YOUR_USER_TOKEN' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NfdXVpZCI6IjM2ZTRjZjI3LWI4OWYtNDFlZS04ZDhmLWZiMjdhMmZlZGIzOSIsImF1dGhvcml6ZWQiOnRydWUsImV4cCI6MTc3NTExMTEyMywidXNlcl9pZGVudGl0eSI6IjEtcm9vdCJ9.IwPWDg92AjjvuUTGplaXgpexmOSsONx73M7Y7pOI_vE' \
--header 'Content-Type: application/json' \
--data '{
"id": 0,
"name": "HTTP 错误率",
"identifier": "http_error_rate",
"data_source_id": 1,
"settings": {
"prometheus.promql": "sum(rate(http_requests_total{status=~\"5..\"}[5m])) / sum(rate(http_requests_total[5m])) * 100"
},
"aggregate": "sum",
"window_seconds": 60,
"delay_seconds": 0,
"description": "HTTP 错误率 指标",
"owners": [
"ops"
],
"labels": {
"service": "checkout"
}
}'