MCPcopy Create free account
hub / github.com/anomalyco/opencode / modelHttpErrorsQuery

Function modelHttpErrorsQuery

infra/monitoring.ts:41–86  ·  view source on GitHub ↗
(product: "go" | "zen")

Source from the content-addressed store, hash-verified

39})
40
41const modelHttpErrorsQuery = (product: "go" | "zen") => {
42 const filters = [
43 { column: "model", op: "exists" },
44 { column: "event_type", op: "=", value: "completions" },
45 { column: "user_agent", op: "contains", value: "opencode" },
46 { column: "isGoTier", op: "=", value: product === "go" ? "true" : "false" },
47 ]
48 const failedHttpStatus = calculatedField({
49 name: "is_failed_http_status",
50 expression: `
51IF(
52 AND(
53 GTE($status, "400"),
54 NOT(EQUALS($status, "401")),
55 NOT(
56 AND(
57 EQUALS($status, "429"),
58 OR(
59 EQUALS($error.type, "GoUsageLimitError"),
60 EQUALS($error.type, "FreeUsageLimitError")
61 )
62 )
63 )
64 ),
65 1,
66 0
67)`,
68 })
69
70 return honeycombio.getQuerySpecificationOutput({
71 breakdowns: ["model"],
72 calculatedFields: [failedHttpStatus],
73 calculations: [
74 { op: "COUNT", name: "TOTAL", filterCombination: "AND", filters },
75 {
76 op: "SUM",
77 name: "FAILED",
78 column: failedHttpStatus.name,
79 filterCombination: "AND",
80 filters,
81 },
82 ],
83 formulas: [{ name: "ERROR", expression: "IF(GTE($TOTAL, 150), DIV($FAILED, $TOTAL), 0)" }],
84 timeRange: 900,
85 }).json
86}
87
88const providerHttpErrorsQuery = () => {
89 const filters = [

Callers 1

monitoring.tsFile · 0.85

Calls 1

calculatedFieldFunction · 0.85

Tested by

no test coverage detected