opentelemetry-dotnet icon indicating copy to clipboard operation
opentelemetry-dotnet copied to clipboard

Add links after activity (span) creation

Open pyohannes opened this issue 1 year ago • 3 comments

Feature Request

A recent experimental addition to the OTel specification introduces a new required AddLink operation on spans, which allows adding span links after a span was created.

This addition is expected to be declared stable soon (@carlosalberto is driving this), there already exist prototypes for C++, Java, and Python. Messaging semantic conventions, which aim at stabilization this year, require this feature.

It should be decided how to make this feature available for .NET users.

Is your feature request related to a problem?

As soon as this feature is declared stable, OTel .NET will need to implement it in order to conform to the specification.

Describe the solution you'd like:

Ideally, there would be an Activity.AddLink method, similar to Activity.AddEvent or Activity.AddTag.

Describe alternatives you've considered.

A workaround would be to create a dedicated child span for each link to be added after a span was created. This is cumbersome, as it will drastically increase the number of spans in some cases and obfuscate resulting traces.

pyohannes avatar Jan 29 '24 11:01 pyohannes

Thanks @pyohannes for raising this. The actual change needs to be done in the .NET runtime repo.

@vishweshbankwar This needs to have a corresponding issue in Runtime repo for consideration in .NET 9 timeframe. Could you open that, and link back here?

cijothomas avatar Jan 29 '24 17:01 cijothomas

https://github.com/dotnet/runtime/issues/97680

vishweshbankwar avatar Jan 30 '24 00:01 vishweshbankwar

Added to 1.10 milestone, as that aligns with .NET 9 release, which already has added support for AddLink. There is probably nothing to be done in this repo except docs/tests maybe, as Links are stored inside Activity.

cijothomas avatar May 15 '24 14:05 cijothomas