Skip to content

[API Proposal]: Allow adding links after activity creation #101146

@lmolkova

Description

@lmolkova

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:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions