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

Instrumentation libraries improvements

Open vishweshbankwar opened this issue 3 years ago • 3 comments

Instrumentation libraries improvements

Subscribing to DiagnosticSource events

Instrumentation libraries subscribe to the diagnostic source events by looking at event names that ends with Start, Stop, Exception etc ref. This could result in subscribing to events which we did not intend to. One such example is #3475.

Discussion: Should we match with explicit names rather than pattern matching?

Relying on Activity.Current

When the diagnostic source events are written by the respective framework libraries. Usually the activity is not part of the payload or activity itself is not started by the framework e.g. SQL instrumentation. In order to enrich/modify activities instrumentation libraries rely on Activity.Current ref which may cause issues e.g. #3490.

Action : Review any more cases like the one shown in example.

Documentation

We do not have a detailed inventory of events that the instrumentation libraries in this repo subscribes to. Having this documented for each instrumentation would help provide more clarity to users. Also, this would help us analyze and make decision on whether we need to support more events or update any existing ones.

Action: Update Readme documents for each instrumentation library with the event names it subscribes to.

Avoid reflection (ASP.NET Core)

Reflection is used to extract properties from events payload (e.g.). This was done in order to avoid nuget reference. Now that we have FrameworkReference Microsoft.AspNetCore.App, could we avoid reflection?

vishweshbankwar avatar Jul 26 '22 23:07 vishweshbankwar

@cijothomas @alanwest - let me know if I missed something or need to add more details.

vishweshbankwar avatar Jul 26 '22 23:07 vishweshbankwar

Linked issue : https://github.com/open-telemetry/opentelemetry-dotnet/issues/3373

cijothomas avatar Aug 03 '22 16:08 cijothomas

@vishweshbankwar, on the AutoInstrumentation side also for DevOps scenarios it will be great to have possibility to reconfigure all instrumentation libraries by the environmental variables.

Please check https://github.com/open-telemetry/opentelemetry-dotnet-contrib/issues/519

Kielek avatar Aug 03 '22 16:08 Kielek

@vishweshbankwar, on the AutoInstrumentation side also for DevOps scenarios it will be great to have possibility to reconfigure all instrumentation libraries by the environmental variables.

Please check open-telemetry/opentelemetry-dotnet-contrib#519

@Kielek - Could you please open a new issue to track this which can be used for discussion as well.

vishweshbankwar avatar Oct 21 '22 21:10 vishweshbankwar

@vishweshbankwar, as I know @CodeBlanch is doing a lot of changes to make as closer to this goal.

@CodeBlanch, do you need a separate task for now?

Kielek avatar Oct 24 '22 05:10 Kielek

Marking this complete. All the PRs related to this are linked above.

vishweshbankwar avatar Oct 24 '22 19:10 vishweshbankwar