"use strict";(self.webpackChunk_mlflow_mlflow=self.webpackChunk_mlflow_mlflow||[]).push([[8462],{18462:function(e,t,s){s.d(t,{ToolPerformanceSummary:function(){return v}});var o=s(68248),a=s(46709),n=s(27757),i=s(82716),l=s(40724),c=s(54313),r=s(23327),d=s(69983);var m=s(3409),u=s(83110),g=s(73408);var p={name:"1fttcpj",styles:"display:flex;flex-direction:column"},f={name:"r0pyvo",styles:"max-height:300px;overflow-y:auto"},h={name:"mphq9r",styles:"font-family:monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"};const v=()=>{const{theme:e}=(0,n.u)(),{getChartColor:t}=(0,u.yC)(),[s,v]=(0,a.useState)("totalCalls"),[A,x]=(0,a.useState)("desc"),{toolsData:y,isLoading:T,error:N,hasData:S}=function(){const{experimentId:e,startTimeMs:t,endTimeMs:s}=(0,d.W)(),o=(0,a.useMemo)(()=>[(0,c.jm)(c.Mm.TYPE,c.du.TOOL)],[]),{data:n,isLoading:i,error:l}=(0,r.o4)({experimentId:e,startTimeMs:t,endTimeMs:s,viewType:c.mW.SPANS,metricName:c.Ub.SPAN_COUNT,aggregations:[{aggregation_type:c.DF.COUNT}],filters:o,dimensions:[c.it.SPAN_NAME,c.it.SPAN_STATUS]}),{data:m,isLoading:u,error:g}=(0,r.o4)({experimentId:e,startTimeMs:t,endTimeMs:s,viewType:c.mW.SPANS,metricName:c.Ub.LATENCY,aggregations:[{aggregation_type:c.DF.AVG}],filters:o,dimensions:[c.it.SPAN_NAME]}),p=(0,a.useMemo)(()=>{const e=new Map,t=new Map;if(null!==n&&void 0!==n&&n.data_points)for(const d of n.data_points){var s,o,a;const t=null===(s=d.dimensions)||void 0===s?void 0:s[c.it.SPAN_NAME],n=null===(o=d.dimensions)||void 0===o?void 0:o[c.it.SPAN_STATUS],i=(null===(a=d.values)||void 0===a?void 0:a[c.DF.COUNT])||0;if(!t)continue;const l=e.get(t)||{total:0,success:0};l.total+=i,n===c.Fp.OK&&(l.success+=i),e.set(t,l)}if(null!==m&&void 0!==m&&m.data_points)for(const n of m.data_points){var i,l;const e=null===(i=n.dimensions)||void 0===i?void 0:i[c.it.SPAN_NAME],s=null===(l=n.values)||void 0===l?void 0:l[c.DF.AVG];e&&void 0!==s&&t.set(e,s)}const r=[];for(const[n,c]of e.entries()){const e=c.total>0?c.success/c.total*100:0;r.push({toolName:n,totalCalls:c.total,successRate:e,avgLatency:t.get(n)||0})}return r.sort((e,t)=>t.totalCalls-e.totalCalls),r},[null===n||void 0===n?void 0:n.data_points,null===m||void 0===m?void 0:m.data_points]);return{toolsData:p,isLoading:i||u,error:l||g,hasData:p.length>0}}(),C=(0,a.useMemo)(()=>y.length?[...y].sort((e,t)=>{let o=0;switch(s){case"toolName":o=e.toolName.localeCompare(t.toolName);break;case"totalCalls":o=e.totalCalls-t.totalCalls;break;case"successRate":o=e.successRate-t.successRate;break;case"avgLatency":o=e.avgLatency-t.avgLatency}return"asc"===A?o:-o}):y,[y,s,A]),Y=e=>{s===e?x("asc"===A?"desc":"asc"):(v(e),x("desc"))};if(T)return(0,g.Y)(m.lh,{});if(N)return(0,g.Y)(m.nN,{});const M={display:"grid",gridTemplateColumns:"minmax(80px, 2fr) 1fr 1fr 1fr",gap:e.spacing.lg,borderBottom:`1px solid ${e.colors.border}`},_={textAlign:"center"},w=({column:t,children:a,centered:n})=>(0,g.FD)("div",{role:"button",tabIndex:0,onClick:()=>Y(t),onKeyDown:e=>"Enter"===e.key&&Y(t),css:(0,o.AH)({display:"flex",alignItems:"center",gap:e.spacing.xs,cursor:"pointer",justifyContent:n?"center":"flex-start",color:e.colors.textSecondary,fontSize:e.typography.fontSizeSm,fontWeight:600,"&:hover":{color:e.colors.textPrimary}},""),children:[a,s===t&&("asc"===A?(0,g.Y)(i.SortAscendingIcon,{}):(0,g.Y)(i.SortDescendingIcon,{}))]});return(0,g.FD)(m.h,{componentId:"mlflow.charts.tool_performance_summary",children:[(0,g.Y)(m.XQ,{icon:(0,g.Y)(i.WrenchIcon,{}),title:(0,g.Y)(l.A,{id:"URGtLz",defaultMessage:"Tool Performance Summary"})}),S?(0,g.FD)("div",{css:p,children:[(0,g.FD)("div",{css:(0,o.AH)({...M,padding:`${e.spacing.sm}px ${e.spacing.lg}px ${e.spacing.sm}px 0`},""),children:[(0,g.Y)(w,{column:"toolName",children:(0,g.Y)(l.A,{id:"WtTgz+",defaultMessage:"Tool"})}),(0,g.Y)(w,{column:"totalCalls",centered:!0,children:(0,g.Y)(l.A,{id:"MNCAQh",defaultMessage:"Calls"})}),(0,g.Y)(w,{column:"successRate",centered:!0,children:(0,g.Y)(l.A,{id:"K2IAP7",defaultMessage:"Success"})}),(0,g.Y)(w,{column:"avgLatency",centered:!0,children:(0,g.Y)(l.A,{id:"x/rA/e",defaultMessage:"Latency"})})]}),(0,g.Y)("div",{css:f,children:C.map((s,a)=>(0,g.FD)("div",{css:(0,o.AH)({...M,padding:`${e.spacing.md}px ${e.spacing.lg}px ${e.spacing.md}px 0`,alignItems:"center","&:last-child":{borderBottom:"none"}},""),children:[(0,g.FD)("div",{css:(0,o.AH)({display:"flex",alignItems:"center",gap:e.spacing.sm},""),children:[(0,g.Y)("div",{css:(0,o.AH)({width:8,height:8,borderRadius:"50%",backgroundColor:t(a),flexShrink:0},"")}),(0,g.Y)(n.T.Text,{css:h,children:s.toolName})]}),(0,g.Y)(n.T.Text,{css:_,children:(0,u.B4)(s.totalCalls)}),(0,g.FD)(n.T.Text,{css:_,children:[s.successRate.toFixed(2),"%"]}),(0,g.Y)(n.T.Text,{css:_,children:(0,u.YL)(s.avgLatency)})]},s.toolName))})]}):(0,g.Y)(m.iE,{})]})}}}]);