The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
import{r as Wt}from"../chunks/hp4PFHFv.js";import{a as qt,c as ut}from"../chunks/h7yRWCtK.js";import"../chunks/DsnmJJEf.js";import{p as yt,c as te,f,s as Kt,x as Yt,d as s,a as St,j as v,k as W,y as Gt,z as Jt,g as e,u as o,l as a,e as $,h as O,r as D,m as n,n as ee,t as me,o as G,q as F}from"../chunks/BKFspo1J.js";import{i as H}from"../chunks/COK9M2N0.js";import{e as Qt}from"../chunks/DpeZtIXD.js";import{c as xe}from"../chunks/CWm9VMfX.js";import{g as ze,a as mt}from"../chunks/CqMCVSVw.js";import{a as Ne,p as Te,t as Ue}from"../chunks/BrdmM8Kw.js";import{t as ct,c as ft,f as Xt,a as Zt}from"../chunks/DbaB4N6s.js";import{C as er}from"../chunks/BgROpcEU.js";import{C as tr}from"../chunks/yLTYAAhJ.js";import{C as rr,a as ar}from"../chunks/BYaKcgwR.js";import{B as or}from"../chunks/BN5eHk5g.js";import{B as Pe}from"../chunks/DY5VVhnr.js";import{L as sr}from"../chunks/CN84UmjY.js";import{E as gt}from"../chunks/NVaYW5lc.js";import{T as nr}from"../chunks/D63hXAj-.js";import{S as ir,b as lr,a as dr}from"../chunks/CoqOZxrY.js";import{D as pt}from"../chunks/ClZStQoA.js";import{P as ur}from"../chunks/N0z9j_AG.js";import{S as mr,a as De}from"../chunks/DLM4tGGX.js";import{S as cr}from"../chunks/CtI0NZdO.js";import{C as vt}from"../chunks/CMTAbOXv.js";import{I as fr}from"../chunks/DuzWbv8u.js";import{C as gr}from"../chunks/z6K29BOV.js";import{g as pr}from"../chunks/Cv0CJCi1.js";import{r as vr}from"../chunks/UDuKBjKQ.js";import{g as ht}from"../chunks/qSFdVk7G.js";import{s as hr}from"../chunks/BSOLzmdY.js";import{p as _t,g as Ve,d as ke,a as Ce,u as _r}from"../chunks/BYJ4QaOY.js";import{g as He,h as $r,i as br,f as yr,t as Oe,b as Sr,a as $t,c as bt,j as wr,k as xr,d as Tr,S as Pr,l as Dr,m as kr,s as Cr}from"../chunks/B-kFjqtk.js";import{a as Or}from"../chunks/Cp2PNrt5.js";import{r as Lr}from"../chunks/DsHSSsTM.js";import{B as Rr}from"../chunks/CPEpMIUk.js";import{E as Ir}from"../chunks/BNdeJfUf.js";import{C as Br}from"../chunks/CPab3OUN.js";import{s as Er,r as Mr}from"../chunks/CARHnQ8P.js";import{I as Fr}from"../chunks/CM27iA0o.js";import{P as jr}from"../chunks/DGbeFZcg.js";import{T as Ar}from"../chunks/CMd3siY9.js";function zr(L,h){yt(h,!0);let i=Mr(h,["$$slots","$$events","$$legacy"]);const ie=[["path",{d:"M11 17h3v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a3.16 3.16 0 0 0 2-2h1a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-1a5 5 0 0 0-2-4V3a4 4 0 0 0-3.2 1.6l-.3.4H11a6 6 0 0 0-6 6v1a5 5 0 0 0 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1z"}],["path",{d:"M16 10h.01"}],["path",{d:"M2 8v1a2 2 0 0 0 2 2h1"}]];Fr(L,Er({name:"piggy-bank"},()=>i,{get iconNode(){return ie},children:(x,T)=>{var R=te(),j=f(R);Kt(j,()=>h.children??Yt),s(x,R)},$$slots:{default:!0}})),St()}const Nr=!1,Ur=({params:L,url:h})=>{if(!qt.isAuthenticated)throw Wt(302,"/login");return{id:L.id,preset:h.searchParams.get("preset"),from:h.searchParams.get("from"),to:h.searchParams.get("to")}},Ga=Object.freeze(Object.defineProperty({__proto__:null,load:Ur,prerender:Nr},Symbol.toStringTag,{value:"Module"})),ne="24h";function Vr(L){switch(L.sliKind){case"endpoint":return"View requests";case"span":return"View bad spans";case"task":return"View task runs";case"monitor":return"Open monitor";case"session":return"View sessions";default:return"Open dashboards"}}function Hr(L){const h=L.sliConfig;switch(L.sliKind){case"endpoint":{const i=h.endpoint;return i?`/endpoints/${encodeURIComponent(i)}?preset=${ne}`:`/endpoints?preset=${ne}`}case"span":{const i=L.sliConfig,ie=Or({name:i.name??"",service:i.serviceName??"",kind:i.kind===null||i.kind===void 0?"":String(i.kind),status:i.good==="availability"?"2":"",minMs:i.good==="latency"?String(i.latencyThresholdMs):"",maxMs:"",traceId:"",attributes:i.attributes??[]}),x=new URLSearchParams;for(const[T,R]of Object.entries(ie))if(R!==void 0)if(Array.isArray(R))for(const j of R)x.append(T,j);else x.set(T,R);return x.set("preset",ne),`/spans?${x.toString()}`}case"task":{const i=h.taskName;return i?`/tasks/${encodeURIComponent(i)}?preset=${ne}`:`/tasks?preset=${ne}`}case"session":return`/sessions?preset=${ne}`;case"monitor":{const i=h.checkIds??[];return i.length===1?`/monitors/${i[0]}`:"/monitors"}default:return"/dashboards"}}var Wr=$('<div class="flex h-64 items-center justify-center"><!></div>'),qr=$('<span class="text-sm text-muted-foreground"> </span>'),Kr=$('<!> <!> <span class="text-sm text-muted-foreground"> </span> <span class="text-sm text-muted-foreground"> </span> <span class="min-w-0 font-mono text-sm break-all text-muted-foreground"> </span> <!>',1),Yr=$("<!> Edit",1),Gr=$("<!> Delete",1),Jr=$("<!> <!>",1),Qr=$("<!> <!>",1),Xr=$("<!> <!> <!> <!>",1),Zr=$(`<!> <p class="mt-2 text-xs text-muted-foreground">Cumulative share of the error budget the traffic in this range has used. On the SLO's own
window it ends at 100% minus the budget left.</p>`,1),ea=$('<!> <span class="text-sm font-[400] text-muted-foreground">Alert rules</span>',1),ta=$("<!> ",1),ra=$('<!> <div class="flex items-center gap-2"><!> <!></div>',1),aa=$(`<p class="text-sm text-muted-foreground">No alert rules reference this SLO yet. Add an SLO Burn Rate or SLO Budget Consumed rule
on the Alerts page to get paged when the budget burns too fast.</p>`),oa=$('<div class="flex flex-col gap-2 rounded-md border p-3 text-sm sm:flex-row sm:items-center sm:justify-between sm:gap-4"><div class="min-w-0"><div class="font-medium"> </div> <div class="text-xs text-muted-foreground"> <!></div></div> <div class="flex shrink-0 items-center gap-2"><!> <!></div></div>'),sa=$('<div class="space-y-2"></div>'),na=$("<!> <!>",1),ia=$('<div class="space-y-4"><!> <!> <!> <!> <!> <!></div> <!> <!>',1);function Ja(L,h){yt(h,!0);const i=h.data.id,ie=!!(h.data.preset||h.data.from||h.data.to),x=ht(),T=o(ht),R=_t(x,"1M"),j=Ve(R,x);let t=v(null),Le=v(W([])),Re=v(!0),le=v(""),ce=v(!1),fe=v(W([])),ge=v(!0),pe=v(""),ve=0,re=v(W(j.from)),ae=v(W(j.to)),k=v(W(R.preset)),J=v(W(ke(j.from,x))),Q=v(W(ke(j.to,x))),de=v(W(Ce(j.from,x))),ue=v(W(Ce(j.to,x))),Ie=v(!1),he=v(!1),Be=v(!1);function wt(){const[r,l]=(e(de)||"00:00").split(":").map(Number);return ct(ft({year:e(J).year,month:e(J).month,day:e(J).day,hour:r,minute:l},e(T)))}function xt(){const[r,l]=(e(ue)||"23:59").split(":").map(Number);return ct(ft({year:e(Q).year,month:e(Q).month,day:e(Q).day,hour:r,minute:l},e(T)).endOf("minute"))}function We(r,l){a(J,ke(r,e(T)),!0),a(de,Ce(r,e(T)),!0),a(Q,ke(l,e(T)),!0),a(ue,Ce(l,e(T)),!0)}function qe(){return e(k)?Ve({preset:e(k),from:null,to:null},e(T)):{from:new Date(wt()),to:new Date(xt())}}async function Ke(){try{const r=await Ne.get(`/slos/${i}`,{projectId:Te.currentProjectId??void 0});a(t,r.slo,!0),a(Le,r.rules||[],!0)}catch(r){mt(r)===404?a(ce,!0):a(le,ze(r)||"Failed to load the SLO",!0)}}async function _e(r,l){if(!e(t))return;const I=++ve;a(ge,!0);const be=qe();let q=$r(be.from,be.to,e(t).windowDays,new Date);q.clamped&&(e(k)&&(a(k,He(e(t).windowDays),!0),q={...qe(),clamped:!0}),We(q.from,q.to),l&&Ue.info(`Range limited to the SLO's ${e(t).windowDays}-day window`)),a(re,q.from,!0),a(ae,q.to,!0),_r(e(k)?{preset:e(k),from:null,to:null}:{preset:null,from:e(re).toISOString(),to:e(ae).toISOString()},{pushToHistory:r});try{const A=await Ne.post(`/slos/${i}/series`,{fromDate:e(re).toISOString(),toDate:e(ae).toISOString(),intervalMinutes:br(e(re),e(ae),e(t).bucketMinutes)},{projectId:Te.currentProjectId??void 0});if(I!==ve)return;a(fe,A.buckets||[],!0),a(pe,"")}catch(A){if(I!==ve)return;a(fe,[],!0),a(pe,ze(A)||"Failed to load the history of this SLO",!0)}finally{I===ve&&a(ge,!1)}}async function Tt(){await Ke(),e(t)&&_e(!1,!1)}async function Ye(){a(Re,!0),a(le,""),a(ce,!1),await Ke(),a(Re,!1),e(t)&&!ie&&e(k)===R.preset&&a(k,He(e(t).windowDays),!0),!e(ce)&&!e(le)&&_e(!1,!1)}function Pt(r,l,I){a(J,r.date,!0),a(de,r.time,!0),a(Q,l.date,!0),a(ue,l.time,!0),a(k,I,!0),_e(!0,!0)}function Ge(){const r=_t(e(T),e(t)?He(e(t).windowDays):"1M"),l=Ve(r,e(T));a(k,r.preset,!0),We(l.from,l.to),_e(!1,!1)}async function Dt(){if(e(t)){a(Be,!0);try{await Ne.delete(`/slos/${i}`,{projectId:Te.currentProjectId??void 0}),Ue.success("Successfully deleted the SLO"),hr.refreshBreachedCount(),pr(vr("/slos"))}catch(r){mt(r)!==403&&Ue.error(ze(r)||"Failed to delete the SLO")}finally{a(Be,!1),a(he,!1)}}}const Ee=o(()=>Dr(e(fe))),Me=o(()=>e(t)?kr(e(fe),e(t).targetPercent):[]),kt=o(()=>[{key:"SLI",color:"var(--chart-1)",data:e(Ee)}]),Ct=o(()=>[{key:"Budget consumed",color:"var(--chart-2)",data:e(Me)}]),$e=o(()=>{if(!e(t)?.historyFrom)return null;const r=new Date(Math.max(new Date(e(t).historyFrom).getTime(),Date.now()-Pr*864e5));if(r.getTime()<=e(re).getTime())return null;const l=Math.max(0,(e(ae).getTime()-r.getTime())/864e5),I=(e(ae).getTime()-e(re).getTime())/864e5;return{historyFrom:r,coveredDays:l,rangeDays:I}});function Je(r){return r>=10?r.toFixed(0):r.toFixed(1)}function Ot(r){return r.enabled?r.snoozedUntil&&new Date(r.snoozedUntil).getTime()>Date.now()?{tone:"warning",label:"Snoozed"}:{tone:"success",label:"On"}:{tone:"neutral",label:"Off"}}Gt(()=>{window.addEventListener("popstate",Ge),Ye()}),Jt(()=>{typeof window<"u"&&window.removeEventListener("popstate",Ge)});var Qe=te(),Lt=f(Qe);{var Rt=r=>{var l=Wr(),I=O(l);sr(I,{size:"xlg"}),D(l),s(r,l)},It=r=>{var l=te(),I=f(l);{var be=A=>{{let ye=o(()=>ut({fallbackPath:"/slos"}));gt(A,{status:404,title:"SLO not found",description:"This SLO does not exist in the current project.",get onBack(){return e(ye)},backLabel:"Back to SLOs"})}},q=A=>{var ye=te(),Bt=f(ye);{var Et=oe=>{{let Se=o(()=>e(le)||"Failed to load the SLO");gt(oe,{status:400,title:"Error",get description(){return e(Se)},onRetry:()=>Ye()})}},Mt=oe=>{const Se=o(()=>Tr(e(t).budgetRemaining));var Xe=ia(),Fe=f(Xe),Ze=O(Fe);{const _=P=>{var g=te(),w=f(g);{var u=m=>{var d=Kr(),X=f(d);lr(X,{get status(){return e(t).status},get enabled(){return e(t).enabled}});var E=n(X,2);dr(E,{get kind(){return e(t).sliKind}});var z=n(E,2),N=O(z);D(z);var U=n(z,2),y=O(U);D(U);var c=n(U,2),V=O(c,!0);D(c);var p=n(c,2);{var K=S=>{var M=qr(),Z=O(M);D(M),G(je=>F(Z,`updated ${je??""}`),[()=>Zt(e(t).computedAt)]),s(S,M)};H(p,S=>{e(t).computedAt&&S(K)})}G(S=>{F(N,`Target ${e(t).targetPercent??""}%`),F(y,`${e(t).windowDays??""}-day window`),F(V,S)},[()=>Cr(e(t))]),s(m,d)};H(w,m=>{e(t)&&m(u)})}s(P,g)},C=P=>{var g=Qr(),w=f(g);nr(w,{onApply:Pt,get fromDate(){return e(J)},set fromDate(d){a(J,d,!0)},get toDate(){return e(Q)},set toDate(d){a(Q,d,!0)},get fromTime(){return e(de)},set fromTime(d){a(de,d,!0)},get toTime(){return e(ue)},set toTime(d){a(ue,d,!0)},get preset(){return e(k)},set preset(d){a(k,d,!0)}});var u=n(w,2);{var m=d=>{var X=Jr(),E=f(X);Pe(E,{variant:"outline",size:"sm",onclick:()=>a(Ie,!0),children:(N,U)=>{var y=Yr(),c=f(y);jr(c,{class:"mr-2 h-4 w-4"}),ee(),s(N,y)},$$slots:{default:!0}});var z=n(E,2);Pe(z,{variant:"destructiveOutline",size:"sm",onclick:()=>a(he,!0),children:(N,U)=>{var y=Gr(),c=f(y);Ar(c,{class:"mr-2 h-4 w-4"}),ee(),s(N,y)},$$slots:{default:!0}}),s(d,X)};H(u,d=>{e(t)&&Te.canWriteCurrentProject&&d(m)})}s(P,g)};let B=o(()=>e(t).description||void 0),b=o(()=>ut({fallbackPath:"/slos"}));ur(Ze,{get title(){return e(t).name},get description(){return e(B)},get onBack(){return e(b)},meta:_,actions:C})}var et=n(Ze,2);mr(et,{columns:4,children:(_,C)=>{var B=Xr(),b=f(B);{let u=o(()=>yr(e(t).currentSli,e(t).targetPercent)),m=o(()=>Oe(e(Se)));De(b,{label:"Current SLI",get value(){return e(u)},get valueClass(){return e(m)},get sub(){return`target ${e(t).targetPercent??""}% over ${e(t).windowDays??""} days`}})}var P=n(b,2);{let u=o(()=>Sr(e(t).budgetRemaining)),m=o(()=>Oe(e(Se))),d=o(()=>e(t).budgetRemaining!==null&&e(t).budgetRemaining<0?"overspent: more failures than the target allows":"share of the allowed failures not yet used");De(P,{label:"Error budget left",get value(){return e(u)},get valueClass(){return e(m)},get sub(){return e(d)}})}var g=n(P,2);{let u=o(()=>$t(e(t).burnRate1h)),m=o(()=>Oe(bt(e(t).burnRate1h)));De(g,{label:"Burn rate 1h",get value(){return e(u)},get valueClass(){return e(m)},sub:"1x spends the budget exactly over the window"})}var w=n(g,2);{let u=o(()=>$t(e(t).burnRate6h)),m=o(()=>Oe(bt(e(t).burnRate6h)));De(w,{label:"Burn rate 6h",get value(){return e(u)},get valueClass(){return e(m)},sub:"sustained burn over the last six hours"})}s(_,B)},$$slots:{default:!0}});var tt=n(et,2);{var Ft=_=>{fr(_,{children:(C,B)=>{ee();var b=me();G((P,g,w)=>F(b,`History covers ${P??""} of ${g??""} days in
this range. Buckets before ${w??""} are still being computed or fall outside telemetry retention.`),[()=>Je(e($e).coveredDays),()=>Je(e($e).rangeDays),()=>Xt(e($e).historyFrom.toISOString(),{format:"short"})]),s(C,b)},$$slots:{default:!0}})};H(tt,_=>{e($e)&&_(Ft)})}var rt=n(tt,2);{const _=b=>{Br(b,{class:"h-3.5 w-3.5 text-muted-foreground"})};let C=o(()=>e(Ee).length===0),B=o(()=>e(pe)||"No events in this range");vt(rt,{title:"SLI",get loading(){return e(ge)},get empty(){return e(C)},get emptyMessage(){return e(B)},icon:_,children:(b,P)=>{{let g=o(()=>[{value:e(t).targetPercent,label:`Target ${e(t).targetPercent}%`}]),w=o(()=>wr(e(Ee),e(t).targetPercent));pt(b,{get series(){return e(kt)},get referenceLines(){return e(g)},get yDomain(){return e(w)},formatValue:u=>`${u.toFixed(2)}%`})}},$$slots:{icon:!0,default:!0}})}var at=n(rt,2);{const _=b=>{zr(b,{class:"h-3.5 w-3.5 text-muted-foreground"})};let C=o(()=>e(Me).length===0),B=o(()=>e(pe)||"No events in this range");vt(at,{title:"Error budget consumed",get loading(){return e(ge)},get empty(){return e(C)},get emptyMessage(){return e(B)},icon:_,children:(b,P)=>{var g=Zr(),w=f(g);{let u=o(()=>xr(e(Me)));pt(w,{get series(){return e(Ct)},referenceLines:[{value:100,label:"Budget exhausted"}],get yDomain(){return e(u)},formatValue:m=>`${m.toFixed(1)}%`,areaFill:!0})}ee(2),s(b,g)},$$slots:{icon:!0,default:!0}})}var jt=n(at,2);xe(jt,()=>er,(_,C)=>{C(_,{class:"gap-3 pt-2",children:(B,b)=>{var P=na(),g=f(P);xe(g,()=>rr,(u,m)=>{m(u,{class:"flex flex-row flex-wrap items-center justify-between gap-3 space-y-0 border-b pl-3 [.border-b]:pb-2",children:(d,X)=>{var E=ra(),z=f(E);xe(z,()=>ar,(c,V)=>{V(c,{class:"flex items-center gap-2 text-base font-medium",children:(p,K)=>{var S=ea(),M=f(S);Rr(M,{class:"h-3.5 w-3.5 text-muted-foreground"}),ee(2),s(p,S)},$$slots:{default:!0}})});var N=n(z,2),U=O(N);Pe(U,{variant:"outline",size:"sm",href:"/notifications?tab=rules",children:(c,V)=>{ee();var p=me("Manage alert rules");s(c,p)},$$slots:{default:!0}});var y=n(U,2);{let c=o(()=>Hr(e(t)));Pe(y,{variant:"outline",size:"sm",get href(){return e(c)},children:(V,p)=>{var K=ta(),S=f(K);Ir(S,{class:"mr-2 h-3.5 w-3.5"});var M=n(S);G(Z=>F(M,` ${Z??""}`),[()=>Vr(e(t))]),s(V,K)},$$slots:{default:!0}})}D(N),s(d,E)},$$slots:{default:!0}})});var w=n(g,2);xe(w,()=>tr,(u,m)=>{m(u,{class:"pb-4",children:(d,X)=>{var E=te(),z=f(E);{var N=y=>{var c=aa();s(y,c)},U=y=>{var c=sa();Qt(c,21,()=>e(Le),V=>V.id,(V,p)=>{const K=o(()=>Ot(e(p)));var S=oa(),M=O(S),Z=O(M),je=O(Z,!0);D(Z);var st=n(Z,2),nt=O(st),zt=n(nt);{var Nt=Y=>{var se=me();G(()=>F(se,`· ${e(p).config.burnRateThreshold??14.4??""}x over ${e(p).config.longWindowMinutes??60??""}m /
${e(p).config.shortWindowMinutes??5??""}m`)),s(Y,se)},Ut=Y=>{var se=te(),we=f(se);{var Ht=Ae=>{var dt=me();G(()=>F(dt,`· ${e(p).config.consumedPercent??80??""}% consumed`)),s(Ae,dt)};H(we,Ae=>{e(p).ruleType==="slo_budget_consumed"&&Ae(Ht)},!0)}s(Y,se)};H(zt,Y=>{e(p).ruleType==="slo_burn_rate"?Y(Nt):Y(Ut,!1)})}D(st),D(M);var it=n(M,2),lt=O(it);or(lt,{variant:"outline",children:(Y,se)=>{ee();var we=me();G(()=>F(we,e(p).channelName)),s(Y,we)},$$slots:{default:!0}});var Vt=n(lt,2);cr(Vt,{get tone(){return e(K).tone},get label(){return e(K).label}}),D(it),D(S),G(()=>{F(je,e(p).name),F(nt,`${Lr[e(p).ruleType]??e(p).ruleType??""} `)}),s(V,S)}),D(c),s(y,c)};H(z,y=>{e(Le).length===0?y(N):y(U,!1)})}s(d,E)},$$slots:{default:!0}})}),s(B,P)},$$slots:{default:!0}})}),D(Fe);var ot=n(Fe,2);ir(ot,{get slo(){return e(t)},onSaved:Tt,get open(){return e(Ie)},set open(_){a(Ie,_,!0)}});var At=n(ot,2);{let _=o(()=>`This permanently deletes "${e(t).name}" and its computed history. Alert rules that reference it are removed too.`);gr(At,{entity:"SLO",get description(){return e(_)},get loading(){return e(Be)},onConfirm:Dt,get open(){return e(he)},set open(C){a(he,C,!0)}})}s(oe,Xe)};H(Bt,oe=>{e(le)||!e(t)?oe(Et):oe(Mt,!1)},!0)}s(A,ye)};H(I,A=>{e(ce)?A(be):A(q,!1)},!0)}s(r,l)};H(Lt,r=>{e(Re)?r(Rt):r(It,!1)})}s(L,Qe),St()}export{Ja as component,Ga as universal};