Spaces:
Running
Running
| import{o as e}from"./chunk-CMxvf4Kt.js";import{t}from"./react-DrNXigiH.js";import{C as n}from"./index-Caa1r77e.js";var r=e(t(),1),i=n();function a(){let e=Date.now();return[{id:`ta-1`,timestamp:e-3e4,title:`CPU spike on checkout-service-7b4`,severity:`high`,service:`checkout`,metric:`cpu.system.percent`,mlScore:92,noiseScore:8,correlationGroup:`CG-001`,explanation:`Sustained CPU increase correlates with 3x traffic spike from marketing campaign launch. Pattern matches seasonal event-driven load.`,suggestedAction:`Auto-scale HPA target to 12 replicas`,status:`open`,causalContext:`Root cause: traffic surge from email campaign (10:00 UTC blast). Causal chain: email_click → checkout_page_load → cpu_spike.`},{id:`ta-2`,timestamp:e-45e3,title:`HTTP 5xx rate above threshold`,severity:`critical`,service:`payments`,metric:`http.error_rate_5xx`,mlScore:97,noiseScore:3,correlationGroup:`CG-001`,explanation:`Error spike tied to upstream database connection saturation. Not an independent alert — correlated with CG-001 checkout CPU alert.`,suggestedAction:`Increase pg connection pool max_connections`,status:`open`,causalContext:`Root cause: pg.connections.active at 95% capacity. Payments service waiting for DB connections, timing out after 30s.`},{id:`ta-3`,timestamp:e-12e4,title:`Redis memory above 90%`,severity:`medium`,service:`redis`,metric:`redis.memory.used_percent`,mlScore:74,noiseScore:26,correlationGroup:null,explanation:`Gradual memory growth over 48h. Toto forecaster predicts breach of 95% threshold in ~6 hours. Likely cache key accumulation without TTL.`,suggestedAction:`Audit keys without TTL; set default expiry policy`,status:`acknowledged`,causalContext:`Trend analysis: linear growth at 0.8%/hr. No upstream anomaly — internal cache policy issue.`},{id:`ta-4`,timestamp:e-3e5,title:`DNS resolution latency spike`,severity:`low`,service:`cdn`,metric:`dns.resolution_time`,mlScore:31,noiseScore:69,correlationGroup:null,explanation:`Transient spike lasting 45 seconds. Pattern matches known ISP route flap noise. ML classifier: 69% probability of false positive.`,suggestedAction:`Suppress — noise pattern`,status:`suppressed`,causalContext:`No downstream impact detected. Historical: 12 similar events in past 30 days, all self-resolved.`},{id:`ta-5`,timestamp:e-6e5,title:`Kafka consumer lag growing`,severity:`high`,service:`kafka`,metric:`kafka.consumer.lag`,mlScore:85,noiseScore:15,correlationGroup:`CG-002`,explanation:`Consumer group "inventory-sync" lagging. 2 of 4 consumers unhealthy after OOM kills. Self-healing workflow triggered.`,suggestedAction:`Self-healing in progress: restart consumers + scale`,status:`auto-resolved`,causalContext:`Root cause: memory limit too low for batch processing spike. Self-healing engine resolved in 3m 12s.`},{id:`ta-6`,timestamp:e-9e5,title:`Auth token validation failures`,severity:`medium`,service:`auth`,metric:`auth.validation.failures`,mlScore:68,noiseScore:32,correlationGroup:null,explanation:`Spike in JWT validation failures from mobile clients. Clock skew detected on mobile app v3.2.1 builds.`,suggestedAction:`Add 30s clock skew tolerance to JWT validator`,status:`open`,causalContext:`Mobile app clock sync issue. Not a security threat — legitimate requests with slightly expired tokens.`},{id:`ta-7`,timestamp:e-12e5,title:`Search index replication delay`,severity:`low`,service:`search`,metric:`es.replication.lag_ms`,mlScore:42,noiseScore:58,correlationGroup:null,explanation:`Elasticsearch cross-cluster replication delayed by 800ms. Within acceptable bounds for search use case.`,suggestedAction:`Monitor — within SLO tolerance`,status:`suppressed`,causalContext:`Network congestion between us-east-1 and eu-west-1. Expected during peak hours.`},{id:`ta-8`,timestamp:e-15e5,title:`Notification service queue depth`,severity:`medium`,service:`notifications`,metric:`queue.depth`,mlScore:71,noiseScore:29,correlationGroup:`CG-001`,explanation:`Queue depth increase correlated with CG-001 traffic spike. Notifications are queued, not dropped. Will clear as traffic normalizes.`,suggestedAction:`No action — self-resolving with traffic normalization`,status:`acknowledged`,causalContext:`Downstream effect of marketing campaign surge. Queue is bounded, no data loss risk.`}]}function o({severity:e}){return(0,i.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 text-[10px] font-mono rounded border uppercase ${{critical:`bg-red-500/10 text-red-400 border-red-500/20`,high:`bg-orange-500/10 text-orange-400 border-orange-500/20`,medium:`bg-yellow-500/10 text-yellow-400 border-yellow-500/20`,low:`bg-green-500/10 text-green-400 border-green-500/20`}[e]||``}`,children:e})}function s({noise:e}){return(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`div`,{className:`w-16 h-1.5 bg-white/[0.04] rounded-full overflow-hidden`,children:(0,i.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${e}%`,background:e>50?`#ef4444`:e>30?`#facc15`:`#4ade80`}})}),(0,i.jsxs)(`span`,{className:`text-[10px] font-mono`,style:{color:e>50?`#ef4444`:e>30?`#facc15`:`#4ade80`},children:[e,`%`]})]})}function c(){let[e,t]=(0,r.useState)([]),[n,c]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=a();t(e),c(e[0])},[]);let l=e.length,u=e.filter(e=>e.status===`suppressed`).length,d=e.filter(e=>e.status===`auto-resolved`).length,f=new Set(e.filter(e=>e.correlationGroup).map(e=>e.correlationGroup)).size,p=u+d;return(0,i.jsxs)(`div`,{className:`space-y-6 max-w-[1400px] mx-auto`,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`p`,{className:`text-xs font-mono uppercase tracking-[0.2em] text-[#f5f5f5]/40 mb-1`,children:`A11OY · INTELLIGENCE · ALERT TRIAGE`}),(0,i.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight text-[#f5f5f5]`,children:`AI Alert Triage`}),(0,i.jsx)(`p`,{className:`text-sm text-[#f5f5f5]/50 mt-1 max-w-3xl`,children:`ML-powered alert prioritization, noise suppression, and correlation grouping. Each alert includes causal context, LLM-generated explanation, and suggested remediation. Reduces alert fatigue by correlating related signals and suppressing known-noise patterns.`})]}),(0,i.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-5 gap-3`,children:[{label:`Total Alerts`,value:l,color:`#06b6d4`},{label:`Noise Reduced`,value:`${p}/${l}`,color:`#4ade80`},{label:`Corr. Groups`,value:f,color:`#a78bfa`},{label:`Auto-Resolved`,value:d,color:`#4ade80`},{label:`Suppressed`,value:u,color:`#facc15`}].map(e=>(0,i.jsxs)(`div`,{className:`bg-[#0a0a0f] border border-white/[0.06] rounded-lg p-3 space-y-1`,children:[(0,i.jsx)(`p`,{className:`text-[10px] font-mono uppercase tracking-widest text-white/30`,children:e.label}),(0,i.jsx)(`p`,{className:`text-xl font-mono font-bold`,style:{color:e.color},children:e.value})]},e.label))}),(0,i.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-5 gap-4`,children:[(0,i.jsxs)(`div`,{className:`lg:col-span-2 bg-[#0a0a0f] border border-white/[0.06] rounded-lg overflow-hidden max-h-[600px] overflow-y-auto`,children:[(0,i.jsxs)(`div`,{className:`p-4 border-b border-white/[0.06] sticky top-0 bg-[#0a0a0f] z-10`,children:[(0,i.jsx)(`h2`,{className:`text-sm font-mono font-semibold uppercase tracking-wider text-white/70`,children:`Alert Queue`}),(0,i.jsx)(`p`,{className:`text-[10px] font-mono text-white/30`,children:`Ranked by ML priority score`})]}),(0,i.jsx)(`div`,{className:`divide-y divide-white/[0.03]`,children:[...e].sort((e,t)=>t.mlScore-e.mlScore).map(e=>(0,i.jsxs)(`button`,{type:`button`,className:`w-full text-left px-4 py-3 cursor-pointer transition-colors ${n?.id===e.id?`bg-white/[0.04]`:`hover:bg-white/[0.02]`} ${e.status===`suppressed`?`opacity-40`:``}`,onClick:()=>c(e),children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,i.jsx)(o,{severity:e.severity}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.correlationGroup&&(0,i.jsx)(`span`,{className:`text-[9px] font-mono px-1 py-0.5 rounded bg-purple-500/10 text-purple-400 border border-purple-500/20`,children:e.correlationGroup}),(0,i.jsx)(`span`,{className:`text-[10px] font-mono ${e.status===`auto-resolved`?`text-green-400`:e.status===`suppressed`?`text-white/30`:`text-white/50`}`,children:e.status})]})]}),(0,i.jsx)(`p`,{className:`text-xs font-bold text-white/80 mb-1`,children:e.title}),(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-[10px] font-mono text-[#c9b787]`,children:e.service}),(0,i.jsx)(s,{noise:e.noiseScore})]})]},e.id))})]}),n&&(0,i.jsx)(`div`,{className:`lg:col-span-3 space-y-4`,children:(0,i.jsxs)(`div`,{className:`bg-[#0a0a0f] border border-white/[0.06] rounded-lg p-5`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,i.jsx)(o,{severity:n.severity}),(0,i.jsx)(`h2`,{className:`text-sm font-mono font-bold text-white/80`,children:n.title})]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 mb-4`,children:[(0,i.jsxs)(`div`,{className:`p-2 rounded bg-white/[0.02] border border-white/[0.04]`,children:[(0,i.jsx)(`p`,{className:`text-[10px] font-mono text-white/30 mb-0.5`,children:`ML Priority`}),(0,i.jsx)(`p`,{className:`text-lg font-mono font-bold`,style:{color:n.mlScore>80?`#ef4444`:n.mlScore>60?`#fb923c`:`#4ade80`},children:n.mlScore})]}),(0,i.jsxs)(`div`,{className:`p-2 rounded bg-white/[0.02] border border-white/[0.04]`,children:[(0,i.jsx)(`p`,{className:`text-[10px] font-mono text-white/30 mb-0.5`,children:`Noise Probability`}),(0,i.jsx)(s,{noise:n.noiseScore})]})]}),(0,i.jsxs)(`div`,{className:`space-y-3`,children:[(0,i.jsxs)(`div`,{className:`p-3 rounded bg-white/[0.02] border border-white/[0.04]`,children:[(0,i.jsx)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-white/40 mb-1`,children:`AI Explanation`}),(0,i.jsx)(`p`,{className:`text-[11px] text-white/60 leading-relaxed`,children:n.explanation})]}),(0,i.jsxs)(`div`,{className:`p-3 rounded bg-white/[0.02] border border-white/[0.04]`,children:[(0,i.jsx)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-white/40 mb-1`,children:`Causal Context`}),(0,i.jsx)(`p`,{className:`text-[11px] text-white/60 leading-relaxed`,children:n.causalContext})]}),(0,i.jsxs)(`div`,{className:`p-3 rounded bg-[#c9b787]/5 border border-[#c9b787]/10`,children:[(0,i.jsx)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-[#c9b787]/60 mb-1`,children:`Suggested Action`}),(0,i.jsx)(`p`,{className:`text-[11px] text-[#c9b787]/80 leading-relaxed`,children:n.suggestedAction})]})]})]})})]})]})}export{c as AlertTriage}; |