"use strict";(self.webpackChunk_mlflow_mlflow=self.webpackChunk_mlflow_mlflow||[]).push([[8614],{39833:function(e,t,o){o.d(t,{E:function(){return l}});var a=o(90970),s=o(13240),n=o(60719),i=o(49960),r=o(44941),l=(0,a.gu)({chartName:"BarChart",GraphicalChild:s.y,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:n.W},{axisType:"yAxis",AxisComp:i.h}],formatAxisMap:r.pr})},48614:function(e,t,o){o.d(t,{TraceRequestsChart:function(){return D}});var a=o(68248),s=o(46709),n=o(27757),i=o(82716),r=o(40724),l=o(66774),u=o(39833),d=o(60719),c=o(49960),m=o(858),h=o(13240),p=o(97245),v=o(52434),f=o(54313),g=o(23327),M=o(83110),T=o(69983);var x=o(3409),y=o(73408);var C={name:"1f1m9i6",styles:"display:flex;justify-content:space-between;align-items:flex-start"};const D=()=>{const{theme:e}=(0,n.u)(),t=(0,x.zZ)(),o=(0,x.IT)(),D=(0,x.T4)(),{totalRequests:Y,avgRequests:w,isLoading:z,error:A,hasData:R,zoom:k}=function(){const{experimentId:e,startTimeMs:t,endTimeMs:o,timeIntervalSeconds:a,timeBuckets:n}=(0,T.W)(),{data:i,isLoading:r,error:l}=(0,g.o4)({experimentId:e,startTimeMs:t,endTimeMs:o,viewType:f.mW.TRACES,metricName:f.po.TRACE_COUNT,aggregations:[{aggregation_type:f.DF.COUNT}],timeIntervalSeconds:a}),u=(0,s.useMemo)(()=>(null===i||void 0===i?void 0:i.data_points)||[],[null===i||void 0===i?void 0:i.data_points]),d=(0,s.useMemo)(()=>u.reduce((e,t)=>{var o;return e+((null===(o=t.values)||void 0===o?void 0:o[f.DF.COUNT])||0)},0),[u]),c=(0,s.useMemo)(()=>d/n.length,[d,n.length]),m=(0,s.useCallback)(e=>{var t;return(null===(t=e.values)||void 0===t?void 0:t[f.DF.COUNT])||0},[]),h=(0,M.NM)(u,m),p=(0,s.useMemo)(()=>n.map(e=>({name:(0,M.fq)(e,a),count:h.get(e)||0})),[n,h,a]),v=(0,M.RZ)(p,"name"),x=(0,s.useMemo)(()=>v.isZoomed?0===v.zoomedData.length?0:v.zoomedData.reduce((e,t)=>e+t.count,0)/v.zoomedData.length:c,[v.isZoomed,v.zoomedData,c]);return{chartData:p,totalRequests:d,avgRequests:x,isLoading:r,error:l,hasData:u.length>0,zoom:v}}(),{zoomedData:_,isZoomed:q,refAreaLeft:L,refAreaRight:S,handleMouseDown:b,handleMouseMove:I,handleMouseUp:N,zoomOut:E}=k,F=(0,s.useCallback)(e=>[`${e}`,"Requests"],[]);return z?(0,y.Y)(x.lh,{}):A?(0,y.Y)(x.nN,{}):(0,y.FD)(x.h,{componentId:"mlflow.charts.trace_requests",children:[(0,y.FD)("div",{css:C,children:[(0,y.Y)(x.XQ,{icon:(0,y.Y)(i.ChartLineIcon,{}),title:(0,y.Y)(r.A,{id:"VLonhQ",defaultMessage:"Requests"}),value:Y.toLocaleString()}),q&&(0,y.Y)(n.B,{componentId:"mlflow.charts.trace_requests.zoom_out",size:"small",onClick:E,children:(0,y.Y)(r.A,{id:"FcddG+",defaultMessage:"Zoom Out"})})]}),(0,y.Y)("div",{css:(0,a.AH)({height:x.tz,userSelect:"none"},""),children:R?(0,y.Y)(l.u,{width:"100%",height:"100%",children:(0,y.FD)(u.E,{data:_,margin:{top:10,right:20,left:10,bottom:0},onMouseDown:b,onMouseMove:I,onMouseUp:N,onMouseLeave:N,children:[(0,y.Y)(d.W,{dataKey:"name",...t}),(0,y.Y)(c.h,{...o}),(0,y.Y)(m.m,{content:(0,y.Y)(x.Vn,{formatter:F}),cursor:{fill:e.colors.actionTertiaryBackgroundHover}}),(0,y.Y)(h.y,{dataKey:"count",fill:e.colors.blue400,radius:[4,4,0,0]}),w>0&&(0,y.Y)(p.e,{y:w,stroke:e.colors.textSecondary,strokeDasharray:"4 4",label:{value:`AVG (${Math.round(w).toLocaleString()})`,position:"insideTopRight",fill:e.colors.textSecondary,fontSize:10}}),L&&S&&(0,y.Y)(v.T,{x1:L,x2:S,...D})]})}):(0,y.Y)(x.iE,{})})]})}}}]);