@@ -2,8 +2,9 @@ import { SECRET } from "./secret"
22import { domain } from "./stage"
33
44const description = "Managed by SST (Don't edit in Honeycomb UI)"
5+ const alertsDisabled = $app . stage !== "production"
56
6- const webhookRecipient = new honeycomb . WebhookRecipient ( "DiscordAlerts" , {
7+ const webhookRecipient = new honeycombio . WebhookRecipient ( "DiscordAlerts" , {
78 name : $app . stage === "production" ? "Discord Alerts" : `Discord Alerts (${ $app . stage } )` ,
89 url : `https://${ domain } /honeycomb/webhook` ,
910 secret : SECRET . HoneycombWebhookSecret . result ,
6667)` ,
6768 } )
6869
69- return honeycomb . getQuerySpecificationOutput ( {
70+ return honeycombio . getQuerySpecificationOutput ( {
7071 breakdowns : [ "model" ] ,
7172 calculatedFields : [ failedHttpStatus ] ,
7273 calculations : [
7980 filters,
8081 } ,
8182 ] ,
82- formulas : [ { name : "ERROR" , expression : "IF(GTE($TOTAL, 200 ), DIV($FAILED, $TOTAL), 0)" } ] ,
83+ formulas : [ { name : "ERROR" , expression : "IF(GTE($TOTAL, 150 ), DIV($FAILED, $TOTAL), 0)" } ] ,
8384 timeRange : 900 ,
8485 } ) . json
8586}
@@ -98,7 +99,7 @@ const providerHttpErrorsQuery = () => {
9899 expression : `IF(GT($llm.error.code, "400"), 1, 0)` ,
99100 } )
100101
101- return honeycomb . getQuerySpecificationOutput ( {
102+ return honeycombio . getQuerySpecificationOutput ( {
102103 breakdowns : [ "provider" ] ,
103104 calculatedFields : [ successHttpStatus , failedProviderHttpStatus ] ,
104105 calculations : [
@@ -122,7 +123,7 @@ const providerHttpErrorsQuery = () => {
122123 } ,
123124 ] ,
124125 formulas : [
125- { name : "ERROR" , expression : "IF(GTE(SUM($SUCCESS, $FAILED), 200 ), DIV($FAILED, SUM($SUCCESS, $FAILED)), 0)" } ,
126+ { name : "ERROR" , expression : "IF(GTE(SUM($SUCCESS, $FAILED), 150 ), DIV($FAILED, SUM($SUCCESS, $FAILED)), 0)" } ,
126127 ] ,
127128 timeRange : 900 ,
128129 } ) . json
@@ -139,7 +140,7 @@ const modelLowTpsQuery = (product: "go" | "zen") => {
139140 { column : "tps.output" , op : "exists" } ,
140141 ]
141142
142- return honeycomb . getQuerySpecificationOutput ( {
143+ return honeycombio . getQuerySpecificationOutput ( {
143144 breakdowns : [ "model" ] ,
144145 calculations : [
145146 { op : "COUNT" , name : "TOTAL" , filterCombination : "AND" , filters } ,
@@ -156,9 +157,10 @@ const modelLowTpsQuery = (product: "go" | "zen") => {
156157 } ) . json
157158}
158159
159- new honeycomb . Trigger ( "IncreasedModelHttpErrorsGo" , {
160+ new honeycombio . Trigger ( "IncreasedModelHttpErrorsGo" , {
160161 name : "Increased Model HTTP Errors [Go]" ,
161162 description,
163+ disabled : alertsDisabled ,
162164 queryJson : modelHttpErrorsQuery ( "go" ) ,
163165 alertType : "on_change" ,
164166 frequency : 300 ,
@@ -175,9 +177,10 @@ new honeycomb.Trigger("IncreasedModelHttpErrorsGo", {
175177 ] ,
176178} )
177179
178- new honeycomb . Trigger ( "IncreasedModelHttpErrorsZen" , {
180+ new honeycombio . Trigger ( "IncreasedModelHttpErrorsZen" , {
179181 name : "Increased Model HTTP Errors [Zen]" ,
180182 description,
183+ disabled : alertsDisabled ,
181184 queryJson : modelHttpErrorsQuery ( "zen" ) ,
182185 alertType : "on_change" ,
183186 frequency : 300 ,
@@ -194,9 +197,10 @@ new honeycomb.Trigger("IncreasedModelHttpErrorsZen", {
194197 ] ,
195198} )
196199
197- new honeycomb . Trigger ( "LowModelTpsGo" , {
200+ new honeycombio . Trigger ( "LowModelTpsGo" , {
198201 name : "Low Model TPS [Go]" ,
199202 description,
203+ disabled : alertsDisabled ,
200204 queryJson : modelLowTpsQuery ( "go" ) ,
201205 alertType : "on_change" ,
202206 frequency : 600 ,
@@ -213,9 +217,10 @@ new honeycomb.Trigger("LowModelTpsGo", {
213217 ] ,
214218} )
215219
216- new honeycomb . Trigger ( "LowModelTpsZen" , {
220+ new honeycombio . Trigger ( "LowModelTpsZen" , {
217221 name : "Low Model TPS [Zen]" ,
218222 description,
223+ disabled : alertsDisabled ,
219224 queryJson : modelLowTpsQuery ( "zen" ) ,
220225 alertType : "on_change" ,
221226 frequency : 600 ,
@@ -232,9 +237,10 @@ new honeycomb.Trigger("LowModelTpsZen", {
232237 ] ,
233238} )
234239
235- new honeycomb . Trigger ( "IncreasedProviderHttpErrors" , {
240+ new honeycombio . Trigger ( "IncreasedProviderHttpErrors" , {
236241 name : "Increased Provider HTTP Errors" ,
237242 description,
243+ disabled : alertsDisabled ,
238244 queryJson : providerHttpErrorsQuery ( ) ,
239245 alertType : "on_change" ,
240246 frequency : 300 ,
@@ -251,10 +257,11 @@ new honeycomb.Trigger("IncreasedProviderHttpErrors", {
251257 ] ,
252258} )
253259
254- new honeycomb . Trigger ( "IncreasedFreeTierRequests" , {
260+ new honeycombio . Trigger ( "IncreasedFreeTierRequests" , {
255261 name : "Increased Free Tier Requests" ,
256262 description,
257- queryJson : honeycomb . getQuerySpecificationOutput ( {
263+ disabled : alertsDisabled ,
264+ queryJson : honeycombio . getQuerySpecificationOutput ( {
258265 calculations : [ { op : "COUNT" } ] ,
259266 filters : [
260267 { column : "event_type" , op : "=" , value : "completions" } ,
0 commit comments