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
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 namevs.solution.path- Full path (consider privacy)vs.solution.projects.count- Number of projectsvs.solution.guid- Solution GUID for correlationProject Context (when applicable)
vs.project.name- Active/relevant project namevs.project.type- Project type GUID or friendly namevs.project.language- Primary language (C#, VB, F#, etc.)vs.project.framework- Target frameworkIDE Context
vs.version- Visual Studio versionvs.edition- Community/Professional/Enterprisevs.theme- Current theme (Light/Dark/Blue)Proposed API
Implementation Notes