forked from GoogleCloudPlatform/microservices-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Propagate trace context always (GoogleCloudPlatform#1345)
* Propagate trace from frontend always Enable OpenTelemetry trace context propagation regardless of environment vars. This will allow for context to be injected from another source (e.g. a service mesh) and propagated regardless of whether the frontend binary exports the trace. This PR uses OpenTelemetry trace propagation features to extract and inject relevant headers to/from requests. By default, it looks for W3C tracecontext headers, but will also fall back to baggage when those headers are not found. It is important for context ti be propagated any time downsteam service calls are made, otherwise any potential traces will appear orphaned (i.e. outside the appropriate context.) This can happen when another process intercepts headers and creates trace spans as mentioned above, or in case of custom tracing scenarios where not all potential spans are sampled or exported. Maintaining trace context is important in such scenarios. For the above reason, we do not propagate traces in services that do not make any downstream service calls (e.g. paymentservice, emailservice because there are no downstream dependencies that require trace propagation. * Allow otel to extract context from HTTP * Always propagate trace context in checkoutservice * Propagate trace context always in currencyservice * Propagate trace context in productcatalog always * Add trace context propagation Adding context propagation in grpc client of recommendation service * Do not set tracer provider by default Tracer Provider should only be initialized if traces are being emitted by the recommendation server. In other cases, we want to propagate trace context without emitting a trace (in case traces are emitted elsewhere.)
- Loading branch information
Showing
5 changed files
with
51 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters