-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Diagnostics.Tracing
Description
Background and motivation
OpenTelemetry recently added and stabilized adding links after span creation.
See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#link for the details.
This is useful:
- for messaging/event processing scenarios - when messages are pulled from the messaging system, the trace-context they carry is not known until messages are received
- associating phases of establishing connections and HTTP requests - see Consider adding activities for potentially long running network operations #93832 or Add client semantic conventions for socket connections open-telemetry/semantic-conventions#756 for the context
API Proposal
Add Activity.AddLink(ActivityLink link) API
API Usage
using var activity = Source.StartActivity("Receive");
var messages = await ReceiveInternal(maxBtchSize);
foreach (var ctx in ExtractTraceContext(messages))
{
activity.AddLink(new ActivityLink(ctx)); // this is new
}Alternative Designs
No response
Risks
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Diagnostics.Tracing