Skip to content
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

Use OpenTelemetry SDK in HotROD 🚗 #4187

Merged
merged 8 commits into from Jan 29, 2023

Conversation

yurishkuro
Copy link
Member

@yurishkuro yurishkuro commented Jan 28, 2023

Based on earlier PR #3390 by @rbroggi.

Which problem is this PR solving?

Short description of the changes

  • Switch from jaeger-client-go SDK to OTel SDK paired with ot-otel bridge
  • Add cli flag to select which Otel Exporter to use (Jaeger, OTLP or stdout)
  • Add favicon 🚗
  • Added OTEL version of rpcmetrics from jaeger-client-go
  • Remove dependency on github.com/uber/jaeger-lib in HotROD (addresses one of outstanding tasks in Remove dependency on jaeger-lib #3766)

Breaking changes

Trace export mode changed from UDP-to-Agent to HTTP-to-Collector.

Most of the environment variables recognized by the Jaeger SDK are no longer supported.
Instead, use environment variables understood by the OpenTelemetry exporters, e.g. names as follows:

	"JAEGER_AGENT_HOST":                             "OTEL_EXPORTER_JAEGER_AGENT_HOST",
	"JAEGER_AGENT_PORT":                             "OTEL_EXPORTER_JAEGER_AGENT_PORT",
	"JAEGER_ENDPOINT":                               "OTEL_EXPORTER_JAEGER_ENDPOINT",
	"JAEGER_USER":                                   "OTEL_EXPORTER_JAEGER_USER",
	"JAEGER_PASSWORD":                               "OTEL_EXPORTER_JAEGER_PASSWORD",

rbroggi and others added 4 commits January 28, 2023 13:26
* replacing the jaeger-client-go ot tracer implementation with the ot-otel bridge implementation

Signed-off-by: rbroggi <ro_broggi@hotmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>

Signed-off-by: rbroggi <ro_broggi@hotmail.com>
* no need to globally register the otel tracer
Signed-off-by: rbroggi <ro_broggi@hotmail.com>

Signed-off-by: rbroggi <ro_broggi@hotmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
@codecov
Copy link

codecov bot commented Jan 28, 2023

Codecov Report

Base: 97.11% // Head: 97.09% // Decreases project coverage by -0.02% ⚠️

Coverage data is based on head (70887b1) compared to base (bb85e41).
Patch coverage: 95.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4187      +/-   ##
==========================================
- Coverage   97.11%   97.09%   -0.02%     
==========================================
  Files         297      301       +4     
  Lines       17535    17674     +139     
==========================================
+ Hits        17029    17161     +132     
- Misses        407      413       +6     
- Partials       99      100       +1     
Flag Coverage Δ
unittests 97.09% <95.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
examples/hotrod/pkg/tracing/rpcmetrics/observer.go 82.50% <82.50%> (ø)
...xamples/hotrod/pkg/tracing/rpcmetrics/endpoints.go 100.00% <100.00%> (ø)
examples/hotrod/pkg/tracing/rpcmetrics/metrics.go 100.00% <100.00%> (ø)
...amples/hotrod/pkg/tracing/rpcmetrics/normalizer.go 100.00% <100.00%> (ø)
internal/metricstest/metricstest.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: Yuri Shkuro <github@ysh.us>
@yurishkuro yurishkuro changed the title Pr3380 v2 Use OpenTelemetry SDK in HotROD Jan 29, 2023
@yurishkuro yurishkuro marked this pull request as ready for review January 29, 2023 00:56
@yurishkuro yurishkuro requested a review from a team as a code owner January 29, 2023 00:56
// to return an OpenTracing-compatible tracer.
func Init(serviceName string, exporterType string, logger log.Factory) opentracing.Tracer {
once.Do(func() {
otel.SetTextMapPropagator(propagation.TraceContext{})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rbroggi your PR was mostly spot-on, this was the only thing missing, so traces did not continue across services.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for reaching out. I have been quite in the shadows lately. Hope to come back to some contributions soon.

albertteoh
albertteoh previously approved these changes Jan 29, 2023
Copy link
Contributor

@albertteoh albertteoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; do you think this should be the approach (i.e. using the OTEL -> OT shim) to take for #3381?

examples/hotrod/pkg/tracing/init.go Outdated Show resolved Hide resolved
@yurishkuro
Copy link
Member Author

@albertteoh my intention was to make this change work with the original HotROD blog post (probably time to update it to current state). But it has a section that demonstrates generation of RPC metrics by using span observer in the tracer. This functionality is now broken, but I suspect it's possible to reproduce it via an additional span processor passed to the OTEL SDK

@yurishkuro
Copy link
Member Author

yurishkuro commented Jan 29, 2023

do you think this should be the approach (i.e. using the OTEL -> OT shim) to take for #3381?

I don't have a strong opinion there, but it's probably better to just do a full upgrade to OTEL. I kinda wanted to try out the OT-OTEL shim in the Hotrod first, since I haven't seen any posts describing a successful use of the shim on existing code. Now that I know it works (maybe write a blog post about it), it may be worth doing a follow-up PR and move to OTEL directly. It will involve using different instrumentation libraries though.

@yurishkuro yurishkuro changed the title Use OpenTelemetry SDK in HotROD Use OpenTelemetry SDK in HotROD 🚗 Jan 29, 2023
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
@yurishkuro yurishkuro merged commit fb1d67f into jaegertracing:main Jan 29, 2023
@yurishkuro yurishkuro deleted the pr3380_v2 branch January 29, 2023 08:50
yurishkuro added a commit that referenced this pull request Feb 9, 2023
## Which problem is this PR solving?
- The baggage propagation was broken in HotROD after #4187
- This restores the baggage support by providing a few integration
points with OTEL
- [ ] This change will not work until OTEL Baggage & Bridge bugs are
fixed: open-telemetry/opentelemetry-go#3685

## Short description of the changes
- [`index.html`] The webapp used to send baggage via `jaeger-baggage`
header, this is now changed to W3C `baggage` header
- [`mux.go`] The Jaeger SDK was able to accept `jaeger-baggage` header
even for requests without am active trace. OTEL Bridge does not support
that, so we use OTEL's Baggage propagator to manually extract the
baggage into Context, and once the Bridge creates a Span, we copy OTEL
baggage from Context into the Span.
- All other changes are cosmetic / logging related

---------

Signed-off-by: Yuri Shkuro <github@ysh.us>
shubbham1215 pushed a commit to shubbham1215/jaeger that referenced this pull request Feb 22, 2023
Based on earlier PR jaegertracing#3390 by @rbroggi. 

## Which problem is this PR solving?
- Resolves jaegertracing#3380

## Short description of the changes
- Switch from jaeger-client-go SDK to OTel SDK paired with ot-otel
bridge
- Add cli flag to select which Otel Exporter to use (Jaeger, OTLP or
stdout)
- Add favicon 🚗
- Added OTEL version of rpcmetrics from jaeger-client-go
- Remove dependency on github.com/uber/jaeger-lib in HotROD (addresses
one of outstanding tasks in jaegertracing#3766)

---------

Signed-off-by: rbroggi <ro_broggi@hotmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: rbroggi <ro_broggi@hotmail.com>
shubbham1215 pushed a commit to shubbham1215/jaeger that referenced this pull request Feb 22, 2023
## Which problem is this PR solving?
- The baggage propagation was broken in HotROD after jaegertracing#4187
- This restores the baggage support by providing a few integration
points with OTEL
- [ ] This change will not work until OTEL Baggage & Bridge bugs are
fixed: open-telemetry/opentelemetry-go#3685

## Short description of the changes
- [`index.html`] The webapp used to send baggage via `jaeger-baggage`
header, this is now changed to W3C `baggage` header
- [`mux.go`] The Jaeger SDK was able to accept `jaeger-baggage` header
even for requests without am active trace. OTEL Bridge does not support
that, so we use OTEL's Baggage propagator to manually extract the
baggage into Context, and once the Bridge creates a Span, we copy OTEL
baggage from Context into the Span.
- All other changes are cosmetic / logging related

---------

Signed-off-by: Yuri Shkuro <github@ysh.us>
shubbham1215 pushed a commit to shubbham1215/jaeger that referenced this pull request Mar 5, 2023
Based on earlier PR jaegertracing#3390 by @rbroggi.

## Which problem is this PR solving?
- Resolves jaegertracing#3380

## Short description of the changes
- Switch from jaeger-client-go SDK to OTel SDK paired with ot-otel
bridge
- Add cli flag to select which Otel Exporter to use (Jaeger, OTLP or
stdout)
- Add favicon 🚗
- Added OTEL version of rpcmetrics from jaeger-client-go
- Remove dependency on github.com/uber/jaeger-lib in HotROD (addresses
one of outstanding tasks in jaegertracing#3766)

---------

Signed-off-by: rbroggi <ro_broggi@hotmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: rbroggi <ro_broggi@hotmail.com>
Signed-off-by: shubbham1215 <sawaikershubham@gmail.com>
shubbham1215 pushed a commit to shubbham1215/jaeger that referenced this pull request Mar 5, 2023
## Which problem is this PR solving?
- The baggage propagation was broken in HotROD after jaegertracing#4187
- This restores the baggage support by providing a few integration
points with OTEL
- [ ] This change will not work until OTEL Baggage & Bridge bugs are
fixed: open-telemetry/opentelemetry-go#3685

## Short description of the changes
- [`index.html`] The webapp used to send baggage via `jaeger-baggage`
header, this is now changed to W3C `baggage` header
- [`mux.go`] The Jaeger SDK was able to accept `jaeger-baggage` header
even for requests without am active trace. OTEL Bridge does not support
that, so we use OTEL's Baggage propagator to manually extract the
baggage into Context, and once the Bridge creates a Span, we copy OTEL
baggage from Context into the Span.
- All other changes are cosmetic / logging related

---------

Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: shubbham1215 <sawaikershubham@gmail.com>
jacobmarble added a commit to influxdata/influxdb-observability that referenced this pull request Apr 4, 2023
In the demo, the hotrod app was emitting trace events without
attributes, including name. It seems that is related to this PR:
jaegertracing/jaeger#4187

For now, the easy fix is to rollback hotrod to Jaeger version 1.41.
jacobmarble added a commit to influxdata/influxdb-observability that referenced this pull request Apr 4, 2023
In the demo, the hotrod app was emitting trace events without
attributes, including name. It seems that is related to this PR:
jaegertracing/jaeger#4187

For now, the easy fix is to rollback hotrod to Jaeger version 1.41.
jacobmarble added a commit to influxdata/influxdb-observability that referenced this pull request Apr 4, 2023
In the demo, the hotrod app was emitting trace events without
attributes, including name. It seems that is related to this PR:
jaegertracing/jaeger#4187

For now, the easy fix is to rollback hotrod to Jaeger version 1.41.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade HotROD example to use OpenTelemetry SDK
3 participants