|
51 | 51 | "type": 3, |
52 | 52 | "content": { |
53 | 53 | "version": "KqlItem/1.0", |
54 | | - "query": "customEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend input_tokens = toint(customDimensions['total_input_tokens'])\r\n| extend output_tokens = toint(customDimensions['total_output_tokens'])\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| summarize\r\n TotalDocuments = count(),\r\n TotalInputTokens = sum(input_tokens),\r\n TotalOutputTokens = sum(output_tokens),\r\n TotalTokens = sum(total_tokens),\r\n AvgTokensPerDocument = round(avg(total_tokens), 0)", |
| 54 | + "query": "customEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend process_id = tostring(customDimensions['process_id'])\r\n| extend input_tokens = toint(customDimensions['total_input_tokens'])\r\n| extend output_tokens = toint(customDimensions['total_output_tokens'])\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| summarize input_tokens=max(input_tokens), output_tokens=max(output_tokens), total_tokens=max(total_tokens) by process_id\r\n| summarize\r\n TotalDocuments = count(),\r\n TotalInputTokens = sum(input_tokens),\r\n TotalOutputTokens = sum(output_tokens),\r\n TotalTokens = sum(total_tokens),\r\n AvgTokensPerDocument = round(avg(total_tokens), 0)", |
55 | 55 | "size": 3, |
56 | 56 | "title": "Overall Token Usage Summary", |
57 | 57 | "timeContext": { |
|
76 | 76 | "type": 3, |
77 | 77 | "content": { |
78 | 78 | "version": "KqlItem/1.0", |
79 | | - "query": "customEvents\r\n| where name == 'LLM_Agent_Token_Usage'\r\n| where timestamp > ago(7d)\r\n| extend agent = tostring(customDimensions['agent_name'])\r\n| extend input_tokens = toint(customDimensions['input_tokens'])\r\n| extend output_tokens = toint(customDimensions['output_tokens'])\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| summarize\r\n InputTokens = sum(input_tokens),\r\n OutputTokens = sum(output_tokens),\r\n TotalTokens = sum(total_tokens),\r\n Invocations = count()\r\n by Step = agent\r\n| order by TotalTokens desc", |
| 79 | + "query": "customEvents\r\n| where name == 'LLM_Agent_Token_Usage'\r\n| where timestamp > ago(7d)\r\n| extend agent = tostring(customDimensions['agent_name'])\r\n| extend process_id = tostring(customDimensions['process_id'])\r\n| extend input_tokens = toint(customDimensions['input_tokens'])\r\n| extend output_tokens = toint(customDimensions['output_tokens'])\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| summarize input_tokens=max(input_tokens), output_tokens=max(output_tokens), total_tokens=max(total_tokens) by agent, process_id\r\n| summarize\r\n InputTokens = sum(input_tokens),\r\n OutputTokens = sum(output_tokens),\r\n TotalTokens = sum(total_tokens),\r\n Invocations = count()\r\n by Step = agent\r\n| order by TotalTokens desc", |
80 | 80 | "size": 0, |
81 | 81 | "title": "Token Usage by Pipeline Step", |
82 | 82 | "timeContext": { |
|
93 | 93 | "type": 3, |
94 | 94 | "content": { |
95 | 95 | "version": "KqlItem/1.0", |
96 | | - "query": "customEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend input_tokens = toint(customDimensions['total_input_tokens'])\r\n| extend output_tokens = toint(customDimensions['total_output_tokens'])\r\n| summarize InputTokens = sum(input_tokens), OutputTokens = sum(output_tokens) by bin(timestamp, 1h)\r\n| order by timestamp asc", |
| 96 | + "query": "customEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend process_id = tostring(customDimensions['process_id'])\r\n| extend input_tokens = toint(customDimensions['total_input_tokens'])\r\n| extend output_tokens = toint(customDimensions['total_output_tokens'])\r\n| summarize input_tokens=max(input_tokens), output_tokens=max(output_tokens), timestamp=min(timestamp) by process_id\r\n| summarize InputTokens = sum(input_tokens), OutputTokens = sum(output_tokens) by bin(timestamp, 1h)\r\n| order by timestamp asc", |
97 | 97 | "size": 0, |
98 | 98 | "title": "Token Usage Over Time (Hourly)", |
99 | 99 | "timeContext": { |
|
110 | 110 | "type": 3, |
111 | 111 | "content": { |
112 | 112 | "version": "KqlItem/1.0", |
113 | | - "query": "customEvents\r\n| where name == 'LLM_Agent_Token_Usage'\r\n| where timestamp > ago(7d)\r\n| extend agent = tostring(customDimensions['agent_name'])\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| summarize TotalTokens = sum(total_tokens) by agent", |
| 113 | + "query": "customEvents\r\n| where name == 'LLM_Agent_Token_Usage'\r\n| where timestamp > ago(7d)\r\n| extend agent = tostring(customDimensions['agent_name'])\r\n| extend process_id = tostring(customDimensions['process_id'])\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| summarize total_tokens=max(total_tokens) by agent, process_id\r\n| summarize TotalTokens = sum(total_tokens) by agent", |
114 | 114 | "size": 0, |
115 | 115 | "title": "Token Distribution by Agent", |
116 | 116 | "timeContext": { |
|
134 | 134 | "type": 3, |
135 | 135 | "content": { |
136 | 136 | "version": "KqlItem/1.0", |
137 | | - "query": "let input_price_per_million = 2.50;\r\nlet output_price_per_million = 10.00;\r\ncustomEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend input_tokens = toint(customDimensions['total_input_tokens'])\r\n| extend output_tokens = toint(customDimensions['total_output_tokens'])\r\n| summarize TotalInput = sum(input_tokens), TotalOutput = sum(output_tokens) by bin(timestamp, 1d)\r\n| extend InputCost = round(TotalInput * input_price_per_million / 1000000.0, 4)\r\n| extend OutputCost = round(TotalOutput * output_price_per_million / 1000000.0, 4)\r\n| extend TotalCost = InputCost + OutputCost\r\n| project Day = timestamp, TotalInput, TotalOutput, InputCost, OutputCost, TotalCost\r\n| order by Day desc", |
| 137 | + "query": "let input_price_per_million = 2.50;\r\nlet output_price_per_million = 10.00;\r\ncustomEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend process_id = tostring(customDimensions['process_id'])\r\n| extend input_tokens = toint(customDimensions['total_input_tokens'])\r\n| extend output_tokens = toint(customDimensions['total_output_tokens'])\r\n| summarize input_tokens=max(input_tokens), output_tokens=max(output_tokens), timestamp=min(timestamp) by process_id\r\n| summarize TotalInput = sum(input_tokens), TotalOutput = sum(output_tokens) by bin(timestamp, 1d)\r\n| extend InputCost = round(TotalInput * input_price_per_million / 1000000.0, 4)\r\n| extend OutputCost = round(TotalOutput * output_price_per_million / 1000000.0, 4)\r\n| extend TotalCost = InputCost + OutputCost\r\n| project Day = timestamp, TotalInput, TotalOutput, InputCost, OutputCost, TotalCost\r\n| order by Day desc", |
138 | 138 | "size": 0, |
139 | 139 | "title": "Estimated Daily Cost (GPT-4o Pricing: $2.50/1M input, $10.00/1M output)", |
140 | 140 | "timeContext": { |
|
209 | 209 | "type": 3, |
210 | 210 | "content": { |
211 | 211 | "version": "KqlItem/1.0", |
212 | | - "query": "customEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| extend process_id = tostring(customDimensions['process_id'])\r\n| extend file_name = tostring(customDimensions['file_name'])\r\n| summarize TotalTokens = sum(total_tokens) by process_id, file_name\r\n| order by TotalTokens desc\r\n| take 20", |
| 212 | + "query": "customEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| extend process_id = tostring(customDimensions['process_id'])\r\n| extend file_name = tostring(customDimensions['file_name'])\r\n| summarize TotalTokens = max(total_tokens) by process_id, file_name\r\n| order by TotalTokens desc\r\n| take 20", |
213 | 213 | "size": 0, |
214 | 214 | "title": "Top 20 Token Consumers by Document", |
215 | 215 | "timeContext": { |
|
226 | 226 | "type": 3, |
227 | 227 | "content": { |
228 | 228 | "version": "KqlItem/1.0", |
229 | | - "query": "customEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| extend input_tokens = toint(customDimensions['total_input_tokens'])\r\n| extend output_tokens = toint(customDimensions['total_output_tokens'])\r\n| extend mime_type = tostring(customDimensions['file_mime_type'])\r\n| extend file_type = case(\r\n mime_type has \"pdf\", \"PDF\",\r\n mime_type has \"image\", \"Image\",\r\n mime_type has \"word\" or mime_type has \"docx\", \"Word\",\r\n mime_type has \"excel\" or mime_type has \"xlsx\", \"Excel\",\r\n mime_type has \"text\", \"Text\",\r\n \"Other\")\r\n| summarize\r\n Documents = count(),\r\n TotalInputTokens = sum(input_tokens),\r\n TotalOutputTokens = sum(output_tokens),\r\n TotalTokens = sum(total_tokens),\r\n AvgTokensPerDoc = round(avg(total_tokens), 0)\r\n by FileType = file_type\r\n| order by TotalTokens desc", |
| 229 | + "query": "customEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend process_id = tostring(customDimensions['process_id'])\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| extend input_tokens = toint(customDimensions['total_input_tokens'])\r\n| extend output_tokens = toint(customDimensions['total_output_tokens'])\r\n| extend mime_type = tostring(customDimensions['file_mime_type'])\r\n| extend file_type = case(\r\n mime_type has \"pdf\", \"PDF\",\r\n mime_type has \"image\", \"Image\",\r\n mime_type has \"word\" or mime_type has \"docx\", \"Word\",\r\n mime_type has \"excel\" or mime_type has \"xlsx\", \"Excel\",\r\n mime_type has \"text\", \"Text\",\r\n \"Other\")\r\n| summarize input_tokens=max(input_tokens), output_tokens=max(output_tokens), total_tokens=max(total_tokens), file_type=take_any(file_type) by process_id\r\n| summarize\r\n Documents = count(),\r\n TotalInputTokens = sum(input_tokens),\r\n TotalOutputTokens = sum(output_tokens),\r\n TotalTokens = sum(total_tokens),\r\n AvgTokensPerDoc = round(avg(total_tokens), 0)\r\n by FileType = file_type\r\n| order by TotalTokens desc", |
230 | 230 | "size": 0, |
231 | 231 | "title": "Token Usage by File Type", |
232 | 232 | "timeContext": { |
|
250 | 250 | "type": 3, |
251 | 251 | "content": { |
252 | 252 | "version": "KqlItem/1.0", |
253 | | - "query": "customEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| summarize\r\n p50 = percentile(total_tokens, 50),\r\n p90 = percentile(total_tokens, 90),\r\n p95 = percentile(total_tokens, 95),\r\n p99 = percentile(total_tokens, 99),\r\n Max = max(total_tokens)", |
| 253 | + "query": "customEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend process_id = tostring(customDimensions['process_id'])\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| summarize total_tokens=max(total_tokens) by process_id\r\n| summarize\r\n p50 = percentile(total_tokens, 50),\r\n p90 = percentile(total_tokens, 90),\r\n p95 = percentile(total_tokens, 95),\r\n p99 = percentile(total_tokens, 99),\r\n Max = max(total_tokens)", |
254 | 254 | "size": 3, |
255 | 255 | "title": "Token Usage Percentiles Per Document", |
256 | 256 | "timeContext": { |
|
275 | 275 | "type": 3, |
276 | 276 | "content": { |
277 | 277 | "version": "KqlItem/1.0", |
278 | | - "query": "customEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| extend file_name = tostring(customDimensions['file_name'])\r\n| summarize\r\n DocumentsProcessed = count(),\r\n TotalTokens = sum(total_tokens),\r\n AvgTokensPerDoc = round(avg(total_tokens), 0),\r\n MaxTokensPerDoc = max(total_tokens)\r\n by Day = bin(timestamp, 1d)\r\n| order by Day desc", |
| 278 | + "query": "customEvents\r\n| where name == 'LLM_Token_Usage_Summary'\r\n| where timestamp > ago(7d)\r\n| extend process_id = tostring(customDimensions['process_id'])\r\n| extend total_tokens = toint(customDimensions['total_tokens'])\r\n| summarize total_tokens=max(total_tokens), timestamp=min(timestamp) by process_id\r\n| summarize\r\n DocumentsProcessed = count(),\r\n TotalTokens = sum(total_tokens),\r\n AvgTokensPerDoc = round(avg(total_tokens), 0),\r\n MaxTokensPerDoc = max(total_tokens)\r\n by Day = bin(timestamp, 1d)\r\n| order by Day desc", |
279 | 279 | "size": 0, |
280 | 280 | "title": "Daily Processing Volume with Token Usage", |
281 | 281 | "timeContext": { |
|
0 commit comments