Skip to content

Commit

Permalink
doc(propagators): switch to use new Extensions.Propagators package, a…
Browse files Browse the repository at this point in the history
…dd some documentation (#3271)
  • Loading branch information
dmpe authored May 18, 2022
1 parent eb8844a commit 641b2f7
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/OpenTelemetry.Extensions.Propagators/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

## Unreleased

* Initial release. This has been ported as is from
[OpenTelemetry.Api](../OpenTelemetry.Api/README.md) package.
49 changes: 49 additions & 0 deletions src/OpenTelemetry.Extensions.Propagators/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Propagator formats for OpenTelemetry .NET

[![NuGet](https://img.shields.io/nuget/v/OpenTelemetry.Extensions.Propagators.svg)](https://www.nuget.org/packages/OpenTelemetry.Extensions.Propagators)
[![NuGet](https://img.shields.io/nuget/dt/OpenTelemetry.Extensions.Propagators.svg)](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/)
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void GrpcAspNetCoreInstrumentationAddsCorrectAttributesWhenItCreatesNewAc
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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'">
Expand Down

0 comments on commit 641b2f7

Please sign in to comment.