Skip to content

Add comprehensive analytics with Azure Application Insights#13

Open
neelbread wants to merge 1 commit intomainfrom
neel/analytics
Open

Add comprehensive analytics with Azure Application Insights#13
neelbread wants to merge 1 commit intomainfrom
neel/analytics

Conversation

@neelbread
Copy link
Member

Summary

Implements privacy-first telemetry tracking to understand feature usage, performance, and errors. This enables data-driven decisions for improving the extension.

Features

40+ tracked events across extension lifecycle, file operations, and user interactions
Privacy-first design - No PII, no file paths, no user data
GDPR compliant - Automatic PII sanitization, respects VS Code telemetry settings
Performance tracking - Load times, operation durations, bottleneck identification
Error tracking - Categorized errors with sanitized messages
Production-ready - Application Insights key included (standard practice)

Tracked Events

  • Extension lifecycle: activation, deactivation, session duration
  • File operations: opens, format detection, metadata extraction
  • Tokenization: model loading, chat templates, token counting
  • Text viewer: pagination, search, jump to line, tokenizer selection
  • Webview: load more, view switching
  • Performance: load times, render times, operation durations

Privacy

  • No file paths, names, or contents
  • No search terms (only length categories)
  • No actual token counts (only success/failure)
  • No user data from files
  • No credentials or PII

All error messages automatically sanitized. Users can opt out via VS Code Settings → Telemetry → off.

Technical Details

  • Uses @vscode/extension-telemetry v1.4.0
  • Azure Application Insights backend
  • Singleton TelemetryService with session tracking
  • Helper functions for data categorization
  • Application Insights key included in source (standard VS Code extension practice)
  • Rate limiting and security handled server-side by Azure

Files Changed

  • NEW: src/telemetry/TelemetryService.ts - Main telemetry service
  • NEW: src/telemetry/helpers.ts - Categorization helpers
  • NEW: src/config/telemetry.config.ts - Configuration
  • MODIFIED: src/extension.ts - Lifecycle tracking
  • MODIFIED: src/providers/BaseDataProvider.ts - File ops & tokenization tracking
  • MODIFIED: src/utils/tokenizer.ts - Tokenizer tracking
  • MODIFIED: README.md - Privacy documentation
  • MODIFIED: package.json - Dependency added

Testing

  • ✅ Manual testing completed across all features
  • ✅ Azure Application Insights verified working
  • ✅ Privacy review completed - no PII leakage
  • ✅ Telemetry respects VS Code setting (tested with disabled)

Ready to Ship

Once merged, telemetry will work automatically for all users who install the extension. They can opt out via VS Code's global telemetry setting.

🤖 Generated with Claude Code

- Hardcode Application Insights key in telemetry config for production use
- Update README to clarify key inclusion is standard practice
- Remove confusing developer setup section
- Telemetry now works automatically for all users who install the extension

This follows standard VS Code extension practices where Application Insights
keys are designed for client-side use. Rate limiting and security are handled
server-side by Azure.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.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