1"use strict";(globalThis.webpackChunk_mlflow_mlflow=globalThis.webpackChunk_mlflow_mlflow||[]).push([[4565],{24213(e,o,t){t.d(o,{IT:()=>O,Id:()=>I,OM:()=>Y,R3:()=>M,T4:()=>L,Vn:()=>A,WW:()=>w,XQ:()=>h,dC:()=>_,gy:()=>D,h:()=>E,iE:()=>x,lh:()=>y,nN:()=>b,t4:()=>C,tz:()=>m,zZ:()=>N});var n=t(15032),i=t(51477),a=t(77753),r=t(10587),s=t(5460),l=t(39521),d=t(19135),c=t(19740),u=t(67593),p=t(33972),g=t(63968);const m=200;var v={name:"lugakg",styles:"font-weight:normal"};const h=({icon:e,title:o,value:t,subtitle:i})=>{const{theme:a}=(0,r.u)();return(0,g.FD)("div",{css:(0,n.AH)({marginBottom:a.spacing.lg},""),children:[(0,g.FD)("div",{css:(0,n.AH)({display:"flex",alignItems:"center",gap:a.spacing.xs},""),children:[(0,g.Y)("span",{css:(0,n.AH)({color:a.colors.textSecondary,display:"flex"},""),children:e}),(0,g.Y)(r.T.Text,{bold:!0,size:"lg",children:o})]}),void 0!==t&&(0,g.FD)(r.T.Title,{level:3,css:(0,n.AH)({margin:0,marginTop:a.spacing.sm},""),children:[t,i&&(0,g.FD)(g.FK,{children:[" ",(0,g.Y)(r.T.Text,{color:"secondary",css:v,children:i})]})]})]})},T=({children:e,height:o=280})=>{const{theme:t}=(0,r.u)();return(0,g.Y)("div",{css:(0,n.AH)({border:`1px solid ${t.colors.border}`,borderRadius:t.borders.borderRadiusMd,padding:t.spacing.lg,height:o,display:"flex",alignItems:"center",justifyContent:"center"},""),children:e})};var k={name:"1u1zie3",styles:"width:120px"},f={name:"m0jwvv",styles:"width:80px"},S={name:"82a6rk",styles:"flex:1"};const y=({height:e=280})=>{const{theme:o}=(0,r.u)();return(0,g.FD)("div",{css:(0,n.AH)({border:`1px solid ${o.colors.border}`,borderRadius:o.borders.borderRadiusMd,padding:o.spacing.lg,height:e,display:"flex",flexDirection:"column",gap:o.spacing.md},""),children:[(0,g.Y)(a.TitleSkeleton,{css:k}),(0,g.Y)(a.TitleSkeleton,{css:f}),(0,g.Y)("div",{css:S,children:(0,g.Y)(a.TableSkeleton,{lines:4})})]})},b=({height:e,message:o})=>(0,g.Y)(T,{height:e,children:(0,g.Y)(r.T.Text,{color:"error",children:o||(0,g.Y)(s.A,{id:"cp/h86",defaultMessage:"Failed to load chart data"})})}),x=({height:e,message:o})=>(0,g.Y)("div",{css:(0,n.AH)({height:e||"100%",display:"flex",alignItems:"center",justifyContent:"center"},""),children:(0,g.Y)(r.T.Text,{color:"secondary",children:o||(0,g.Y)(s.A,{id:"zwktEP",defaultMessage:"No data available for the selected time range"})})});function M(e,o,t){const n=c.Ay.getExperimentPageTabRoute(e,u.fM.Traces),i=new URLSearchParams,{startTimeLabel:a,startTime:r,endTime:s}=null!==o&&void 0!==o?o:{};return a&&i.set("startTimeLabel",a),r&&i.set("startTime",r),s&&i.set("endTime",s),null===t||void 0===t||t.forEach(e=>i.append("filter",e)),`${n}?${i.toString()}`}function I(e,o,t,n){return M(e,{startTimeLabel:"CUSTOM",startTime:new Date(o).toISOString(),endTime:new Date(o+1e3*t).toISOString()},n)}function C(e){return[p.w8.ASSESSMENT,p.dD.IS_NOT_NULL,"",e].join("::")}function Y(e,o){return[p.w8.ASSESSMENT,p.tl.EQUALS,o,e].join("::")}function _(e){return[p.Gq,p.tl.EQUALS,e].join("::")}function w(e){return[p.RC,p.tl.EQUALS,e].join("::")}function A({active:e,payload:o,label:t,formatter:a,linkConfig:c,componentId:u}){var p,m,v,h;const{theme:T}=(0,r.u)(),k=(0,l.Zp)(),{hideTooltipLinks:f,tooltipLinkUrlBuilder:S,tooltipLinkText:y,tracesNavigationFilters:b}=null!==(p=(0,i.useContext)(d.J0))&&void 0!==p?p:{};if(!e||null===o||void 0===o||!o.length)return null;const x=null===(m=o[0])||void 0===m?void 0:m.payload,M=void 0!==(null===c||void 0===c?void 0:c.onLinkClick),C=(null===c||void 0===c?void 0:c.experimentId)&&(null===c||void 0===c?void 0:c.timeIntervalSeconds)&&void 0!==(null===x||void 0===x?void 0:x.timestampMs),Y=!f&&c&&(M||C);return(0,g.FD)("div",{onMouseMove:e=>e.stopPropagation(),css:(0,n.AH)({backgroundColor:`${T.colors.backgroundPrimary}80`,backdropFilter:"blur(2px)",border:`1px solid ${T.colors.border}`,borderRadius:T.borders.borderRadiusMd,fontSize:T.typography.fontSizeSm,padding:T.spacing.sm,pointerEvents:"auto",marginLeft:-20,marginRight:-20},""),children:[t&&(0,g.Y)("div",{css:(0,n.AH)({fontWeight:500,marginBottom:T.spacing.xs},""),children:t}),(0,g.Y)("div",{css:(0,n.AH)({maxHeight:120,overflowY:"auto",overflowX:"hidden"},""),children:o.map((e,o)=>{const[t,i]=a(e.value,e.name);return(0,g.FD)("div",{css:(0,n.AH)({display:"flex",alignItems:"center",gap:T.spacing.xs,paddingTop:T.spacing.xs,paddingBottom:T.spacing.xs},""),children:[(0,g.Y)("span",{css:(0,n.AH)({width:T.spacing.sm,height:T.spacing.sm,borderRadius:"50%",backgroundColor:e.color,flexShrink:0},"")}),(0,g.FD)("span",{css:(0,n.AH)({color:e.color},""),children:[i,":"]}),(0,g.Y)("span",{children:t})]},o)})}),Y&&(0,g.Y)("div",{css:(0,n.AH)({borderTop:`1px solid ${T.colors.border}`,marginTop:T.spacing.xs,paddingTop:T.spacing.xs},""),children:(0,g.Y)(r.T.Link,{componentId:null!==u&&void 0!==u?u:"mlflow.overview.usage.traces.view_traces_link",onClick:()=>{var e;if(M)null===(e=c.onLinkClick)||void 0===e||e.call(c,t,x);else if(C){var o,n,i,a,r,s;const e=S?S(null!==(o=c.experimentId)&&void 0!==o?o:"",null!==(n=x.timestampMs)&&void 0!==n?n:0,null!==(i=c.timeIntervalSeconds)&&void 0!==i?i:0):I(null!==(a=c.experimentId)&&void 0!==a?a:"",null!==(r=x.timestampMs)&&void 0!==r?r:0,null!==(s=c.timeIntervalSeconds)&&void 0!==s?s:0,b);k(e)}},css:(0,n.AH)({cursor:"pointer",display:"flex",alignItems:"center",gap:T.spacing.xs},""),children:null!==(v=null!==(h=null===c||void 0===c?void 0:c.linkText)&&void 0!==h?h:y)&&void 0!==v?v:(0,g.Y)(s.A,{id:"c+3yBY",defaultMessage:"View traces for this period"})})})]})}function N(){const{theme:e}=(0,r.u)();return{tick:{fontSize:10,fill:e.colors.textSecondary,dy:e.spacing.sm}
1,axisLine:!1,tickLine:!1,interval:"preserveStartEnd"}}function O(){const{theme:e}=(0,r.u)();return{tick:{fontSize:10,fill:e.colors.textSecondary},axisLine:!1,tickLine:!1,width:40}}function D(e){var o;const{theme:t}=(0,r.u)();return{formatter:e=>(0,g.Y)("span",{css:(0,n.AH)({color:t.colors.textPrimary,fontSize:t.typography.fontSizeSm,cursor:"pointer"},""),children:e}),wrapperStyle:{maxHeight:null!==(o=null===e||void 0===e?void 0:e.maxHeight)&&void 0!==o?o:60,overflowY:"auto",overflowX:"hidden",paddingTop:t.spacing.xs}}}const E=({children:e,componentId:o,...t})=>{const{theme:a}=(0,r.u)(),s=(0,r.g)({componentType:r.D.Card,componentId:o,analyticsEvents:[r.f.OnClick]}),l=(0,i.useCallback)(e=>{o&&(null===s||void 0===s||s.onClick(e))},[o,s]);return(0,g.Y)("div",{css:(0,n.AH)({border:`1px solid ${a.colors.border}`,borderRadius:a.borders.borderRadiusMd,padding:a.spacing.lg,backgroundColor:a.colors.backgroundPrimary},""),onClick:l,...t,children:e})};function L(){const{theme:e}=(0,r.u)();return{strokeOpacity:.3,fill:e.colors.blue200,fillOpacity:.3}}},94565(e,o,t){t.d(o,{TraceTokenUsageChart:()=>x});var n=t(15032),i=t(51477),a=t(10587),r=t(5460),s=t(68077),l=t(60400),d=t(57455),c=t(55368),u=t(95305),p=t(78632),g=t(82124),m=t(8098),v=t(39848),h=t(55871),T=t(71974),k=t(19135),f=t(89511);const S=[v.po.INPUT_TOKENS,v.po.OUTPUT_TOKENS];var y=t(24213),b=t(63968);const x=()=>{const{theme:e}=(0,a.u)(),o=(0,y.zZ)(),t=(0,y.IT)(),x=(0,y.gy)(),{getOpacity:M,handleLegendMouseEnter:I,handleLegendMouseLeave:C}=(0,T.pH)(.8,.2),{experimentIds:Y,timeIntervalSeconds:_}=(0,k.W0)(),{chartData:w,totalTokens:A,totalInputTokens:N,totalOutputTokens:O,totalCacheReadTokens:D,totalCacheCreationTokens:E,isLoading:L,error:U,hasData:H}=function({enabled:e=!0}={}){var o,t,n;const{experimentIds:a,startTimeMs:r,endTimeMs:s,timeIntervalSeconds:l,timeBuckets:d,filters:c}=(0,k.W0)(),u=Boolean((0,f.T5)()),p={experimentIds:a,startTimeMs:r,endTimeMs:s,viewType:v.mW.TRACES,filters:c},g=[{aggregation_type:v.DF.SUM}],{data:m,isLoading:y,error:b}=(0,h.o)({...p,metricNames:S,aggregations:g,timeIntervalSeconds:l,enabled:u&&e}),{data:x,isLoading:M,error:I}=(0,h.o)({...p,metricName:v.po.INPUT_TOKENS,aggregations:g,timeIntervalSeconds:l,enabled:!u&&e}),{data:C,isLoading:Y,error:_}=(0,h.o)({...p,metricName:v.po.OUTPUT_TOKENS,aggregations:g,timeIntervalSeconds:l,enabled:!u&&e}),{data:w}=(0,h.o)({...p,metricName:v.po.CACHE_READ_INPUT_TOKENS,aggregations:[{aggregation_type:v.DF.SUM}],timeIntervalSeconds:l,enabled:e}),{data:A}=(0,h.o)({...p,metricName:v.po.CACHE_CREATION_INPUT_TOKENS,aggregations:[{aggregation_type:v.DF.SUM}],timeIntervalSeconds:l,enabled:e}),{data:N,isLoading:O,error:D}=(0,h.o)({...p,metricName:v.po.TOTAL_TOKENS,aggregations:[{aggregation_type:v.DF.SUM},{aggregation_type:v.DF.AVG}],enabled:e}),E=(0,i.useMemo)(()=>{var e,o,t;return[...null!==(e=null===m||void 0===m?void 0:m.data_points)&&void 0!==e?e:[],...null!==(o=null===x||void 0===x?void 0:x.data_points)&&void 0!==o?o:[],...null!==(t=null===C||void 0===C?void 0:C.data_points)&&void 0!==t?t:[]]},[null===m||void 0===m?void 0:m.data_points,null===x||void 0===x?void 0:x.data_points,null===C||void 0===C?void 0:C.data_points]),L=(0,i.useMemo)(()=>(null===w||void 0===w?void 0:w.data_points)||[],[null===w||void 0===w?void 0:w.data_points]),U=(0,i.useMemo)(()=>(null===A||void 0===A?void 0:A.data_points)||[],[null===A||void 0===A?void 0:A.data_points]),H=(0,i.useMemo)(()=>E.filter(e=>e.metric_name===v.po.INPUT_TOKENS),[E]),R=(0,i.useMemo)(()=>E.filter(e=>e.metric_name===v.po.OUTPUT_TOKENS),[E]),F=O||(u?y:M||Y),K=D||(u?b:I||_),P=(null===N||void 0===N||null===(o=N.data_points)||void 0===o||null===(t=o[0])||void 0===t||null===(n=t.values)||void 0===n?void 0:n[v.DF.SUM])||0,z=(0,i.useMemo)(()=>H.reduce((e,o)=>{var t;return e+((null===(t=o.values)||void 0===t?void 0:t[v.DF.SUM])||0)},0),[H]),B=(0,i.useMemo)(()=>R.reduce((e,o)=>{var t;return e+((null===(t=o.values)||void 0===t?void 0:t[v.DF.SUM])||0)},0),[R]),W=(0,i.useMemo)(()=>L.reduce((e,o)=>{var t;return e+((null===(t=o.values)||void 0===t?void 0:t[v.DF.SUM])||0)},0),[L]),$=(0,i.useMemo)(()=>U.reduce((e,o)=>{var t;return e+((null===(t=o.values)||void 0===t?void 0:t[v.DF.SUM])||0)},0),[U]),j=(0,i.useCallback)(e=>{var o;return(null===(o=e.values)||void 0===o?void 0:o[v.DF.SUM])||0},[]),Q=(0,T.NM)(H,j),X=(0,T.NM)(R,j),G=(0,T.NM)(L,j),V=(0,T.NM)(U,j);return{chartData:(0,i.useMemo)(()=>d.map(e=>({name:(0,T.fq)(e,l),inputTokens:Q.get(e)||0,outputTokens:X.get(e)||0,cacheReadTokens:G.get(e)||0,cacheCreationTokens:V.get(e)||0,timestampMs:e})),[d,Q,X,G,V,l]),totalTokens:P,totalInputTokens:z,totalOutputTokens:B,totalCacheReadTokens:W,totalCacheCreationTokens:$,isLoading:F,error:K,hasData:H.length>0||R.length>0}}(),R=(0,i.useCallback)((e,o)=>[(0,T.B4)(e),o],[]),F={inputTokens:e.colors.blue400,outputTokens:e.colors.green400,cacheReadTokens:e.colors.yellow500,cacheCreationTokens:e.colors.purple};return L?(0,b.Y)(y.lh,{}):U?(0,b.Y)(y.nN,{}):(0,b.FD)(y.h,{componentId:"mlflow.charts.trace_token_usage",children:[(0,b.Y)(y.XQ,{icon:(0,b.Y)(a.eY,{}),title:(0,b.Y)(r.A,{id:"TLHzWu",defaultMessage:"Token Usage"}),value:(0,T.B4)(A),subtitle:(()=>{const e=[`${(0,T.B4)(N)} input`,`${(0,T.B4)(O)} output`];return D>0&&e.push(`${(0,T.B4)(D)} cache read`),E>0&&e.push(`${(0,T.B4)(E)} cache write`),`(${e.join(", ")})`})()}),(0,b.Y)("div",{css:(0,n.AH)({height:y.tz,marginTop:e.spacing.sm},""),children:H?(0,b.Y)(s.u,{width:"100%",height:"100%",children:(0,b.FD)(l.X,{data:w,margin:{top:10,right:30,left:10,bottom:0},children:[(0,b.Y)(d.W,{dataKey:"name",...o}),(0,b.Y)(c.h,{...t}
1),(0,b.Y)(u.m,{content:(0,b.Y)(y.Vn,{formatter:R,componentId:"mlflow.overview.usage.token_usage.view_traces_link",linkConfig:{experimentId:Y[0],timeIntervalSeconds:_}}),cursor:{fill:e.colors.actionTertiaryBackgroundHover},wrapperStyle:{pointerEvents:"auto"}}),(0,b.Y)(p.Gk,{type:"monotone",dataKey:"inputTokens",stackId:"1",stroke:F.inputTokens,fill:F.inputTokens,strokeOpacity:M("Input Tokens"),fillOpacity:M("Input Tokens"),strokeWidth:2,dot:(0,T.vx)(F.inputTokens),name:"Input Tokens"}),(0,b.Y)(g.N1,{type:"monotone",dataKey:"cacheReadTokens",stroke:F.cacheReadTokens,strokeWidth:2,strokeDasharray:"5 3",strokeOpacity:M("(Cache Read)"),dot:(0,T.vx)(F.cacheReadTokens),name:"(Cache Read)"}),(0,b.Y)(g.N1,{type:"monotone",dataKey:"cacheCreationTokens",stroke:F.cacheCreationTokens,strokeWidth:2,strokeDasharray:"5 3",strokeOpacity:M("(Cache Write)"),dot:(0,T.vx)(F.cacheCreationTokens),name:"(Cache Write)"}),(0,b.Y)(p.Gk,{type:"monotone",dataKey:"outputTokens",stackId:"1",stroke:F.outputTokens,fill:F.outputTokens,strokeOpacity:M("Output Tokens"),fillOpacity:M("Output Tokens"),strokeWidth:2,dot:(0,T.vx)(F.outputTokens),name:"Output Tokens"}),(0,b.Y)(m.s,{verticalAlign:"bottom",iconType:"plainline",onMouseEnter:I,onMouseLeave:C,...x})]})}):(0,b.Y)(y.iE,{})})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.