@@ -38,7 +38,8 @@ appBuilder.Services.AddOpenTelemetry()
3838 .StartWithHost ();
3939```
4040
41- ** Note:** The
41+ > ** Note**
42+ > The
4243[ StartWithHost] ( ../../../src/OpenTelemetry.Extensions.Hosting/README.md#extension-method-reference )
4344extension automatically starts and stops the ` TracerProvider ` with the host.
4445
@@ -51,7 +52,8 @@ required.
5152Call ` Sdk.CreateTracerProviderBuilder() ` to obtain a builder and then call
5253` Build() ` once configuration is done to retrieve the ` TracerProvider ` instance.
5354
54- ** Note:** Once built changes to ` TracerProvider ` configuration are not allowed,
55+ > ** Note**
56+ > Once built changes to ` TracerProvider ` configuration are not allowed,
5557 with the exception of adding more processors.
5658
5759In most cases a single ` TracerProvider ` is created at the application startup,
@@ -127,7 +129,8 @@ var tracerProvider = Sdk.CreateTracerProviderBuilder()
127129
128130See [ Program.cs] ( ./Program.cs ) for complete example.
129131
130- ** Note:** A common mistake while configuring ` TracerProvider ` is forgetting to
132+ > ** Note**
133+ > A common mistake while configuring ` TracerProvider ` is forgetting to
131134 add all ` ActivitySources ` to the provider. It is recommended to leverage the
132135wild card subscription model where it makes sense. For example, if your
133136application is expecting to enable tracing from a number of libraries from a
@@ -171,7 +174,8 @@ processor classes `SimpleExportProcessor` & `BatchExportProcessor` are provided
171174to support invoking exporters through the processor pipeline and implement the
172175standard behaviors prescribed by the OpenTelemetry specification.
173176
174- ** Note:** The SDK only ever invokes processors and has no direct knowledge of
177+ > ** Note**
178+ > The SDK only ever invokes processors and has no direct knowledge of
175179 any registered exporters.
176180
177181#### Processor Configuration
@@ -193,12 +197,14 @@ var tracerProvider = Sdk.CreateTracerProviderBuilder()
193197tracerProvider .AddProcessor (new MyProcessor3 ());
194198```
195199
196- ** Note:** The order of processor registration is important. Each processor added
200+ > ** Note**
201+ > The order of processor registration is important. Each processor added
197202 is invoked in order by the SDK. For example if a simple exporting processor is
198203added before an enrichment processor the exported data will not contain anything
199204added by the enrichment because it happens after the export.
200-
201- ** Note:** A ` TracerProvider ` assumes ownership of ** all** processors added to
205+ <!-- This comment is to make sure the two notes above and below are not merged -->
206+ > ** Note**
207+ > A ` TracerProvider ` assumes ownership of ** all** processors added to
202208 it. This means that the provider will call the ` Shutdown ` method on all
203209registered processors when it is shutting down and call the ` Dispose ` method on
204210all registered processors when it is disposed. If multiple providers are being
@@ -233,14 +239,15 @@ For exporting purposes, the SDK provides the following built-in processors:
233239 : This is an exporting processor which passes telemetry to the configured
234240 exporter immediately without any batching.
235241
236- ** Note:** A special processor
242+ > ** Note**
243+ > A special processor
237244[ CompositeProcessor< ; T> ; ] ( ../../../src/OpenTelemetry/CompositeProcessor.cs )
238245is used by the SDK to chain multiple processors together and may be used as
239246needed by users to define sub-pipelines.
240-
241- ** Note: ** The processors shipped from this SDK are generic implementations and
242- support tracing and logging by implementing ` Activity ` and ` LogRecord `
243- respectively.
247+ <!-- This comment is to make sure the two notes above and below are not merged -->
248+ > ** Note**
249+ > The processors shipped from this SDK are generic implementations and support
250+ tracing and logging by implementing ` Activity ` and ` LogRecord ` respectively.
244251
245252Follow [ this] ( ../extending-the-sdk/README.md#processor ) document to learn about
246253writing custom processors.
@@ -368,7 +375,8 @@ Sdk.SetDefaultTextMapPropagator(new MyCustomPropagator());
368375
369376## Dependency injection support
370377
371- ** Note:** This information applies to the OpenTelemetry SDK version 1.4.0 and
378+ > ** Note**
379+ > This information applies to the OpenTelemetry SDK version 1.4.0 and
372380 newer only.
373381
374382The SDK implementation of ` TracerProviderBuilder ` is backed by an
@@ -412,13 +420,15 @@ When using the `Sdk.CreateTracerProviderBuilder` method the `TracerProvider`
412420owns its own ` IServiceCollection ` . It will only be able to see services
413421registered into that collection.
414422
415- ** Note:** It is important to correctly manage the lifecycle of the
423+ > ** Note**
424+ > It is important to correctly manage the lifecycle of the
416425` TracerProvider ` . See [ Building a TracerProvider] ( #building-a-tracerprovider )
417426for details.
418427
419428#### Using the OpenTelemetry.Extensions.Hosting package
420429
421- ** Note:** If you are authoring an [ ASP.NET Core
430+ > ** Note**
431+ > If you are authoring an [ ASP.NET Core
422432 application] ( https://learn.microsoft.com/aspnet/core/fundamentals/host/web-host )
423433or using the [ .NET Generic
424434Host] ( https://learn.microsoft.com/dotnet/core/extensions/generic-host ) the
@@ -447,7 +457,8 @@ which is used to automatically start the `TracerProvider` when the host starts
447457and the host will automatically shutdown and dispose the ` TracerProvider ` when
448458it is shutdown.
449459
450- ** Note:** Multiple calls to ` WithTracing ` will configure the same
460+ > ** Note**
461+ > Multiple calls to ` WithTracing ` will configure the same
451462` TracerProvider ` . Only a single ` TraceProvider ` may exist in an
452463` IServiceCollection ` \ ` IServiceProvider ` .
453464
@@ -469,9 +480,11 @@ it is shutdown.
469480 factory function to create the processor instance.
470481
471482* ` ConfigureServices ` : Registers a callback function for configuring the
472- ` IServiceCollection ` used by the ` TracerProviderBuilder ` . ** Note:**
473- ` ConfigureServices ` may only be called before the ` IServiceProvider ` has been
474- created after which point services can no longer be added.
483+ ` IServiceCollection ` used by the ` TracerProviderBuilder ` .
484+
485+ > ** Note**
486+ > ` ConfigureServices ` may only be called before the ` IServiceProvider `
487+ has been created after which point services can no longer be added.
475488
476489* ` SetSampler<T> ` : Register type ` T ` (must derive from ` Sampler ` ) as the sampler
477490 for the ` TracerProvider ` .
@@ -480,9 +493,19 @@ it is shutdown.
480493 implementationFactory)` : Adds a sampler into the ` TracerProvider` using a
481494 factory function to create the sampler instance.
482495
496+ > ** Note**
497+ > The factory functions accepting ` IServiceProvider ` may always be used
498+ regardless of how the SDK is initialized. When using an external service
499+ collection (ex: ` appBuilder.Services.AddOpenTelemetry() ` ), as is common in
500+ ASP.NET Core hosts, the ` IServiceProvider ` will be the instance shared and
501+ managed by the host. When using "Sdk.Create" functions, as is common in .NET
502+ Framework hosts, the provider creates its own ` IServiceCollection ` and will
503+ build an ` IServiceProvider ` from it to make available to extensions.
504+
483505## Configuration files and environment variables
484506
485- ** Note:** This information applies to the OpenTelemetry SDK version 1.4.0 and
507+ > ** Note**
508+ > This information applies to the OpenTelemetry SDK version 1.4.0 and
486509 newer only.
487510
488511The OpenTelemetry .NET SDK integrates with the standard
@@ -546,7 +569,8 @@ variables users may also manage these settings via the command-line,
546569configuration files, or any other source registered with the .NET configuration
547570engine. This provides greater flexibility than what the specification defines.
548571
549- ** Note:** Not all of the environment variables defined in the specification are
572+ > ** Note**
573+ > Not all of the environment variables defined in the specification are
550574 supported. Consult the individual project README files for details on specific
551575environment variable support.
552576
@@ -580,7 +604,8 @@ environment variables.
580604 dotnet run --OTEL_SERVICE_NAME " MyService"
581605 ```
582606
583- ** Note:** The [ .NET
607+ > ** Note**
608+ > The [ .NET
584609 Configuration] ( https://learn.microsoft.com/dotnet/core/extensions/configuration )
585610 pattern is hierarchical meaning the order of registered configuration sources
586611 controls which value will seen by the SDK when it is defined in multiple
0 commit comments