"use strict";(self.webpackChunk_mlflow_mlflow=self.webpackChunk_mlflow_mlflow||[]).push([[8462],{18462:function(e,t,o){o.d(t,{ToolPerformanceSummary:function(){return h}});var s=o(46709),a=o(82716),l=o(27757),n=o(40724),i=o(16844),r=o(23327),c=o(69983);var d=o(3409),m=o(83110),u=o(46956),f=o(73408);var v={name:"1fttcpj",styles:"display:flex;flex-direction:column"},g={name:"r0pyvo",styles:"max-height:300px;overflow-y:auto"};const h=()=>{const{getChartColor:e}=(0,m.yC)(),{sortColumn:t,sortDirection:o,handleSort:h}=(0,u.bf)("totalCalls"),{headerRowStyle:N,bodyRowStyle:p,cellStyle:T}=(0,u.aP)("minmax(80px, 2fr) 1fr 1fr 1fr"),{toolsData:y,isLoading:A,error:C,hasData:S}=function(){const{experimentIds:e,startTimeMs:t,endTimeMs:o}=(0,c.W0)(),a=(0,s.useMemo)(()=>[(0,i.jm)(i.Mm.TYPE,i.du.TOOL)],[]),{data:l,isLoading:n,error:d}=(0,r.o)({experimentIds:e,startTimeMs:t,endTimeMs:o,viewType:i.mW.SPANS,metricName:i.Ub.SPAN_COUNT,aggregations:[{aggregation_type:i.DF.COUNT}],filters:a,dimensions:[i.it.SPAN_NAME,i.it.SPAN_STATUS]}),{data:m,isLoading:u,error:f}=(0,r.o)({experimentIds:e,startTimeMs:t,endTimeMs:o,viewType:i.mW.SPANS,metricName:i.Ub.LATENCY,aggregations:[{aggregation_type:i.DF.AVG}],filters:a,dimensions:[i.it.SPAN_NAME]}),v=(0,s.useMemo)(()=>{const e=new Map,t=new Map;if(null!==l&&void 0!==l&&l.data_points)for(const d of l.data_points){var o,s,a;const t=null===(o=d.dimensions)||void 0===o?void 0:o[i.it.SPAN_NAME],l=null===(s=d.dimensions)||void 0===s?void 0:s[i.it.SPAN_STATUS],n=(null===(a=d.values)||void 0===a?void 0:a[i.DF.COUNT])||0;if(!t)continue;const r=e.get(t)||{total:0,success:0};r.total+=n,l===i.Fp.OK&&(r.success+=n),e.set(t,r)}if(null!==m&&void 0!==m&&m.data_points)for(const l of m.data_points){var n,r;const e=null===(n=l.dimensions)||void 0===n?void 0:n[i.it.SPAN_NAME],o=null===(r=l.values)||void 0===r?void 0:r[i.DF.AVG];e&&void 0!==o&&t.set(e,o)}const c=[];for(const[l,i]of e.entries()){const e=i.total>0?i.success/i.total*100:0;c.push({toolName:l,totalCalls:i.total,successRate:e,avgLatency:t.get(l)||0})}return c.sort((e,t)=>t.totalCalls-e.totalCalls),c},[null===l||void 0===l?void 0:l.data_points,null===m||void 0===m?void 0:m.data_points]);return{toolsData:v,isLoading:n||u,error:d||f,hasData:v.length>0}}(),_=(0,s.useMemo)(()=>y.length?[...y].sort((e,s)=>{let a=0;switch(t){case"toolName":a=e.toolName.localeCompare(s.toolName);break;case"totalCalls":a=e.totalCalls-s.totalCalls;break;case"successRate":a=e.successRate-s.successRate;break;case"avgLatency":a=e.avgLatency-s.avgLatency}return"asc"===o?a:-a}):y,[y,t,o]);return A?(0,f.Y)(d.lh,{}):C?(0,f.Y)(d.nN,{}):(0,f.FD)(d.h,{componentId:"mlflow.charts.tool_performance_summary",children:[(0,f.Y)(d.XQ,{icon:(0,f.Y)(a.WrenchIcon,{}),title:(0,f.Y)(n.A,{id:"URGtLz",defaultMessage:"Tool Performance Summary"})}),S?(0,f.FD)("div",{css:v,children:[(0,f.FD)("div",{css:N,children:[(0,f.Y)(u.y_,{column:"toolName",sortColumn:t,sortDirection:o,onSort:h,children:(0,f.Y)(n.A,{id:"WtTgz+",defaultMessage:"Tool"})}),(0,f.Y)(u.y_,{column:"totalCalls",sortColumn:t,sortDirection:o,onSort:h,centered:!0,children:(0,f.Y)(n.A,{id:"MNCAQh",defaultMessage:"Calls"})}),(0,f.Y)(u.y_,{column:"successRate",sortColumn:t,sortDirection:o,onSort:h,centered:!0,children:(0,f.Y)(n.A,{id:"K2IAP7",defaultMessage:"Success"})}),(0,f.Y)(u.y_,{column:"avgLatency",sortColumn:t,sortDirection:o,onSort:h,centered:!0,children:(0,f.Y)(n.A,{id:"xRM/Eb",defaultMessage:"Latency (AVG)"})})]}),(0,f.Y)("div",{css:g,children:_.map((t,o)=>{const s=y.findIndex(e=>e.toolName===t.toolName),a=-1===s?o:s;return(0,f.FD)("div",{css:p,children:[(0,f.Y)(u.kY,{name:t.toolName,color:e(a),scrollToElementId:`tool-chart-${t.toolName}`}),(0,f.Y)(l.T.Text,{css:T,children:(0,m.B4)(t.totalCalls)}),(0,f.FD)(l.T.Text,{css:T,children:[t.successRate.toFixed(2),"%"]}),(0,f.Y)(l.T.Text,{css:T,children:(0,m.YL)(t.avgLatency)})]},t.toolName)})})]}):(0,f.Y)(d.iE,{})]})}}}]);