-
Notifications
You must be signed in to change notification settings - Fork 249
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
feat: support InstrumentationScope, and update OTLP proto to 0.18.0 #1345
feat: support InstrumentationScope, and update OTLP proto to 0.18.0 #1345
Conversation
This commit accomplishes two things simultaneously - adding support for InstrumentationScope everywhere, and also updating the OTLP proto to v0.18.0. The PR that introduced InstrumentationScope is [here](open-telemetry/opentelemetry-specification#2276) My best understanding (which is implemented in this PR) is that: - Our OTLP export requests should group by InstrumentationScope instead of InstrumentationLibrary - We must be able to support accessing the InstrumentationLibrary from anywhere a ReadableSpan is available, and that it should represent the `name` and `version` fields from the InstrumentationScope. - When creating a tracer, we create and store an InstrumentationScope rather than an InstrumentationLibrary. - Non-OTLP exporters must export both `otlp.scope.{name,version}` AND `otlp.library.{name,version}` tags for backwards compatibility. Some notes that may be interesting: - I chose to keep the original definition of `InstrumentationLibrary` around for now. - I chose to have `Span#instrumentation_library` and `SpanData#instrumentation_library` create and memoize an `InstrumentationLibrary` on-demand when someone asks for it (and marked the method as deprecated in the YARD docs). - I chose *not* to reference that deprecated helper when modifying the zipkin and jaeger exporters, for performance reasons.
a92cc56
to
e525c4e
Compare
All the gems that access |
We should add a deprecation notice to the |
Co-authored-by: Francis Bogsanyi <[email protected]>
Co-authored-by: Francis Bogsanyi <[email protected]>
Co-authored-by: Francis Bogsanyi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bunch of small documentation suggestions. Otherwise LGTM. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you update the rake file for updating the protos? https://github.com/open-telemetry/opentelemetry-ruby/blob/main/exporter/otlp/Rakefile#L32-L37
They seem to be still excluding metrics stuff.
Or did you update them via some other approach?
Co-authored-by: Francis Bogsanyi <[email protected]>
Co-authored-by: Francis Bogsanyi <[email protected]>
Co-authored-by: Francis Bogsanyi <[email protected]>
It now checks out a specific tag, for starters.
Oh - I did it manually by 1) cloning the proto repo and switching to the tag, 2) running make gen-ruby, and 3) copying the generated files to the right locations. I updated the rake task (and it now checks out a specific tag rather than whatever is on |
This is good to merge, but I want to wait for @robbkidd to chime in because I want to make sure I/we are remembering correctly that there was a friendly request for these to get bumped in tandem. |
Can we push this over the line @robbkidd , or is some synchronization required? |
Sorry for my silence, folks. Yes, I will review this today! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the changes and ran the demo webstore emailservice with the SDK and OTLP exporter tracking this branch.
Deets on gem swap out in webstore emailservice
- Deleted
src/emailservice/Gemfile.lock
and made the following changes:
diff --git a/src/emailservice/Dockerfile b/src/emailservice/Dockerfile
index 1b6d1d8..df8ba14 100644
--- a/src/emailservice/Dockerfile
+++ b/src/emailservice/Dockerfile
@@ -14,14 +14,14 @@
FROM ruby:3.1.2-slim
-RUN apt-get update -y && apt-get install -y build-essential
+RUN apt-get update -y && apt-get install -y build-essential git
+
+WORKDIR /email_server
COPY Gemfile* ./
RUN bundle install
-WORKDIR /email_server
-
COPY . .
EXPOSE ${EMAIL_SERVICE_PORT}
diff --git a/src/emailservice/Gemfile b/src/emailservice/Gemfile
index 971b0d0..77f2408 100644
--- a/src/emailservice/Gemfile
+++ b/src/emailservice/Gemfile
@@ -5,6 +5,6 @@ gem "pony", "~> 1.13"
gem "puma", "~> 5.6"
gem "sinatra", "~> 2.2"
-gem "opentelemetry-sdk", "~> 1.1"
-gem "opentelemetry-exporter-otlp", "~> 0.21"
+gem "opentelemetry-sdk", github: 'ahayworth/opentelemetry-ruby', ref: 'ahayworth/instrumentation-scope-and-proto-bump', glob: 'sdk/*.gemspec'
+gem "opentelemetry-exporter-otlp", github: 'ahayworth/opentelemetry-ruby', ref: 'ahayworth/instrumentation-scope-and-proto-bump', glob: 'exporter/otlp/*.gemspec'
gem "opentelemetry-instrumentation-sinatra", "~> 0.19"
- ✅ received trace spans from the Ruby service with no code changes to the service
- ✅ library.name span attribute (and, really, any span data at all) remains populated in a receiver using an older proto version
That is a far more full-featured test than I was expecting, thank you @robbkidd ! |
Making up for the hang-time! |
Good to merge once the conflict is resolved. |
@fbogsany I merged |
This is awesome! Will there be a release to Rubygems soon? |
@sodabrew we could cut one - I will ask in the CNCF slack ( |
This commit accomplishes two things simultaneously - adding support for
InstrumentationScope everywhere, and also updating the OTLP proto to v0.18.0.
The PR that introduced InstrumentationScope is here
My best understanding (which is implemented in this PR) is that:
of InstrumentationLibrary
anywhere a ReadableSpan is available, and that it should represent the
name
andversion
fields from the InstrumentationScope.rather than an InstrumentationLibrary.
otlp.scope.{name,version}
ANDotlp.library.{name,version}
tags for backwards compatibility.Some notes that may be interesting:
InstrumentationLibrary
around for now.
Span#instrumentation_library
andSpanData#instrumentation_library
create and memoize anInstrumentationLibrary
on-demand when someone asks for it (and marked the method as
deprecated in the YARD docs).
zipkin and jaeger exporters, for performance reasons.
cc @robbkidd - This PR does both OTLP proto updates and InstrumentationLibrary changes, as per your request. Can you verify that this looks right to you?
cc @robertlaurin - Is the metrics side of this looking okay?
cc @fbogsany - This change isn't actually huge in absolute terms, but getting it wrong would be catastrophic. I'd love your review on it.
edit: also worth mentioning that I really didn't see anything relevant to tracing in the proto changes. Metrics? Tons, definitely, but since we don't have any metrics exporters that seems okay for now.
Fixes #1126.