Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(sentry/alerts): migrate to span dataset, add triggers to metric workflows

justin884de66cae2c
diff --git a/scripts/provision-sentry-alerts.sh b/scripts/provision-sentry-alerts.sh
index 6c550054c..ae28e4687 100755
--- a/scripts/provision-sentry-alerts.sh
+++ b/scripts/provision-sentry-alerts.sh
@@ -280,8 +280,9 @@ for i in $(seq 0 $((COUNT - 1))); do
fi
fi
- # Workflow for metric alerts: detector-only, no triggers. The detector
- # itself fires when its condition matches.
+ # Workflow for metric alerts: detectorOnly is the firing model, but the
+ # API still expects a `triggers` field on every workflow. Empty conditions
+ # are fine; the detector drives notification when the threshold trips.
WORKFLOW=$(echo "$ALERT" | jq --arg org "$ORG" --argjson freq "$DEFAULT_FREQUENCY_MIN" \
--argjson detectors "$DETECTOR_IDS" '
{
@@ -289,7 +290,11 @@ for i in $(seq 0 $((COUNT - 1))); do
enabled: (.workflow.enabled // true),
organizationId: $org,
config: ((.workflow.config // {}) + {frequency: $freq}),
- detectorIds: $detectors
+ detectorIds: $detectors,
+ triggers: {
+ logicType: "any-short",
+ conditions: []
+ }
}
')
diff --git a/sentry/alerts.json b/sentry/alerts.json
index 344f7bffd..f00d4aba7 100644
--- a/sentry/alerts.json
+++ b/sentry/alerts.json
@@ -7,6 +7,7 @@
"_comment_condition_result": "The Sentry API requires `conditionResult` on every condition. For issue alerts it's a boolean (true fires). For metric alerts it maps to issue priority: 75 = high, 50 = low, 0 = resolved.",
"_comment_event_types": "dataSources need `eventTypes`. Errors: [\"default\", \"error\"]. Transactions: [\"trace_item_span\"].",
"_comment_condition_group": "Detectors need a top-level `conditionGroup` defining the threshold (gt/lte/anomaly_detection).",
+ "_comment_dataset": "Sentry is migrating transaction-based alerts away from `dataset: transactions`. Use `dataset: events_analytics_platform` (with `is_transaction:true` in the query) for transaction-based metrics.",
"alerts": [
{
"name": "Kaneo API: New issue",
@@ -103,8 +104,8 @@
},
"dataSources": [
{
- "dataset": "transactions",
- "query": "transaction.duration:>0 transaction:*/api/*",
+ "dataset": "events_analytics_platform",
+ "query": "transaction.duration:>0 transaction:*/api/* is_transaction:true",
"queryType": 1,
"aggregate": "p95(transaction.duration)",
"timeWindow": 600,
@@ -148,8 +149,8 @@
},
"dataSources": [
{
- "dataset": "transactions",
- "query": "transaction:*/api/mcp/* http.status_code:>=500",
+ "dataset": "events_analytics_platform",
+ "query": "transaction:*/api/mcp/* http.status_code:>=500 is_transaction:true",
"queryType": 1,
"aggregate": "failure_rate()",
"timeWindow": 3600,