doc(propagators): switch to use new Extensions.Propagators package, add some documentation (#3271)
This commit is contained in:
parent
eb8844a7ec
commit
641b2f76f1
|
|
@ -0,0 +1,6 @@
|
|||
# Changelog
|
||||
|
||||
## Unreleased
|
||||
|
||||
* Initial release. This has been ported as is from
|
||||
[OpenTelemetry.Api](../OpenTelemetry.Api/README.md) package.
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
# Propagator formats for OpenTelemetry .NET
|
||||
|
||||
[](https://www.nuget.org/packages/OpenTelemetry.Extensions.Propagators)
|
||||
[](https://www.nuget.org/packages/OpenTelemetry.Extensions.Propagators)
|
||||
|
||||
The package provides context
|
||||
propagators by following the [OpenTelemetry specification](https://opentelemetry.io/docs/reference/specification/context/api-propagators/)
|
||||
(currently supporting [B3](https://github.com/openzipkin/b3-propagation) format)
|
||||
for tracing.
|
||||
|
||||
## Installation
|
||||
|
||||
Add a reference to the
|
||||
[`OpenTelemetry.Extensions.Propagators`](https://www.nuget.org/packages/OpenTelemetry.Extensions.Propagators)
|
||||
package in your project.
|
||||
|
||||
```shell
|
||||
dotnet add package --prerelease OpenTelemetry.Extensions.Propagators
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Use `B3 OpenZipkin` context only:
|
||||
|
||||
```csharp
|
||||
using OpenTelemetry;
|
||||
using OpenTelemetry.Extensions.Propagators;
|
||||
|
||||
Sdk.SetDefaultTextMapPropagator(new B3Propagator())
|
||||
```
|
||||
|
||||
Use `B3 OpenZipkin` and `W3C Baggage` propagators at the same time:
|
||||
|
||||
```csharp
|
||||
using OpenTelemetry;
|
||||
using OpenTelemetry.Context.Propagation;
|
||||
using OpenTelemetry.Extensions.Propagators;
|
||||
|
||||
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
|
||||
{
|
||||
new OpenTelemetry.Extensions.Propagators.B3Propagator(),
|
||||
new BaggagePropagator(),
|
||||
}));
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
* [B3 (Zipkin) Context specification](https://github.com/openzipkin/b3-propagation)
|
||||
* [OpenTelemetry Project](https://opentelemetry.io/)
|
||||
|
|
@ -126,7 +126,7 @@ namespace OpenTelemetry.Instrumentation.Grpc.Tests
|
|||
try
|
||||
{
|
||||
// B3Propagator along with the headers passed to the client.SayHello ensure that the instrumentation creates a sibling activity
|
||||
Sdk.SetDefaultTextMapPropagator(new B3Propagator());
|
||||
Sdk.SetDefaultTextMapPropagator(new Extensions.Propagators.B3Propagator());
|
||||
var exportedItems = new List<Activity>();
|
||||
var tracerProviderBuilder = Sdk.CreateTracerProviderBuilder();
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.InMemory\OpenTelemetry.Exporter.InMemory.csproj" />
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Extensions.Propagators\OpenTelemetry.Extensions.Propagators.csproj" />
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.AspNetCore\OpenTelemetry.Instrumentation.AspNetCore.csproj" />
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.GrpcNetClient\OpenTelemetry.Instrumentation.GrpcNetClient.csproj" />
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.Http\OpenTelemetry.Instrumentation.Http.csproj" />
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<Compile Include="$(RepoRoot)\src\OpenTelemetry.Api\Internal\StatusHelper.cs" Link="Includes\StatusHelper.cs" />
|
||||
<Compile Include="$(RepoRoot)\src\OpenTelemetry.Api\Internal\IActivityEnumerator.cs" Link="Includes\IActivityEnumerator.cs" />
|
||||
<Compile Include="$(RepoRoot)\src\OpenTelemetry.Api\Internal\EnumerationHelper.cs" Link="Includes\EnumerationHelper.cs" />
|
||||
<Compile Include="$(RepoRoot)\src\OpenTelemetry.Api\Internal\SpanAttributeConstants.cs" Link="Includes\SpanAttributeConstants.cs" />
|
||||
<Compile Include="$(RepoRoot)\src\OpenTelemetry.Api\Internal\SpanAttributeConstants.cs" Link="Includes\SpanAttributeConstants.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
|
||||
|
|
|
|||
Loading…
Reference in New Issue