feat: Add LLM token usage tracking to Application Insights#586
Draft
Prachig-Microsoft wants to merge 1 commit into
Draft
feat: Add LLM token usage tracking to Application Insights#586Prachig-Microsoft wants to merge 1 commit into
Prachig-Microsoft wants to merge 1 commit into
Conversation
Implement comprehensive token usage tracking across all LLM call sites in ContentProcessor and ContentProcessorWorkflow, following the MACAE psl-token-usage branch pattern. Changes: - Add token_usage_utils.py with extract/emit helpers for both projects - Instrument MapHandler (ContentProcessor) with per-call token events - Instrument RAI, Summarize, GapAnalysis executors (Workflow) - Add summary and per-model token events in save_handler - Add 18 KQL queries for Azure Workbook visualization - Add unit tests (18 tests) for token_usage_utils Events emitted to Application Insights: - LLM_Agent_Token_Usage: per agent/step with model, process_id - LLM_Model_Token_Usage: per model deployment aggregation - LLM_Token_Usage_Summary: per document totals Ref: User Story #43251 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement comprehensive token usage tracking across all LLM call sites in ContentProcessor and ContentProcessorWorkflow, following the MACAE psl-token-usage branch pattern.
Changes:
Events emitted to Application Insights:
Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
Verify that the following are valid
Other Information