"use strict";(self.webpackChunk_mlflow_mlflow=self.webpackChunk_mlflow_mlflow||[]).push([[8472],{30618:function(e,t,o){o.d(t,{b:function(){return l}});var r=o(90970),a=o(15714),i=o(60719),n=o(49960),s=o(44941),l=(0,r.gu)({chartName:"LineChart",GraphicalChild:a.N,axisComponents:[{axisType:"xAxis",AxisComp:i.W},{axisType:"yAxis",AxisComp:n.h}],formatAxisMap:s.pr})},38472:function(e,t,o){o.d(t,{ToolErrorRateChart:function(){return Y}});var r=o(68248),a=o(46709),i=o(27757),n=o(82716),s=o(40724),l=o(66774),c=o(30618),d=o(60719),m=o(49960),u=o(858),h=o(6581),p=o(15714),v=o(16844),f=o(23327),g=o(83110),T=o(69983);var M=o(3409),A=o(91105),C=o(73408);const Y=({toolName:e,lineColor:t,overallErrorRate:o})=>{const{theme:Y}=(0,i.u)(),k=(0,M.zZ)(),w=(0,M.IT)(),x=(0,M.gy)(),{experimentIds:_,timeIntervalSeconds:N}=(0,T.W0)(),I=(0,A.Zp)(),S=t||Y.colors.red500,{chartData:R,isLoading:y,error:D,hasData:W}=function({toolName:e}){const{experimentIds:t,startTimeMs:o,endTimeMs:r,timeIntervalSeconds:i,timeBuckets:n}=(0,T.W0)(),s=(0,a.useMemo)(()=>[(0,v.jm)(v.Mm.TYPE,v.du.TOOL),(0,v.jm)(v.Mm.NAME,e)],[e]),{data:l,isLoading:c,error:d}=(0,f.o)({experimentIds:t,startTimeMs:o,endTimeMs:r,viewType:v.mW.SPANS,metricName:v.Ub.SPAN_COUNT,aggregations:[{aggregation_type:v.DF.COUNT}],filters:s,dimensions:[v.it.SPAN_STATUS],timeIntervalSeconds:i}),m=(0,a.useMemo)(()=>(null===l||void 0===l?void 0:l.data_points)||[],[null===l||void 0===l?void 0:l.data_points]),u=(0,a.useMemo)(()=>{const e=new Map;for(const i of m){var t,o,r;const a=null===(t=i.dimensions)||void 0===t?void 0:t[v.Ad];if(!a)continue;const n=new Date(a).getTime(),s=(null===(o=i.values)||void 0===o?void 0:o[v.DF.COUNT])||0,l=null===(r=i.dimensions)||void 0===r?void 0:r[v.it.SPAN_STATUS];e.has(n)||e.set(n,{error:0,total:0});const c=e.get(n);c.total+=s,l===v.Fp.ERROR&&(c.error+=s)}const a=new Map;for(const[i,{error:n,total:s}]of e)a.set(i,s>0?n/s*100:0);return a},[m]);return{chartData:(0,a.useMemo)(()=>n.map(e=>({name:(0,g.fq)(e,i),errorRate:u.get(e)||0,timestampMs:e})),[n,u,i]),isLoading:c,error:d,hasData:m.length>0}}({toolName:e}),b=(0,a.useCallback)(e=>[`${e.toFixed(2)}%`,"Error Rate"],[]),E=(0,a.useCallback)((t,o)=>{if(void 0===(null===o||void 0===o?void 0:o.timestampMs))return;const r=(0,M.Id)(_[0],o.timestampMs,N,[(0,M.dC)(e),(0,M.WW)("ERROR")]);I(r)},[_,N,e,I]);return y?(0,C.Y)(M.lh,{}):D?(0,C.Y)(M.nN,{}):W?(0,C.FD)(M.h,{componentId:"mlflow.charts.tool_error_rate","data-testid":`tool-chart-${e}`,children:[(0,C.Y)(M.XQ,{icon:(0,C.Y)(n.WrenchIcon,{css:(0,r.AH)({color:S},"")}),title:e,value:`${o.toFixed(2)}%`,subtitle:(0,C.Y)(s.A,{id:"D2svqS",defaultMessage:"overall error rate"})}),(0,C.Y)("div",{css:(0,r.AH)({height:M.tz},""),children:(0,C.Y)(l.u,{width:"100%",height:"100%",children:(0,C.FD)(c.b,{data:R,margin:{top:10,right:10,left:10,bottom:0},children:[(0,C.Y)(d.W,{dataKey:"name",...k}),(0,C.Y)(m.h,{domain:[0,100],tickFormatter:e=>`${e}%`,...w}),(0,C.Y)(u.m,{content:(0,C.Y)(M.Vn,{formatter:b,linkConfig:{componentId:"mlflow.overview.tools.error_rate.view_traces_link",linkText:(0,C.Y)(s.A,{id:"xQ9fuC",defaultMessage:"View error traces for this tool"}),onLinkClick:E}}),cursor:{stroke:Y.colors.actionTertiaryBackgroundHover}}),(0,C.Y)(h.s,{iconType:"plainline",...x}),(0,C.Y)(p.N,{type:"monotone",dataKey:"errorRate",name:"Error Rate",stroke:S,strokeWidth:2,dot:(0,g.vx)(S)})]})})})]}):(0,C.FD)(M.h,{componentId:"mlflow.charts.tool_error_rate","data-testid":`tool-chart-${e}`,children:[(0,C.Y)(M.XQ,{icon:(0,C.Y)(n.WrenchIcon,{css:(0,r.AH)({color:S},"")}),title:e}),(0,C.Y)(M.iE,{})]})}}}]);