mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Merge pull request #51597 from o-shevchenko
Closes gh-51597 * gh-51597: Document baggage propagation over gRPC
This commit is contained in:
+1
@@ -242,6 +242,7 @@ The baggage is automatically propagated over the network if you're using W3C pro
|
||||
If you're using B3 propagation, baggage is not automatically propagated.
|
||||
To manually propagate baggage over the network, use the configprop:management.tracing.baggage.remote-fields[] configuration property (this works for W3C, too).
|
||||
For the example above, setting this property to `baggage1` results in an HTTP header `baggage1: value1`.
|
||||
Baggage is propagated wherever Micrometer Observation instruments the transport, for example xref:io/grpc.adoc#io.grpc.server.observability[gRPC metadata] as well as HTTP headers.
|
||||
|
||||
If you want to propagate the baggage to the MDC, use the configprop:management.tracing.baggage.correlation.fields[] configuration property.
|
||||
For the example above, setting this property to `baggage1` results in an MDC entry named `baggage1`.
|
||||
|
||||
@@ -484,6 +484,21 @@ For details of how to configure an OAuth2 Resource Server to use with your gRPC
|
||||
|
||||
|
||||
|
||||
[[io.grpc.server.observability]]
|
||||
=== Observability
|
||||
|
||||
Spring Boot provides auto-configuration of the javadoc:io.micrometer.core.instrument.binder.grpc.ObservationGrpcServerInterceptor[] whenever Micrometer is available.
|
||||
This interceptor provides observability into your gRPC server applications.
|
||||
|
||||
When Micrometer Tracing is also available, the observation carries the trace context and any xref:actuator/tracing.adoc#actuator.micrometer-tracing.baggage[baggage] found in the incoming gRPC metadata.
|
||||
This includes the W3C `baggage` header as well as the individual metadata keys listed in configprop:management.tracing.baggage.remote-fields[], so no additional interceptor is required to propagate baggage over gRPC.
|
||||
|
||||
NOTE: The interceptor is provided by `micrometer-core`, so it is only auto-configured when that dependency is on the classpath (for example through `spring-boot-starter-actuator`).
|
||||
|
||||
TIP: If you use Micrometer, but prefer to not to use it for gRPC, you can set configprop:spring.grpc.server.observation.enabled[] to `false`.
|
||||
|
||||
|
||||
|
||||
[[io.grpc.client]]
|
||||
== Writing a gRPC Client Application
|
||||
|
||||
@@ -683,6 +698,10 @@ TIP: To disable the in-process channel factory, you can set the configprop:sprin
|
||||
Spring Boot provides auto-configuration of the javadoc:io.micrometer.core.instrument.binder.grpc.ObservationGrpcClientInterceptor[] whenever Micrometer is available.
|
||||
This interceptor provides observability into your gRPC client applications.
|
||||
|
||||
When Micrometer Tracing is also available, the trace context and the current xref:actuator/tracing.adoc#actuator.micrometer-tracing.baggage[baggage] are written to the metadata of outgoing calls, using the W3C `baggage` header as well as the individual metadata keys listed in configprop:management.tracing.baggage.remote-fields[].
|
||||
|
||||
NOTE: The interceptor is provided by `micrometer-core`, so it is only auto-configured when that dependency is on the classpath (for example through `spring-boot-starter-actuator`).
|
||||
|
||||
TIP: If you use Micrometer, but prefer to not to use it for gRPC, you can set configprop:spring.grpc.client.observation.enabled[] to `false`.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user