Skip to content

feat(context): add automatic solution and project context enrichment #11

@CalvinAllen

Description

@CalvinAllen

Summary

Automatically capture and attach Visual Studio solution/project context to all telemetry. This enriches spans, metrics, and logs with valuable workspace information without manual instrumentation.

Context to Capture

Solution Context

  • vs.solution.name - Solution file name
  • vs.solution.path - Full path (consider privacy)
  • vs.solution.projects.count - Number of projects
  • vs.solution.guid - Solution GUID for correlation

Project Context (when applicable)

  • vs.project.name - Active/relevant project name
  • vs.project.type - Project type GUID or friendly name
  • vs.project.language - Primary language (C#, VB, F#, etc.)
  • vs.project.framework - Target framework

IDE Context

  • vs.version - Visual Studio version
  • vs.edition - Community/Professional/Enterprise
  • vs.theme - Current theme (Light/Dark/Blue)

Proposed API

// Enable in configuration
var config = new TelemetryConfiguration
{
    IncludeVisualStudioContext = true,  // Already exists
    IncludeSolutionContext = true,      // New
    IncludeProjectContext = true,       // New
    SolutionContextRefreshInterval = TimeSpan.FromSeconds(30)
};

// Or manually refresh context
VsixTelemetry.RefreshWorkspaceContext();

// Access current context
var context = VsixTelemetry.WorkspaceContext;
Console.WriteLine(context.SolutionName);

Implementation Notes

  • Cache context and refresh periodically (solutions don't change often)
  • Subscribe to solution/project events for updates
  • Consider privacy: option to hash paths instead of full paths
  • Handle "no solution open" gracefully

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions