"use strict";(self.webpackChunkantreklabs_iyzitrace_app=self.webpackChunkantreklabs_iyzitrace_app||[]).push([[7959],{40496:(e,t,a)=>{a.d(t,{G:()=>l,R:()=>s});var r=a(45919),n=a(70236);function o(e,t,a,r,n,o,c){try{var s=e[o](c),l=s.value}catch(e){return void a(e)}s.done?t(l):Promise.resolve(l).then(r,n)}function c(e){return function(){var t=this,a=arguments;return new Promise(function(r,n){var c=e.apply(t,a);function s(e){o(c,r,n,s,l,"next",e)}function l(e){o(c,r,n,s,l,"throw",e)}s(void 0)})}}const s=e=>c(function*(){return(yield(0,r.pS)('sum by(service_name, span_name, type, exception_type, exception_message) (iyzitrace_span_metrics_events_total{exception_type=~".+"})')).result.map(e=>({service:e.metric.service_name,operation:e.metric.span_name,type:e.metric.type,exceptionType:e.metric.exception_type,exceptionMessage:e.metric.exception_message,traces:[],count:parseFloat(e.value[1])}))})(),l=(e,t)=>c(function*(){const a=[],r=`{event.exception.type="${e}"}`,o=(yield(0,n.p)(r,t.timeRange.from,t.timeRange.to,parseInt(t.options.limit||"1000"))).traces.map(e=>e.traceID);for(const e of o){const t=yield n.g.getTrace(e);a.push(t)}return a})()},87959:(e,t,a)=>{a.r(t),a.d(t,{default:()=>k});var r=a(85959),n=a.n(r),o=a(80478),c=a(35065),s=a(72153),l=a(91904),i=a(14971),d=a(80155),u=a(12850),m=a(67474),p=a(46089),v=a(81159),b=a(62533),g=a(40496),x=a(44993);function y(e,t,a,r,n,o,c){try{var s=e[o](c),l=s.value}catch(e){return void a(e)}s.done?t(l):Promise.resolve(l).then(r,n)}const f=`/a/${b.id}`,k=()=>{const e={container:p.css`
    padding: 24px;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
  `,header:p.css`
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
  `,breadcrumb:p.css`
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 16px;
  `,backButton:p.css`
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    margin-bottom: 16px;
    
    &:hover {
      background: var(--bg-hover);
      border-color: var(--border-strong);
    }
  `,exceptionInfo:p.css`
    flex: 1;
  `,exceptionType:p.css`
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
  `,errorMessage:p.css`
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 16px;
    word-break: break-all;
  `,eventInfo:p.css`
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
  `,eventId:p.css`
    color: var(--text-muted);
    font-family: monospace;
    font-size: 12px;
  `,timestamp:p.css`
    color: var(--text-muted);
    font-size: 14px;
  `,navigationButtons:p.css`
    display: flex;
    gap: 8px;
  `,navButton:p.css`
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    
    &:hover {
      background: var(--bg-hover);
      border-color: var(--border-strong);
    }
    
    &:disabled {
      background: var(--bg-tertiary);
      border-color: var(--border-color);
      color: var(--text-muted);
      cursor: not-allowed;
    }
  `,actionCardsContainer:p.css`
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
  `,actionCard:p.css`
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
  `,actionCardText:p.css`
    color: var(--text-muted);
    margin-bottom: 12px;
    font-size: 14px;
  `,serviceButton:p.css`
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
    
    &:hover {
      background: #22c55e;
      border-color: #22c55e;
    }
  `,traceButton:p.css`
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
    
    &:hover {
      background: #8b5cf6;
      border-color: #8b5cf6;
    }
  `,spanButton:p.css`
    background: #ea580c;
    border-color: #ea580c;
    color: #fff;
    
    &:hover {
      background: #f97316;
      border-color: #f97316;
    }
  `,stacktraceCard:p.css`
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 24px;
  `,stacktraceHeader:p.css`
    background: var(--bg-tertiary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
  `,stacktraceContent:p.css`
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    background: var(--bg-primary);
    white-space: pre-wrap;
    overflow-x: auto;
  `,keyValueCard:p.css`
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
  `,keyValueHeader:p.css`
    background: var(--bg-tertiary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
  `,keyValueContent:p.css`
    padding: 16px;
  `,keyValueTable:p.css`
    .ant-table {
      background: transparent;
      color: var(--text-primary);
    }
    
    .ant-table-thead > tr > th {
      background: var(--bg-tertiary);
      border-bottom: 1px solid var(--border-color);
      color: var(--text-primary);
    }
    
    .ant-table-tbody > tr > td {
      border-bottom: 1px solid var(--border-color);
      color: var(--text-primary);
    }
    
    .ant-table-tbody > tr:hover > td {
      background: var(--bg-hover);
    }
  `,linkButton:p.css`
    color: #7c3aed;
    cursor: pointer;
    text-decoration: none;
    
    &:hover {
      color: #8b5cf6;
      text-decoration: underline;
    }
  `,monospaceValue:p.css`
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
  `},t=(0,v.useNavigate)(),{groupId:a}=(0,v.useParams)(),[b,k]=(0,r.useState)(!1),[h,E]=(0,r.useState)(null),[N,w]=(0,r.useState)(null),[C,V]=(0,r.useState)(0),[I,A]=(0,r.useState)([]);(0,r.useEffect)(()=>{a&&S(0)},[a]);const S=e=>{return(t=function*(){if(a){k(!0);try{if(I.length>0){const t=I[e];return E(t),w({hasOlder:e>0,hasNewer:e<I.length-1,currentIndex:e,totalCount:I.length}),V(e),void k(!1)}const t=yield(0,g.G)(a,new x.cI({from:String((new Date).getTime()-864e5),to:String((new Date).getTime()),option_interval:"5h"})),r=[];if(t.forEach(e=>{var t;null===(t=e.batches)||void 0===t||t.forEach(e=>{var t,a,n,o,c,s;const l=(null===(t=e.resource)||void 0===t?void 0:t.attributes)||[],i=(null===(n=l.find(e=>"service.name"===e.key))||void 0===n||null===(a=n.value)||void 0===a?void 0:a.stringValue)||"Unknown",d=(null===(c=l.find(e=>"host.name"===e.key))||void 0===c||null===(o=c.value)||void 0===o?void 0:o.stringValue)||"Unknown";null===(s=e.scopeSpans)||void 0===s||s.forEach(e=>{var t;null===(t=e.spans)||void 0===t||t.forEach(e=>{var t;const a=e.attributes||[];null===(t=e.events)||void 0===t||t.forEach((t,n)=>{if("exception"===t.name){var o,c,s,u,m,p,v,b;const g=t.attributes||[],x=(null===(c=g.find(e=>"exception.type"===e.key))||void 0===c||null===(o=c.value)||void 0===o?void 0:o.stringValue)||"Unknown",y=(null===(u=g.find(e=>"exception.message"===e.key))||void 0===u||null===(s=u.value)||void 0===s?void 0:s.stringValue)||"",f=(null===(p=g.find(e=>"exception.stacktrace"===e.key))||void 0===p||null===(m=p.value)||void 0===m?void 0:m.stringValue)||"",k=(null===(b=g.find(e=>"exception.escaped"===e.key))||void 0===b||null===(v=b.value)||void 0===v?void 0:v.stringValue)||"false",h=(e=>{try{const t=atob(e);let a="";for(let e=0;e<t.length;e++)a+=t.charCodeAt(e).toString(16).padStart(2,"0");return a}catch(t){return e}})(e.traceId||""),E=e.spanId||"",N={serviceName:i,"host.name":d,traceID:h,spanID:E,exceptionEscaped:k};a.forEach(e=>{var t,a,r;const n=(null===(t=e.value)||void 0===t?void 0:t.stringValue)||(null===(a=e.value)||void 0===a?void 0:a.intValue)||(null===(r=e.value)||void 0===r?void 0:r.boolValue)||"";N[e.key]=String(n)}),l.forEach(e=>{var t,a,r;const n=(null===(t=e.value)||void 0===t?void 0:t.stringValue)||(null===(a=e.value)||void 0===a?void 0:a.intValue)||(null===(r=e.value)||void 0===r?void 0:r.boolValue)||"";N[`resource.${e.key}`]=String(n)});const w=t.timeUnixNano||e.startTimeUnixNano,C=new Date(Number(w)/1e6).toLocaleString();r.push({exceptionType:x,errorMessage:y,stacktrace:f,timestamp:C,eventId:`${h.substring(0,16)}${n}`,serviceName:i,application:i,traceId:h,spanId:E,keyValuePairs:N})}})})})})}),0===r.length)return void c.Ay.error("No exceptions found");A(r);const n=r[Math.min(e,r.length-1)];E(n),w({hasOlder:e>0,hasNewer:e<r.length-1,currentIndex:e,totalCount:r.length}),V(e)}catch(e){c.Ay.error("Failed to fetch exception details")}finally{k(!1)}}},function(){var e=this,a=arguments;return new Promise(function(r,n){var o=t.apply(e,a);function c(e){y(o,r,n,c,s,"next",e)}function s(e){y(o,r,n,c,s,"throw",e)}c(void 0)})})();var t},B=e=>{if(!N)return;S("older"===e?C-1:C+1)},_=(e,a)=>{switch(e){case"service":t(`${f}/services/${a}`);break;case"trace":t(`${f}/traces/${a}`);break;case"span":t(`${f}/traces/${null==h?void 0:h.traceId}?spanId=${a}`);break;case"logs":t(`${f}/logs?query=${encodeURIComponent(a)}`)}};if(b&&!h)return n().createElement("div",{className:e.container},n().createElement("div",{className:"u-text-center-muted"},"Loading exception details..."));if(!h)return n().createElement("div",{className:e.container},n().createElement("div",{className:"u-text-center-muted"},"Exception not found"));const T=Object.entries(h.keyValuePairs).map(([e,t])=>({key:e,value:t}));return n().createElement("div",{className:e.container},n().createElement(o.Ay,{className:"detail-back-button",icon:n().createElement(l.A,null),onClick:()=>{t(-1)}},"Back to Exceptions"),n().createElement("div",{className:e.header},n().createElement("div",{className:e.exceptionInfo},n().createElement("h1",{className:e.exceptionType},h.exceptionType),n().createElement("div",{className:e.errorMessage},h.errorMessage),n().createElement("div",{className:e.eventInfo},n().createElement("span",{className:e.eventId},"Event ",h.eventId),n().createElement("span",{className:e.timestamp},h.timestamp))),n().createElement("div",{className:e.navigationButtons},n().createElement(o.Ay,{className:e.navButton,icon:n().createElement(d.A,null),disabled:!(null==N?void 0:N.hasOlder),onClick:()=>B("older")},"Previous Exception"),n().createElement(o.Ay,{className:e.navButton,icon:n().createElement(m.A,null),disabled:!(null==N?void 0:N.hasNewer),onClick:()=>B("newer")},"Next Exception"))),n().createElement("div",{className:e.actionCardsContainer},n().createElement("div",{className:e.actionCard},n().createElement("div",{className:e.actionCardText},"View service details and performance metrics for this error"),n().createElement(o.Ay,{className:e.serviceButton,icon:n().createElement(i.A,null),onClick:()=>_("service",h.serviceName||h.application),disabled:!h.serviceName&&!h.application},"View Service Details")),n().createElement("div",{className:e.actionCard},n().createElement("div",{className:e.actionCardText},"See what happened before and after this error in a trace graph"),n().createElement(o.Ay,{className:e.traceButton,icon:n().createElement(i.A,null),onClick:()=>_("trace",h.traceId||""),disabled:!h.traceId},"See the error in trace graph")),n().createElement("div",{className:e.actionCard},n().createElement("div",{className:e.actionCardText},"View specific span details and execution context"),n().createElement(o.Ay,{className:e.spanButton,icon:n().createElement(i.A,null),onClick:()=>_("span",h.spanId||""),disabled:!h.spanId},"View Span Details"))),n().createElement("div",{className:e.keyValueCard},n().createElement("div",{className:e.keyValueHeader},"Key-Value Pairs"),n().createElement("div",{className:e.keyValueContent},n().createElement(s.A,{className:e.keyValueTable,columns:[{title:"Key",dataIndex:"key",key:"key",width:200,render:e=>n().createElement("span",{className:"u-text-white-fw500"},e)},{title:"Value",dataIndex:"value",key:"value",render:(t,a)=>{const r=a.key.toLowerCase();return r.includes("servicename")&&"string"==typeof t?n().createElement(o.Ay,{type:"link",className:e.linkButton,onClick:()=>_("service",t),icon:n().createElement(u.A,null)},t):(r.includes("trace")||r.includes("traceid"))&&"string"==typeof t?n().createElement(o.Ay,{type:"link",className:e.linkButton,onClick:()=>_("trace",t),icon:n().createElement(u.A,null)},n().createElement("span",{className:e.monospaceValue},t)):(r.includes("span")||r.includes("spanid"))&&"string"==typeof t?n().createElement(o.Ay,{type:"link",className:e.linkButton,onClick:()=>_("span",t),icon:n().createElement(u.A,null)},n().createElement("span",{className:e.monospaceValue},t)):r.includes("log")&&"string"==typeof t?n().createElement(o.Ay,{type:"link",className:e.linkButton,onClick:()=>_("logs",t),icon:n().createElement(u.A,null)},t):"string"==typeof t&&(t.length>50||t.includes("http"))?n().createElement("span",{className:e.monospaceValue},t):n().createElement("span",{className:"u-text-muted"},String(t))}}],dataSource:T,pagination:!1,rowKey:"key",size:"small"}))),n().createElement("div",{className:e.stacktraceCard},n().createElement("div",{className:e.stacktraceHeader},"Stacktrace"),n().createElement("div",{className:e.stacktraceContent},h.stacktrace)))}}}]);
//# sourceMappingURL=7959.js.map?_cache=4af5da12a54327a616bb