Skip to content

Commit cfcf820

Browse files
committed
update
1 parent 98a2a2c commit cfcf820

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

_posts/2024-12-27-trace-baggage-context-propagation-open-telementry.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Do not use `Activity.Baggage` to read or modify baggage. Instead, use `Baggage.C
4040

4141
This ensures that `baggage context` is managed consistently with the OpenTelemetry specifications.
4242

43-
> Tmportant: This header values are transferred in plaintext. Avoid placing sensitive or personally identifiable information in baggage context.
43+
> Important: These header values are transferred in plaintext to outgoing HTTP requestsinternal, third parties, etc. Avoid placing sensitive or personally identifiable information in the baggage context.
4444

4545
# .NET Usage
4646

@@ -50,12 +50,10 @@ Tracing configuration registers `TraceContextPropagator` and `BaggageContextProp
5050
```csharp
5151
builder.Services.AddOpenTelemetry()
5252
.UseOtlpExporter()
53-
.WithTracing(tracing =>
54-
{
55-
tracing
56-
.SetResourceBuilder(ResourceBuilder.CreateDefault()
57-
.AddService(builder.Environment.ApplicationName));
58-
});
53+
.ConfigureResource(configure => {
54+
configure.AddService(builder.Environment.ApplicationName)
55+
})
56+
.WithTracing();
5957
```
6058

6159
These propagators enable extracting `traceparent` and `baggage` headers format from incoming requests and injecting them into outgoing requests.
@@ -82,11 +80,12 @@ Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(
8280
```csharp
8381
builder.Services.AddOpenTelemetry()
8482
.UseOtlpExporter()
83+
.ConfigureResource(configure => {
84+
configure.AddService(builder.Environment.ApplicationName)
85+
})
8586
.WithTracing(tracing =>
8687
{
8788
tracing
88-
.SetResourceBuilder(ResourceBuilder.CreateDefault()
89-
.AddService(builder.Environment.ApplicationName));
9089
.AddAspNetCoreInstrumentation()
9190
.AddHttpClientInstrumentation();
9291
});

0 commit comments

Comments
 (0)