@@ -93,6 +93,11 @@ the library they instrument, and steps for enabling them.
9393 client] ( ../../../src/OpenTelemetry.Instrumentation.StackExchangeRedis/README.md )
9494* [ SQL client] ( ../../../src/OpenTelemetry.Instrumentation.SqlClient/README.md )
9595
96+ More community contributed instrumentations are available in [ OpenTelemetry .NET
97+ Contrib] ( https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src ) .
98+ If you are writing an instrumentation library yourself, use the following
99+ guidelines.
100+
96101### Writing own instrumentation library
97102
98103This section describes the steps required to write your own instrumentation
@@ -158,20 +163,29 @@ Writing an instrumentation library typically involves 3 steps.
158163 the instrumented library must be documented so that end users can enable
159164 it using ` AddSource ` method on ` TracerProviderBuilder ` .
160165
161- There is a special case for libraries which are already instrumented with
166+ ### Special case : Instrumentation for libraries producing legacy Activity
167+
168+ There is a special case for libraries which are already instrumented to produce
162169[ Activity] ( https://github.com/dotnet/runtime/blob/master/src/libraries/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md ) ,
163170but using the
164171[ DiagnosticSource] ( https://github.com/dotnet/runtime/blob/master/src/libraries/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md )
165- method. These libraries already emit activities, but it may not conform to the
166- OpenTelemetry semantic conventions. Also, as these libraries do not use
167- ActivitySource to create Activity, they cannot be simply subscribed to. In such
168- cases, the instrumentation library should subscribe to the DiagnosticSource
169- events from the instrumented library, and in turn produce * new* activity using
170- ActivitySource. This new activity must be created as a sibling of the activity
171- already produced by the library. i.e the new activity must have the same parent
172- as the original activity. Some common examples of such libraries include
173- Asp.Net, Asp.Net Core, HttpClient (.NET Core). Instrumentation libraries for
174- these are already provided in this repo.
172+ method. These are referred to as "legacy Activity" in this repo. These libraries
173+ already create activities but they do so by using the ` Activity ` constructor
174+ directly, rather than using ` ActivitySource.StartActivity ` method. These
175+ activities does not by default runs though the samplers, and will have their
176+ ` Kind ` set to internal and they'll have empty ActivitySource name associated
177+ with it.
178+
179+ Some common examples of such libraries include ASP.NET, ASP.NET Core, HttpClient
180+ (.NET Core). Instrumentation libraries for these are already provided in this
181+ repo. The OpenTelemetry .NET Contrib Repo also has instrumentations for
182+ libraries like
183+ [ ElasticSearch] ( https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Contrib.Instrumentation.Elasticsearch ) ,
184+ [ EntityFramework] ( https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore )
185+ etc. which fall in this category.
186+
187+ If you are writing instrumentation for such library, it is recommended to refer
188+ to one of the above as a reference.
175189
176190## Processor
177191
0 commit comments