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

Passing instrumentation library name and version information to exporters starting .NET7.0

Open vishweshbankwar opened this issue 3 years ago • 5 comments

Starting .NET7.0 ASP.NET Core and HttpClient libraries will create activities using ActivitySource. However, utilizing this feature will result in loss of information about the instrumentation library and version on the ActivitySource of exported activities as that is currently being done in instrumentation library ASP.NET Core and HttpClient. We will need a mechanism to send the instrumentation library and version information to exporter.

Opening this issue for discussing alternatives/solutions.

vishweshbankwar avatar Jul 13 '22 18:07 vishweshbankwar

@vishweshbankwar I'm not totally following.

.NET7 Activity (AspNetCore) should be started through a source:

https://github.com/dotnet/aspnetcore/blob/bf3352f2422bf16fa3ca49021f0e31961ce525eb/src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs#L327-L342

What will happen in that case is Activity.Source will be set automatically:

https://github.com/dotnet/runtime/blob/28c56feae2f80231a30e4942f339b5b2f1c20062/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs#L1078

So these spans should always have Source.Name available but may be missing Source.Version. Is that what you meant?

CodeBlanch avatar Jul 19 '22 23:07 CodeBlanch

@CodeBlanch - Currently, we attach ActivitySource to the activity in instrumentation library. The name and version on ActivitySource matches the name and version of instrumentation library as per spec. However, in .NET7.0 onwards we will not continue to do so and the ActivitySource information on activities updated by instrumentation library will not have any information about them.

@alanwest also brought up a point about schema_url which we will need to think about on how we will handle that in .NET.

Have updated the issue to clarify further.

vishweshbankwar avatar Jul 20 '22 16:07 vishweshbankwar

Since HttpClient creates the activity, their name will appear as the name and version. OTel instrumentation library "enriches" it. Users can further enrich it.. Collector can enrich more...

cijothomas avatar Jul 20 '22 22:07 cijothomas

Since HttpClient creates the activity, their name will appear as the name and version. OTel instrumentation library "enriches" it.

I'd characterize the OTel instrumentation as more than just "enriching" it. It's the component that conforms the activity with the HTTP semantic conventions. From this standpoint, it's the name, version, and ultimately schema url provided by the instrumentation library that is more interesting. Albeit maybe not very interesting yet today.

In the long run, my understanding is that the schema url will enable backends to translate between different schema versions. Of course, without a stable schema this issue is not exactly pressing today.

The reason I think we should keep this issue open is that we should consider how we plan to support schema url if it will always be the instrumentation libraries from this repo that control the schema used.

alanwest avatar Jul 20 '22 22:07 alanwest

Yea I agree this is an issue. If a user changes some of the tags themselves, then the "schema_url" could no longer be valid. So anyone modifying a span, should be allowed to update the schema_url/name/version ?

cijothomas avatar Jul 20 '22 22:07 cijothomas