Skip to content

The only tool you need to know what is happening and how to fix it.

14.2 KB
Raw Blame
import{r as rr}from"../chunks/hp4PFHFv.js";import{a as ar}from"../chunks/h7yRWCtK.js";import"../chunks/DsnmJJEf.js";import{i as or,p as sr,j as u,k as R,y as nr,z as lr,e as k,h as O,o as C,d as s,a as ir,l as r,g as e,m as n,c as h,f as d,u as ce,r as z,n as T,t as U,q as F}from"../chunks/BKFspo1J.js";import{i as me}from"../chunks/COK9M2N0.js";import{e as wt}from"../chunks/DpeZtIXD.js";import{c as l}from"../chunks/CWm9VMfX.js";import{a as dr,g as Dt}from"../chunks/CqMCVSVw.js";import{a as ur,p as cr}from"../chunks/BrdmM8Kw.js";import{t as kt,c as At,f as mr,d as pr}from"../chunks/DbaB4N6s.js";import{g as Et}from"../chunks/qSFdVk7G.js";import{b as qe,T as Be,a as B,c as fr}from"../chunks/v9anb0q3.js";import{T as vr}from"../chunks/BWW_Bja4.js";import{A as _r,a as gr,b as hr,c as $r,d as xr,e as br}from"../chunks/BHE_uV_q.js";import{B as Ct}from"../chunks/DY5VVhnr.js";import{I as Ae}from"../chunks/DGTs9ijT.js";import{L as Tr}from"../chunks/CN84UmjY.js";import{T as ae}from"../chunks/D2DsoUX_.js";import{T as Sr}from"../chunks/h9ZJ0sRx.js";import{P as Pr}from"../chunks/Dpq1SVR7.js";import{T as yr}from"../chunks/D63hXAj-.js";import{S as wr}from"../chunks/fuvv1XUh.js";import{W as Dr}from"../chunks/DxDqniE2.js";import{P as kr}from"../chunks/N0z9j_AG.js";import{T as Ar}from"../chunks/amHA2p2Y.js";import{T as rt}from"../chunks/DKzB_-QE.js";import{F as Ft}from"../chunks/BMmxO3lw.js";import{c as Er}from"../chunks/BHvJp7nu.js";import{p as It,g as Ot,d as pe,a as fe,b as Cr,u as Fr}from"../chunks/BYJ4QaOY.js";import{g as Ir,h as Or,s as zr}from"../chunks/X-i49s3k.js";import{a as Lr,b as Mr,i as zt,s as Nr,c as Rr}from"../chunks/DGFc8hah.js";import{D as Lt,r as Ur,s as Kr,a as jr,p as qr,b as Br}from"../chunks/Cp2PNrt5.js";import{P as Mt}from"../chunks/MS5-RPlv.js";import{X as Hr}from"../chunks/BJl12sfz.js";import{C as Wr}from"../chunks/C78GZlAk.js";const Gr=()=>{if(!ar.isAuthenticated)throw rr(302,"/login")},ja=Object.freeze(Object.defineProperty({__proto__:null,load:Gr},Symbol.toStringTag,{value:"Module"}));var Vr=k('<span class="inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 font-mono text-xs"><span class="text-muted-foreground"> </span> <span>=</span> <span> </span> <button type="button" aria-label="Remove filter" class="ml-1 cursor-pointer text-muted-foreground hover:text-foreground"><!></button></span>'),Xr=k(`Matches spans whose attribute has exactly this value. Keys are the OpenTelemetry names,
					such as <code class="font-mono">http.request.method</code>.`,1),Yr=k("<!> <!>",1),Jr=k('<p class="text-xs text-red-500"> </p>'),Qr=k("<!> Add filter",1),Zr=k("<!> <!>",1),ea=k('<!> <div class="flex flex-col gap-3"><!> <!> <!></div> <!>',1),ta=k('<div class="flex h-full items-center justify-center"><!></div>'),ra=k("<!> <!> <!> <!> <!> <!> <!>",1),aa=k("<!> ",1),oa=k("<!> <!> <!> <!> <!> <!> <!>",1),sa=k("<!> <!>",1),na=k('<div class="space-y-4"><!> <!> <div class="flex flex-wrap items-center gap-2"><!> <!> <!> <!> <!></div> <div class="flex flex-wrap items-center gap-2"><button type="button" class="inline-flex items-center gap-1 rounded-full border border-dashed px-3 py-0.5 text-xs font-medium text-muted-foreground transition-colors hover:border-foreground/40 hover:text-foreground"><!> Add attribute filter</button> <!></div> <!> <!> <!> <!></div>');function qa(Nt,Rt){sr(Rt,!0);const $=ce(Et),oe=Et();let ve=u(R([])),at=u(R([])),Y=u(!0),Ee=0,_e=u(""),ge=u(""),H=u(1),He=u(50),We=u(0),Ce=u(0);const ot=It(oe,Lt),Fe=Ot(ot,oe);function st(){return Ur(window.location.search)}let i=u(R(st())),W=u(R(ot.preset)),G=u(R(pe(Fe.from,oe))),V=u(R(pe(Fe.to,oe))),se=u(R(fe(Fe.from,oe))),ne=u(R(fe(Fe.to,oe)));const nt="spans",lt=Ir(nt,{field:"start_time",direction:"desc"});let he=u(R(lt.field==="duration"?"duration":"start_time")),$e=u(R(lt.direction));const Ut=ce(()=>[{value:"",label:"All services"},...[...new Set([...e(at),e(i).service].filter(t=>!!t))].map(t=>({value:t,label:t}))]),Kt=[{value:"",label:"All kinds"},...Lr],jt=[{value:"",label:"Any status"},...Mr];function it(){const[t,a]=(e(se)||"00:00").split(":").map(Number);return kt(At({year:e(G).year,month:e(G).month,day:e(G).day,hour:t,minute:a},e($)))}function dt(){const[t,a]=(e(ne)||"23:59").split(":").map(Number);return kt(At({year:e(V).year,month:e(V).month,day:e(V).day,hour:t,minute:a},e($)).endOf("minute"))}function qt(t){const a=e(W)?{preset:e(W)}:{from:it(),to:dt()};Fr({...a,...jr(e(i))},{pushToHistory:t})}function ut(){const t=It(e($),Lt),a=Ot(t,e($));r(W,t.preset,!0),r(G,pe(a.from,e($)),!0),r(se,fe(a.from,e($)),!0),r(V,pe(a.to,e($)),!0),r(ne,fe(a.to,e($)),!0),r(i,st(),!0),r(H,1),J(!1)}function Bt(t,a,o){r(G,t.date,!0),r(se,t.time,!0),r(V,a.date,!0),r(ne,a.time,!0),r(W,o,!0),r(H,1),J(!0)}async function J(t=!0){const a=++Ee;if(r(Y,!0),r(_e,""),r(ge,""),e(W)){const o=Cr(e(W),e($));r(G,pe(o.from,e($)),!0),r(V,pe(o.to,e($)),!0),r(se,fe(o.from,e($)),!0),r(ne,fe(o.to,e($)),!0)}qt(t);try{const o=await ur.post("/spans/search",{fromDate:it(),toDate:dt(),orderBy:`${e(he)} ${e($e)}`,...Kr(e(i)),pagination:{page:e(H),pageSize:e(He)}},{projectId:cr.currentProjectId??void 0});if(a!==Ee)return;r(ve,o.data||[],!0),r(at,o.services||[],!0),r(We,o.pagination.total,!0),r(Ce,o.pagination.totalPages,!0)}catch(o){if(a!==Ee)return;console.error(o),r(ve,[],!0),r(We,0),r(Ce,0),dr(o)===422?r(ge,Dt(o),!0):r(_e,Dt(o)||"Failed to load spans",!0)}finally{a===Ee&&r(Y,!1)}}function L(){r(H,1),J(!0)}function Ht(t){t>=1&&t<=e(Ce)&&(r(H,t,!0),J(!1))}function Wt(t){r(He,t,!0),r(H,1),J(!1)}function ct(t){const a=Or(t,e(he),e($e));r(he,a.field,!0),r($e,a.direction,!0),zr(nt,a),r(H,1),J(!1)}let xe=u(!1),Ie=u(""),Oe=u(""),ze=u("");function Gt(){r(Ie,""),r(Oe,""),r(ze,""),r(xe,!0)}function mt(){const t=qr(e(Ie),e(Oe),e(i).attributes);if(typeof t=="string"){r(ze,t,!0);return}e(i).attributes=[...e(i).attributes,t],r(xe,!1),L()}function pt(t){t.key==="Enter"&&(t.preventDefault(),mt())}function Vt(t){e(i).attributes=e(i).attributes.filter(a=>a!==t),L()}function Ge(t){t.key==="Enter"&&L()}nr(()=>{window.addEventListener("popstate",ut),J(!1)}),lr(()=>{typeof window<"u"&&window.removeEventListener("popstate",ut)});var Ve=na(),ft=O(Ve);kr(ft,{title:"Spans",description:"Every OpenTelemetry span this project has received.",actions:a=>{yr(a,{onApply:Bt,get fromDate(){return e(G)},set fromDate(o){r(G,o,!0)},get toDate(){return e(V)},set toDate(o){r(V,o,!0)},get fromTime(){return e(se)},set fromTime(o){r(se,o,!0)},get toTime(){return e(ne)},set toTime(o){r(ne,o,!0)},get preset(){return e(W)},set preset(o){r(W,o,!0)}})}});var vt=n(ft,2);wr(vt,{placeholder:"Search span names...",onSearch:L,get disabled(){return e(Y)},get value(){return e(i).name},set value(a){e(i).name=a},pillEnd:a=>{rt(a,{get options(){return e(Ut)},ariaLabel:"Service",class:"h-9 w-[170px] shrink-0 shadow-none sm:rounded-none sm:border-r-0",onChange:L,get value(){return e(i).service},set value(o){e(i).service=o}})},$$slots:{pillEnd:!0}});var Xe=n(vt,2),_t=O(Xe);rt(_t,{get options(){return Kt},ariaLabel:"Span kind",class:"w-[130px]",onChange:L,get value(){return e(i).kind},set value(t){e(i).kind=t}});var gt=n(_t,2);rt(gt,{get options(){return jt},ariaLabel:"Span status",class:"w-[130px]",onChange:L,get value(){return e(i).status},set value(t){e(i).status=t}});var ht=n(gt,2);Ae(ht,{inputmode:"decimal",placeholder:"Min ms","aria-label":"Minimum duration in milliseconds",class:"h-9 w-[100px]",onchange:L,onkeydown:Ge,get value(){return e(i).minMs},set value(t){e(i).minMs=t}});var $t=n(ht,2);Ae($t,{inputmode:"decimal",placeholder:"Max ms","aria-label":"Maximum duration in milliseconds",class:"h-9 w-[100px]",onchange:L,onkeydown:Ge,get value(){return e(i).maxMs},set value(t){e(i).maxMs=t}});var Xt=n($t,2);Ae(Xt,{placeholder:"Trace ID","aria-label":"Trace ID",class:"h-9 w-[280px] font-mono text-xs",onchange:L,onkeydown:Ge,get value(){return e(i).traceId},set value(t){e(i).traceId=t}}),z(Xe);var Ye=n(Xe,2),be=O(Ye);be.__click=Gt;var Yt=O(be);Mt(Yt,{class:"h-3 w-3"}),T(),z(be);var Jt=n(be,2);wt(Jt,17,()=>e(i).attributes,t=>t.key+"="+t.value,(t,a)=>{var o=Vr(),M=O(o),le=O(M,!0);z(M);var Q=n(M,4),Te=O(Q,!0);z(Q);var Z=n(Q,2);Z.__click=()=>Vt(e(a));var Le=O(Z);Hr(Le,{class:"h-3 w-3"}),z(Z),z(o),C(()=>{F(le,e(a).key),F(Te,e(a).value)}),s(t,o)}),z(Ye);var xt=n(Ye,2);l(xt,()=>br,(t,a)=>{a(t,{get open(){return e(xe)},onOpenChange:o=>r(xe,o,!0),children:(o,M)=>{var le=h(),Q=d(le);l(Q,()=>_r,(Te,Z)=>{Z(Te,{children:(Le,Je)=>{var Me=ea(),Ne=d(Me);l(Ne,()=>gr,(c,f)=>{f(c,{children:(v,ee)=>{var I=Yr(),_=d(I);l(_,()=>hr,(g,x)=>{x(g,{children:(m,S)=>{T();var E=U("Add attribute filter");s(m,E)},$$slots:{default:!0}})});var A=n(_,2);l(A,()=>$r,(g,x)=>{x(g,{children:(m,S)=>{T();var E=Xr();T(2),s(m,E)},$$slots:{default:!0}})}),s(v,I)},$$slots:{default:!0}})});var Se=n(Ne,2),K=O(Se);Ft(K,{label:"Attribute key",children:(c,f)=>{Ae(c,{placeholder:"http.request.method",onkeydown:pt,get value(){return e(Ie)},set value(v){r(Ie,v,!0)}})}});var X=n(K,2);Ft(X,{label:"Value",children:(c,f)=>{Ae(c,{placeholder:"GET",onkeydown:pt,get value(){return e(Oe)},set value(v){r(Oe,v,!0)}})}});var Pe=n(X,2);{var ye=c=>{var f=Jr(),v=O(f,!0);z(f),C(()=>F(v,e(ze))),s(c,f)};me(Pe,c=>{e(ze)&&c(ye)})}z(Se);var we=n(Se,2);l(we,()=>xr,(c,f)=>{f(c,{children:(v,ee)=>{var I=Zr(),_=d(I);Ct(_,{variant:"outline",onclick:()=>r(xe,!1),children:(g,x)=>{T();var m=U("Cancel");s(g,m)},$$slots:{default:!0}});var A=n(_,2);Ct(A,{onclick:mt,children:(g,x)=>{var m=Qr(),S=d(m);Mt(S,{class:"h-4 w-4"}),T(),s(g,m)},$$slots:{default:!0}}),s(v,I)},$$slots:{default:!0}})}),s(Le,Me)},$$slots:{default:!0}})}),s(o,le)},$$slots:{default:!0}})});var bt=n(xt,2);{var Qt=t=>{Dr(t,{title:"Narrow the search",children:(a,o)=>{T();var M=U();C(()=>F(M,e(ge))),s(a,M)},$$slots:{default:!0}})};me(bt,t=>{e(ge)&&t(Qt)})}var Tt=n(bt,2);{let t=ce(()=>e(Y)||!!e(_e)||e(ve).length===0);Ar(Tt,{minWidth:"860px",get empty(){return e(t)},children:(a,o)=>{var M=h(),le=d(M);l(le,()=>fr,(Q,Te)=>{Te(Q,{children:(Z,Le)=>{var Je=h(),Me=d(Je);{var Ne=K=>{var X=h(),Pe=d(X);l(Pe,()=>qe,(ye,we)=>{we(ye,{children:(c,f)=>{var v=h(),ee=d(v);l(ee,()=>Be,(I,_)=>{_(I,{children:(A,g)=>{var x=h(),m=d(x);l(m,()=>B,(S,E)=>{E(S,{colspan:7,class:"h-48",children:(ie,j)=>{var q=ta(),N=O(q);Tr(N,{size:"xlg"}),z(q),s(ie,q)},$$slots:{default:!0}})}),s(A,x)},$$slots:{default:!0}})}),s(c,v)},$$slots:{default:!0}})}),s(K,X)},Se=K=>{var X=h(),Pe=d(X);{var ye=c=>{var f=h(),v=d(f);l(v,()=>qe,(ee,I)=>{I(ee,{children:(_,A)=>{var g=h(),x=d(g);l(x,()=>Be,(m,S)=>{S(m,{children:(E,ie)=>{var j=h(),q=d(j);l(q,()=>B,(N,b)=>{b(N,{colspan:7,class:"h-24 text-center text-red-500",children:(de,Qe)=>{T();var te=U();C(()=>F(te,e(_e))),s(de,te)},$$slots:{default:!0}})}),s(E,j)},$$slots:{default:!0}})}),s(_,g)},$$slots:{default:!0}})}),s(c,f)},we=c=>{var f=h(),v=d(f);{var ee=_=>{var A=h(),g=d(A);l(g,()=>qe,(x,m)=>{m(x,{children:(S,E)=>{{let ie=ce(()=>e(ge)?"No results to show":"No spans match in this time range");Sr(S,{colspan:7,get message(){return e(ie)}})}},$$slots:{default:!0}})}),s(_,A)},I=_=>{var A=sa(),g=d(A);l(g,()=>vr,(m,S)=>{S(m,{children:(E,ie)=>{var j=h(),q=d(j);l(q,()=>Be,(N,b)=>{b(N,{children:(de,Qe)=>{var te=ra(),Re=d(te);ae(Re,{label:"Started",tooltip:"When the span started",sortField:"start_time",get currentSortField(){return e(he)},get sortDirection(){return e($e)},onSort:ue=>ct(ue),class:"w-[210px]"});var Ue=n(Re,2);ae(Ue,{label:"Service",tooltip:"The service.name of the resource"});var Ke=n(Ue,2);ae(Ke,{label:"Span",tooltip:"The span name"});var Ze=n(Ke,2);ae(Ze,{label:"Kind",tooltip:"Server, client, producer, consumer or internal",class:"w-[100px]"});var De=n(Ze,2);ae(De,{label:"Status",tooltip:"The span status",class:"w-[90px]"});var ke=n(De,2);ae(ke,{label:"Duration",tooltip:"How long the span took",sortField:"duration",get currentSortField(){return e(he)},get sortDirection(){return e($e)},onSort:ue=>ct(ue),class:"w-[110px]"});var je=n(ke,2);ae(je,{label:"Trace",tooltip:"Start of the trace ID. Open the row to see the whole trace",class:"w-[110px]"}),s(de,te)},$$slots:{default:!0}})}),s(E,j)},$$slots:{default:!0}})});var x=n(g,2);l(x,()=>qe,(m,S)=>{S(m,{children:(E,ie)=>{var j=h(),q=d(j);wt(q,17,()=>e(ve),N=>`${N.traceId}:${N.spanId}`,(N,b)=>{var de=h(),Qe=d(de);{let te=ce(()=>Er(Br(e(b),{focusSpan:!0})??""));l(Qe,()=>Be,(Re,Ue)=>{Ue(Re,{class:"cursor-pointer",get onclick(){return e(te)},children:(Ke,Ze)=>{var De=oa(),ke=d(De);l(ke,()=>B,(P,y)=>{y(P,{class:"text-sm whitespace-nowrap text-muted-foreground tabular-nums",children:(w,re)=>{T();var p=U();C(D=>F(p,D),[()=>mr(e(b).startTime,{timezone:e($),format:"datetime-seconds"})]),s(w,p)},$$slots:{default:!0}})});var je=n(ke,2);l(je,()=>B,(P,y)=>{y(P,{class:"text-sm",children:(w,re)=>{T();var p=U();C(()=>F(p,e(b).serviceName||"-")),s(w,p)},$$slots:{default:!0}})});var ue=n(je,2);l(ue,()=>B,(P,y)=>{y(P,{class:"max-w-[420px] truncate font-mono text-sm",children:(w,re)=>{var p=aa(),D=d(p);{var et=tt=>{Wr(tt,{class:"mr-1 inline h-3.5 w-3.5 align-[-2px] text-destructive","aria-label":"Error"})};me(D,tt=>{zt(e(b))&&tt(et)})}var tr=n(D,1,!0);C(()=>F(tr,e(b).name)),s(w,p)},$$slots:{default:!0}})});var St=n(ue,2);l(St,()=>B,(P,y)=>{y(P,{class:"text-sm text-muted-foreground",children:(w,re)=>{T();var p=U();C(D=>F(p,D),[()=>Nr(e(b).spanKind)||"-"]),s(w,p)},$$slots:{default:!0}})});var Pt=n(St,2);{let P=ce(()=>zt(e(b))?"text-sm text-destructive":"text-sm");l(Pt,()=>B,(y,w)=>{w(y,{get class(){return e(P)},children:(re,p)=>{T();var D=U();C(et=>F(D,et),[()=>Rr(e(b).statusCode)]),s(re,D)},$$slots:{default:!0}})})}var yt=n(Pt,2);l(yt,()=>B,(P,y)=>{y(P,{class:"font-mono text-sm tabular-nums",children:(w,re)=>{T();var p=U();C(D=>F(p,D),[()=>pr(e(b).duration)]),s(w,p)},$$slots:{default:!0}})});var er=n(yt,2);l(er,()=>B,(P,y)=>{y(P,{class:"font-mono text-xs text-muted-foreground",children:(w,re)=>{T();var p=U();C(D=>F(p,D),[()=>e(b).traceId.slice(0,8)]),s(w,p)},$$slots:{default:!0}})}),s(Ke,De)},$$slots:{default:!0}})})}s(N,de)}),s(E,j)},$$slots:{default:!0}})}),s(_,A)};me(v,_=>{e(ve).length===0?_(ee):_(I,!1)},!0)}s(c,f)};me(Pe,c=>{e(_e)?c(ye):c(we,!1)},!0)}s(K,X)};me(Me,K=>{e(Y)?K(Ne):K(Se,!1)})}s(Z,Je)},$$slots:{default:!0}})}),s(a,M)},$$slots:{default:!0}})}var Zt=n(Tt,2);Pr(Zt,{get currentPage(){return e(H)},get totalPages(){return e(Ce)},get pageSize(){return e(He)},get totalItems(){return e(We)},onPageChange:Ht,onPageSizeChange:Wt,get loading(){return e(Y)},itemLabel:"span"}),z(Ve),C(()=>be.disabled=e(Y)),s(Nt,Ve),ir()}or(["click"]);export{qa as component,ja as universal};