-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Add a simple API for managing OpenTelemetry Baggage - key-value pairs that propagate across span boundaries. Useful for correlation IDs, user sessions, and feature tracking.
Use Cases
- Track user session across all operations
- Correlate related operations with a request ID
- Tag all spans with feature flag values
- Pass context through async operations
Proposed API
// Set baggage that flows to all child spans
VsixTelemetry.SetBaggage("session.id", sessionId);
VsixTelemetry.SetBaggage("user.tier", "premium");
// Get baggage value
var sessionId = VsixTelemetry.GetBaggage("session.id");
// Get all baggage
var allBaggage = VsixTelemetry.GetAllBaggage();
// Scoped baggage (auto-removes on dispose)
using (VsixTelemetry.WithBaggage("operation.id", operationId))
{
// All spans created here will have this baggage
}
// Clear specific baggage
VsixTelemetry.RemoveBaggage("session.id");Implementation Notes
- Wrap
System.Diagnostics.BaggageAPI - Ensure baggage propagates correctly with context
- Consider adding automatic baggage-to-tag conversion option
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request