Skip to content

AddLink to CurrentTransaction #2477

Open
@javiaa

Description

@javiaa

Hi,

We would like to add an span link to the current transaction so the root span has a link to another transaction.
We have not find a good way of doing so.
We have seen that the CurrentTransaction has a inaccessible 'Links' property with a list of links.
In fact using reflection we have been able to add a link, but of course this is not a solution for production.

var links = Agent.Tracer.CurrentTransaction.GetType().GetProperty("Links");
links?.SetValue(Agent.Tracer.CurrentTransaction, new List<SpanLink>
  { new (parentContext.SpanId.ToString(), parentContext.TraceId.ToString()) });

For the moment we are relying on capturing a child span and we are adding the link there, but we would like to have an AddLink function on the CurrentTransaciton to be able to add the link from there.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions