-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix OTEL logging in HotRod example (#4556)
## Short description of the changes - A cleaned up version of #4550. - It uses a single spanLogger for both OpenTracing and OpenTelemetry spans. - The logging works for both types spans because of [this clever line of code](https://github.com/opentracing/opentracing-go/blob/master/gocontext.go#L14) where `tracerWithHook` is an OTEL bridge tracer, allowing span to be stored in the `ctx` the "OTEL-way", making the span discoverable as a legitimate OTEL span such that `ok == true`: ```go if span, ok := ctx.Value(currentSpanKey).(Span); ok { ... } ``` ## Testing Ran locally to confirm logs appearing for both OpenTracing spans: ![Screenshot 2023-07-01 at 8 12 16 pm](https://github.com/jaegertracing/jaeger/assets/26584478/572b037a-8fbb-43aa-abdf-6a8a2a137f89) and OpenTelemetry spans: ![Screenshot 2023-07-01 at 8 12 08 pm](https://github.com/jaegertracing/jaeger/assets/26584478/681da3b3-8f07-4f85-b60e-8235592c89bd) --------- Signed-off-by: albertteoh <see.kwang.teoh@gmail.com>
- Loading branch information
1 parent
855b226
commit 050ba81
Showing
2 changed files
with
87 additions
and
71 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