Skip to content

Commit 6f04561

Browse files
authored
Merge branch 'main' into alanwest/otlp-user-agent
2 parents 9719f2a + 074c019 commit 6f04561

10 files changed

Lines changed: 99 additions & 49 deletions

File tree

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ of Windows.
5959
* Visual Studio 2022+ or Visual Studio Code
6060
* .NET Framework 4.6.2+
6161

62-
**Note:** : Visual Studio 2022 preview is **recommended** due to projects
63-
targeting `.net7.0` which is in preview currently.
62+
> **Note**
63+
> Visual Studio 2022 preview is **recommended** due to projects needing
64+
to target .NET preview versions.
6465

6566
### Public API
6667

docs/metrics/customizing-the-sdk/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ using var meterProvider = Sdk.CreateMeterProviderBuilder()
101101

102102
See [Program.cs](./Program.cs) for complete example.
103103

104-
**Note:** A common mistake while configuring `MeterProvider` is forgetting to
104+
> **Note**
105+
> A common mistake while configuring `MeterProvider` is forgetting to
105106
add the required `Meter`s to the provider. It is recommended to leverage the
106107
wildcard subscription model where it makes sense. For example, if your
107108
application is expecting to enable instruments from a number of libraries from a
@@ -276,7 +277,8 @@ default boundaries. This requires the use of
276277
})
277278
```
278279

279-
**Note:** The SDK currently does not support any changes to `Aggregation` type
280+
> **Note**
281+
> The SDK currently does not support any changes to `Aggregation` type
280282
by using Views.
281283

282284
See [Program.cs](./Program.cs) for a complete example.
@@ -329,7 +331,8 @@ ignored. The SDK chooses the key/value combinations in the order in which they
329331
are emitted. `SetMaxMetricPointsPerMetricStream` can be used to override the
330332
default.
331333

332-
**Note:**: One `MetricPoint` is reserved for every `MetricStream` for the
334+
> **Note**
335+
> One `MetricPoint` is reserved for every `MetricStream` for the
333336
special case where there is no key/value pair associated with the metric. The
334337
maximum number of `MetricPoint`s has to accommodate for this special case.
335338

@@ -395,7 +398,8 @@ AnotherFruitCounter.Add(5, new("name", "banana"), new("color", "yellow")); // Ex
395398
AnotherFruitCounter.Add(4, new("name", "mango"), new("color", "yellow")); // Not exported
396399
```
397400

398-
**Note:** The above limit is *per* metric stream, and applies to all the metric
401+
> **Note**
402+
> The above limit is *per* metric stream, and applies to all the metric
399403
streams. There is no ability to apply different limits for each instrument at
400404
this moment.
401405

docs/trace/customizing-the-sdk/README.md

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
4344
extension automatically starts and stops the `TracerProvider` with the host.
4445

@@ -51,7 +52,8 @@ required.
5152
Call `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

5759
In most cases a single `TracerProvider` is created at the application startup,
@@ -127,7 +129,8 @@ var tracerProvider = Sdk.CreateTracerProviderBuilder()
127129

128130
See [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
132135
wild card subscription model where it makes sense. For example, if your
133136
application is expecting to enable tracing from a number of libraries from a
@@ -171,7 +174,8 @@ processor classes `SimpleExportProcessor` & `BatchExportProcessor` are provided
171174
to support invoking exporters through the processor pipeline and implement the
172175
standard 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()
193197
tracerProvider.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
198203
added before an enrichment processor the exported data will not contain anything
199204
added 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
203209
registered processors when it is shutting down and call the `Dispose` method on
204210
all 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&lt;T&gt;](../../../src/OpenTelemetry/CompositeProcessor.cs)
238245
is used by the SDK to chain multiple processors together and may be used as
239246
needed 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

245252
Follow [this](../extending-the-sdk/README.md#processor) document to learn about
246253
writing 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

374382
The SDK implementation of `TracerProviderBuilder` is backed by an
@@ -412,13 +420,15 @@ When using the `Sdk.CreateTracerProviderBuilder` method the `TracerProvider`
412420
owns its own `IServiceCollection`. It will only be able to see services
413421
registered 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)
417426
for 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)
423433
or using the [.NET Generic
424434
Host](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
447457
and the host will automatically shutdown and dispose the `TracerProvider` when
448458
it 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

488511
The OpenTelemetry .NET SDK integrates with the standard
@@ -546,7 +569,8 @@ variables users may also manage these settings via the command-line,
546569
configuration files, or any other source registered with the .NET configuration
547570
engine. 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
551575
environment 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

docs/trace/extending-the-sdk/README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ guidelines.
124124
This section describes the steps required to write a custom instrumentation
125125
library.
126126

127-
**Note:** If you are writing a new library or modifying an existing library the
127+
> **Note**
128+
> If you are writing a new library or modifying an existing library the
128129
recommendation is to use the [ActivitySource API/OpenTelemetry
129130
API](../../../src/OpenTelemetry.Api/README.md#introduction-to-opentelemetry-net-tracing-api)
130131
to emit activity/span instances directly. If a library is instrumented using the
@@ -204,8 +205,11 @@ Writing an instrumentation library typically involves 3 steps.
204205
* If an extension is not provided, then the name of the `ActivitySource`
205206
used by the instrumented library must be documented so that end users
206207
can enable it by calling `AddSource` on the `TracerProviderBuilder`
207-
being configured. **Note:** Changing the name of the source should be
208-
considered a breaking change.
208+
being configured.
209+
210+
> **Note**
211+
> Changing the name of the source should be considered a
212+
breaking change.
209213

210214
### Special case : Instrumentation for libraries producing legacy Activity
211215

@@ -354,15 +358,17 @@ A demo ResourceDetector is shown [here](./MyResourceDetector.cs).
354358

355359
## Registration extension method guidance for library authors
356360

357-
**Note:** This information applies to the OpenTelemetry SDK version 1.4.0 and
361+
> **Note**
362+
> This information applies to the OpenTelemetry SDK version 1.4.0 and
358363
newer only.
359364

360365
Library authors are encouraged to provide extension methods users may call to
361366
register custom OpenTelemetry components into their `TracerProvider`s. These
362367
extension methods can target either the `TracerProviderBuilder` or the
363368
`IServiceCollection` classes. Both of these patterns are described below.
364369

365-
**Note:** Libraries providing SDK plugins such as exporters, resource detectors,
370+
> **Note**
371+
> Libraries providing SDK plugins such as exporters, resource detectors,
366372
and/or samplers should take a dependency on the [OpenTelemetry SDK
367373
package](https://www.nuget.org/packages/opentelemetry). Library authors
368374
providing instrumentation should take a dependency on `OpenTelemetry.Api` or
@@ -397,7 +403,8 @@ When providing registration extensions:
397403
from starting. The OpenTelemetry SDK is allowed to crash if it cannot be
398404
started. It **MUST NOT** crash once running.
399405

400-
**Note:** The SDK implementation of `TracerProviderBuilder` ensures that the
406+
> **Note**
407+
> The SDK implementation of `TracerProviderBuilder` ensures that the
401408
[.NET
402409
Configuration](https://learn.microsoft.com/en-us/dotnet/core/extensions/configuration)
403410
engine is always available by creating a root `IConfiguration` from environment
@@ -625,7 +632,8 @@ single `AddMyLibrary` extension to configure the library itself and optionally
625632
turn on OpenTelemetry integration for multiple signals (tracing & metrics in
626633
this case).
627634

628-
**Note:** `ConfigureOpenTelemetryTracerProvider` and
635+
> **Note**
636+
> `ConfigureOpenTelemetryTracerProvider` and
629637
`ConfigureOpenTelemetryMeterProvider` do not automatically start OpenTelemetry.
630638
The host is responsible for either calling `StartWithHost` in the
631639
[OpenTelemetry.Extensions.Hosting](../../../src/OpenTelemetry.Extensions.Hosting/README.md)

docs/trace/reporting-exceptions/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ It might be useful to automatically capture the unhandled exceptions, travel
142142
through the unfinished activities and export them for troubleshooting. Here goes
143143
one possible way of doing this:
144144

145-
**WARNING:** Use `AppDomain.UnhandledException` with caution. A throw in the
145+
> **Warning**
146+
> Use `AppDomain.UnhandledException` with caution. A throw in the
146147
handler puts the process into an unrecoverable state.
147148

148149
```csharp

src/OpenTelemetry.Api/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,8 @@ Windows-based .NET implementation).
488488
489489
The above requires import of the `System.Diagnostics.Metrics` namespace.
490490
491-
**Note:** It is important to note that `Meter` instances are created by
491+
> **Note**
492+
> It is important to note that `Meter` instances are created by
492493
using its constructor, and *not* by calling a `GetMeter` method on the
493494
`MeterProvider`. This is an important distinction from the [OpenTelemetry
494495
specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#get-a-meter),

src/OpenTelemetry.Exporter.Console/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
The console exporter prints data to the Console window.
77
ConsoleExporter supports exporting logs, metrics and traces.
88

9-
**Note:** this exporter is intended to be used during learning how telemetry
9+
> **Note**
10+
> This exporter is intended to be used during learning how telemetry
1011
data are created and exported. It is not recommended for any production
1112
environment.
1213

src/OpenTelemetry.Extensions.Hosting/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ Targeting `OpenTelemetry.OpenTelemetryBuilder`:
3232

3333
### Obsolete OpenTelemetry SDK pre-1.4.0 extensions
3434

35-
**Note:** The below extension methods should be called by application host code
35+
> **Note**
36+
> The below extension methods should be called by application host code
3637
only. Library authors see: [Registration extension method guidance for library
3738
authors](../../docs/trace/extending-the-sdk/README.md#registration-extension-method-guidance-for-library-authors).
38-
39-
**Note:** Multiple calls to the below extensions will **NOT** result in multiple
39+
<!-- This comment is to make sure the two notes above and below are not merged -->
40+
> **Note**
41+
> Multiple calls to the below extensions will **NOT** result in multiple
4042
providers. To establish multiple providers use the
4143
`Sdk.CreateTracerProviderBuilder()` and/or `Sdk.CreateMeterProviderBuilder()`
4244
methods. See [TracerProvider

0 commit comments

Comments
 (0)