Skip to content

feat: token usage tracking implementation#257

Open
Priyanka-Microsoft wants to merge 5 commits into
psl-sw/37816-app-insights-telemetryfrom
psl-pri/token-usage-cm
Open

feat: token usage tracking implementation#257
Priyanka-Microsoft wants to merge 5 commits into
psl-sw/37816-app-insights-telemetryfrom
psl-pri/token-usage-cm

Conversation

@Priyanka-Microsoft
Copy link
Copy Markdown
Contributor

Purpose

  • ...
    This pull request introduces a complete solution for visualizing and monitoring LLM token usage in Azure Application Insights. It adds deployment automation, KQL queries for analytics, and a comprehensive Azure Workbook dashboard for both GKE and EKS environments.

LLM Token Usage Dashboard Solution:

Deployment Automation:

  • Added the deploy-workbooks.ps1 PowerShell script to automate deployment of LLM token usage dashboards for both GKE and EKS clusters. The script uploads the corresponding workbook JSON content to Azure using the provided resource group and Application Insights resource ID.

Analytics and Visualization:

  • Added token-usage-queries.kql, a library of KQL queries for Application Insights/Log Analytics, enabling detailed analysis of token usage by agent, model, workflow step, user, and time trends, as well as cost estimation.
  • Introduced workbook-eks-content.json, a ready-to-deploy Azure Workbook dashboard for EKS, featuring summary tiles, tables, charts, and cost estimation, all parameterized by time range.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify that the following are valid

  • ...

Other Information

Priyanka-Microsoft and others added 3 commits May 27, 2026 17:45
…ersion and remove deployment/workbook changes

- Updated llm_token_telemetry.py (processor + backend-api) to match
  Ajit's latest from customer-chatbot PR #236 (adds perf counters,
  emit timing, slow-emit warnings, batch overhead tracking)
- Removed workbook/dashboard files (deploy-workbooks.ps1, KQL queries,
  workbook JSON files, tokenUsageWorkbook.bicep)
- Reverted infra changes (main.bicep, main_custom.bicep, main.parameters.json)
- Reverted Dockerfile changes (frontend, processor)
- Removed test file (test_llm_token_telemetry.py)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The lockfile was missing the azure-monitor-events-extension and
azure-monitor-opentelemetry packages, causing uv sync --frozen in
Docker to skip them. This made the emitter silently disabled.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant