Skip to content

baggage docs #4609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,44 @@ If you decide to generate trace headers yourself, there are three ways this can

Read [the trace context overview]({{< ref w3c-tracing-overview >}}) for more background and examples on W3C trace context and headers.

### Baggage Support

Dapr supports propagating W3C Baggage alongside trace context. For details on the W3C Baggage specification, format, and how it works, see the [W3C Trace Context Overview]({{< ref "w3c-tracing-overview.md#w3c-baggage" >}}).

#### Using Baggage with Dapr

You can add baggage from your application by setting the appropriate HTTP header or gRPC metadata when calling Dapr. Dapr automatically propagates this baggage across subsequent service calls.

**Setting Baggage**

Set the `baggage` header (HTTP) or metadata (gRPC) in your requests to Dapr:
- For HTTP: Add the `baggage` header to your request.
- For gRPC: Add `baggage` key-value pairs to the outgoing context metadata.

*HTTP Example:*
```http
POST /v1.0/invoke/serviceB/method/hello HTTP/1.1
Content-Type: application/json
baggage: key1=value1,key2=value2

{
"message": "Hello service B"
}
```

*gRPC Example (Go):*
```go
ctx = grpcMetadata.AppendToOutgoingContext(ctx,
"baggage", "key1=value1,key2=value2",
)
```

#### Common Use Cases

Baggage is useful for:
- Propagating user IDs or correlation IDs across services
- Passing tenant or environment information

## Related Links

- [Observability concepts]({{< ref observability-concept.md >}})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ tracestate: congo=t61rcWkgMzE

[Learn more about the tracestate fields details](https://www.w3.org/TR/trace-context/#tracestate-header).

**Baggage header**

Dapr supports [W3C Baggage](https://www.w3.org/TR/baggage/) for propagating key-value pairs alongside trace context. The baggage header allows you to attach metadata to trace context that needs to be propagated throughout your distributed system, such as user IDs, tenant information, or environment details.

The header value follows the W3C Baggage specification format:

```
baggage: userId=alice,serverNode=DF%2028,isVIP=true
```

Multiple baggage headers are supported and will be combined according to the W3C specification. Dapr automatically propagates baggage headers across service calls.

{{% /codetab %}}


Expand All @@ -81,6 +93,18 @@ tracestate: congo=t61rcWkgMzE

In the gRPC API calls, trace context is passed through `grpc-trace-bin` header.

**Baggage metadata**

Dapr supports [W3C Baggage](https://www.w3.org/TR/baggage/) for propagating key-value pairs alongside trace context. The baggage metadata allows you to attach metadata to trace context that needs to be propagated throughout your distributed system, such as user IDs, tenant information, or environment details.

The metadata value follows the W3C Baggage specification format:

```
baggage: userId=alice,serverNode=DF%2028,isVIP=true
```

Multiple baggage metadata entries are supported and will be combined according to the W3C specification. Dapr automatically propagates baggage metadata across service calls.

{{% /codetab %}}

{{< /tabs >}}
Expand Down
Loading