Skip to content

Commit a61d560

Browse files
authored
chore: fix model alerts (anomalyco#25990)
1 parent afad4cc commit a61d560

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

infra/monitoring.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ new incident.AlertRoute("HoneycombAlertRoute", {
178178
reference: $interpolate`alert.attributes.${fields.product.id}`,
179179
},
180180
],
181-
groupingWindowSeconds: 900,
181+
groupingWindowSeconds: 3600,
182182
},
183183
incidentTemplate: {
184184
name: {
@@ -215,7 +215,6 @@ type Trigger = (opts: { model: string; product: Product }) => {
215215
description: string
216216
json: honeycomb.GetQuerySpecificationOutputArgs
217217
threshold: { op: ">=" | "<="; value: number }
218-
baseline: 3600 | 86400
219218
}
220219

221220
type Model = { id: string; products: Product[]; triggers: Trigger[] }
@@ -232,6 +231,8 @@ const httpErrors: Trigger = ({ model, product }) => ({
232231
filterCombination: "AND",
233232
filters: [
234233
{ column: "model", op: "=", value: model },
234+
{ column: "event_type", op: "=", value: "completions" },
235+
{ column: "user_agent", op: "contains", value: "opencode" },
235236
{ column: "isGoTier", op: "=", value: product === "go" ? "true" : "false" },
236237
],
237238
},
@@ -241,6 +242,8 @@ const httpErrors: Trigger = ({ model, product }) => ({
241242
filterCombination: "AND",
242243
filters: [
243244
{ column: "model", op: "=", value: model },
245+
{ column: "event_type", op: "=", value: "completions" },
246+
{ column: "user_agent", op: "contains", value: "opencode" },
244247
{ column: "isGoTier", op: "=", value: product === "go" ? "true" : "false" },
245248
{ column: "status", op: ">=", value: "400" },
246249
{ column: "status", op: "!=", value: "401" },
@@ -250,10 +253,7 @@ const httpErrors: Trigger = ({ model, product }) => ({
250253
formulas: [{ name: "ERROR", expression: "$FAILED / $TOTAL" }],
251254
timeRange: 900,
252255
},
253-
// Alert when errors surge 50% compared to the previous period
254-
threshold: { op: ">=", value: 50 },
255-
// What previous time period to evaluate against
256-
baseline: 3600,
256+
threshold: { op: ">=", value: 0.8 },
257257
})
258258

259259
const models: Model[] = [
@@ -296,10 +296,8 @@ for (const model of models) {
296296
name: spec.title,
297297
description: spec.description,
298298
queryJson: honeycomb.getQuerySpecificationOutput(spec.json).json,
299-
alertType: "on_change",
300-
// This is the minimum when using % change detection
301-
frequency: 900,
302-
baselineDetails: [{ type: "percentage", offsetMinutes: spec.baseline / 60 }],
299+
alertType: "on_true",
300+
frequency: 300,
303301
thresholds: [{ ...spec.threshold, exceededLimit: 1 }],
304302
recipients: [
305303
{

packages/console/app/src/routes/incident/webhook.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import type { APIEvent } from "@solidjs/start/server"
22
import { Resource } from "@opencode-ai/console-resource"
33
import { Webhook } from "svix"
44

5+
const DISCORD_INCIDENT_ROLE_ID = "1501447160175136838"
6+
57
type Incident = {
68
mode?: "test" | "standard"
79
name?: string
@@ -37,14 +39,14 @@ const postDiscordMessage = async (incident: Incident) => {
3739
`**${incident.mode === "test" ? "[TEST] " : ""}${incident.name ?? "Incident has been created"}**`,
3840
incident.summary,
3941
"",
40-
"@inference",
42+
`<@&${DISCORD_INCIDENT_ROLE_ID}>`,
4143
"",
4244
incident.permalink,
4345
]
4446
.filter((line) => line !== undefined)
4547
.join("\n"),
4648
allowed_mentions: {
47-
parse: ["everyone"],
49+
roles: [DISCORD_INCIDENT_ROLE_ID],
4850
},
4951
flags: 4,
5052
}),

0 commit comments

Comments
 (0)