import{Hy as e,Ly as t,Pg as n,ap as r,ci as i,m_ as a,rn as o}from"./index-DDwwBb9e.js";import{t as s}from"./WithPermissionGuard-wX0IC3VF.js";import{t as c}from"./GraphsLayout-BFwwNvoA.js";import{t as l}from"./ChartCard--IvNBX_6.js";var u=e(),d=1440,f={graphId:`llmMetricsSummary`,graphType:`summary`,series:[{name:`LLM Calls`,metric:`metadata.trace_id`,aggregation:`cardinality`,colorSet:`colors`},{name:`Total cost`,colorSet:`greenTones`,metric:`performance.total_cost`,aggregation:`sum`},{name:`Total tokens`,colorSet:`purpleTones`,metric:`performance.total_tokens`,aggregation:`sum`}],includePrevious:!0,timeScale:d,height:300},p={graphId:`llmPerformanceSummary`,graphType:`summary`,series:[{name:`Average tokens per message`,colorSet:`colors`,metric:`performance.total_tokens`,aggregation:`avg`},{name:`Average cost per message`,colorSet:`greenTones`,metric:`performance.total_cost`,aggregation:`avg`},{name:`90th Percentile time to first token`,colorSet:`cyanTones`,metric:`performance.first_token`,aggregation:`p90`},{name:`90th Percentile completion time`,colorSet:`greenTones`,metric:`performance.completion_time`,aggregation:`p90`}],includePrevious:!0,timeScale:d,height:300},m={graphId:`llmCallsByModel`,graphType:`area`,series:[{name:`LLM Calls`,colorSet:`colors`,metric:`metadata.trace_id`,aggregation:`cardinality`}],groupBy:`metadata.model`,includePrevious:!1,timeScale:d,height:300},h={graphId:`llmSplitByModel`,graphType:`donnut`,series:[{name:`LLM Calls`,colorSet:`colors`,metric:`metadata.span_type`,aggregation:`cardinality`,key:`llm`}],groupBy:`metadata.model`,includePrevious:!1,timeScale:d,height:300},g={graphId:`avgCompletionTimeByModel`,graphType:`horizontal_bar`,series:[{name:`Completion time average`,colorSet:`colors`,metric:`performance.completion_time`,aggregation:`avg`}],groupBy:`metadata.model`,includePrevious:!1,timeScale:`full`,height:300},_={graphId:`avgCostPerModel`,graphType:`horizontal_bar`,series:[{name:`Average cost per message`,colorSet:`colors`,metric:`performance.total_cost`,aggregation:`avg`,pipeline:{field:`trace_id`,aggregation:`avg`}}],groupBy:`metadata.model`,includePrevious:!1,timeScale:`full`,height:300},v={graphId:`avgTokensPerModel`,graphType:`horizontal_bar`,series:[{name:`Average completion tokens per message`,colorSet:`colors`,metric:`performance.completion_tokens`,aggregation:`avg`,pipeline:{field:`trace_id`,aggregation:`avg`}}],groupBy:`metadata.model`,includePrevious:!1,timeScale:`full`,height:300},y={graphId:`latencyTrend`,graphType:`line`,series:[{name:`P90 Completion Time`,colorSet:`greenTones`,metric:`performance.completion_time`,aggregation:`p90`},{name:`P90 Time to First Token`,colorSet:`cyanTones`,metric:`performance.first_token`,aggregation:`p90`}],includePrevious:!1,timeScale:d,height:300},b={graphId:`tokensPerSecondByModel`,graphType:`horizontal_bar`,series:[{name:`Average tokens per second`,colorSet:`cyanTones`,metric:`performance.tokens_per_second`,aggregation:`avg`}],groupBy:`metadata.model`,includePrevious:!1,timeScale:`full`,height:300},x={graphId:`errorRateByModel`,graphType:`horizontal_bar`,series:[{name:`Traces with errors`,colorSet:`orangeTones`,metric:`metadata.trace_id`,aggregation:`cardinality`}],groupBy:`error.has_error`,includePrevious:!1,timeScale:`full`,height:300};function S(){let{hasPermission:e}=r(),s=e(`cost:view`),d={...f,series:f.series.filter(e=>s||!e.metric?.includes(`total_cost`))},S={...p,series:p.series.filter(e=>s||!e.metric?.includes(`total_cost`))};return(0,u.jsx)(c,{title:`LLM Metrics`,children:(0,u.jsxs)(a,{alignItems:`start`,gap:4,children:[(0,u.jsxs)(n,{templateColumns:`repeat(4, 1fr)`,gap:5,width:`100%`,children:[(0,u.jsx)(l,{title:`LLM Metrics`,colSpan:2,children:(0,u.jsx)(i,{input:d})}),(0,u.jsx)(l,{title:`Summary`,colSpan:2,children:(0,u.jsx)(i,{input:S})}),(0,u.jsx)(l,{title:`LLM Usage`,colSpan:4,children:(0,u.jsx)(i,{input:m})}),(0,u.jsx)(l,{title:`LLM Split`,colSpan:2,children:(0,u.jsx)(i,{input:h})}),(0,u.jsx)(l,{title:`Average Completion Time`,colSpan:2,children:(0,u.jsx)(i,{input:g})}),s&&(0,u.jsx)(l,{title:`Average Cost Per Message`,colSpan:2,children:(0,u.jsx)(i,{input:_})}),(0,u.jsx)(l,{title:`Average Tokens Per Message`,colSpan:2,children:(0,u.jsx)(i,{input:v})}),(0,u.jsx)(l,{title:`Latency Trend`,colSpan:4,children:(0,u.jsx)(i,{input:y})}),(0,u.jsx)(l,{title:`Tokens Per Second`,colSpan:2,children:(0,u.jsx)(i,{input:b})}),(0,u.jsx)(l,{title:`Error Distribution`,colSpan:2,children:(0,u.jsx)(i,{input:x})})]}),(0,u.jsx)(t,{padding:3,children:(0,u.jsx)(o,{hideTopics:!0})})]})})}var C=s(`analytics:view`)(S);export{C as default};
//# sourceMappingURL=metrics-bAUU3afL.js.map