Documentation
¶
Overview ¶
Package metadata carries request-scoped transport-neutral fields.
Only the trace identifier is propagated automatically. Identity fields are populated after authentication and can be propagated explicitly by trusted service clients; this prevents unauthenticated headers from becoming an authority boundary.
Index ¶
- func ExtractGRPC(ctx context.Context, md grpcmetadata.MD) context.Context
- func ExtractHTTP(ctx context.Context, header http.Header) context.Context
- func InjectGRPC(ctx context.Context) context.Context
- func InjectHTTP(ctx context.Context, header http.Header)
- func InjectIdentityGRPC(ctx context.Context) context.Context
- func InjectIdentityHTTP(ctx context.Context, header http.Header)
- func With(ctx context.Context, values Values) context.Context
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractGRPC ¶
ExtractGRPC extracts the trace ID from inbound gRPC metadata.
func ExtractHTTP ¶
ExtractHTTP extracts the trace ID from inbound HTTP headers. It does not extract user or tenant identity; authentication must establish those values separately.
func InjectGRPC ¶
InjectGRPC adds metadata to an outgoing gRPC context.
func InjectHTTP ¶
InjectHTTP adds the trace ID to an outgoing HTTP request.
func InjectIdentityGRPC ¶
InjectIdentityGRPC adds authenticated identity metadata to an outgoing gRPC context. Call this only for trusted service-to-service calls.
func InjectIdentityHTTP ¶
InjectIdentityHTTP adds authenticated identity metadata to an outgoing request. Call this only for trusted service-to-service calls.