GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — [WIP] feat: add opentelemetry instrumentation by robertlaurin · Pull Request #3185 · googleapis/google-api-ruby-client Conversation
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
robertlaurin
commented
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @dazuma, here's rough draft here to get the discussion/review started.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you want to maintain support for opencensus in addition to opentelemetry?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uhh, yeah, as much as I don't want to support OpenCensus here anymore, I also don't think we should rip it out unceremoniously. We should rather add a deprecation warning for a time. Can we use the logic of: try requiring opentelemetry and if that works enable it, otherwise try requiring opencensus and if that works enable it, otherwise disable both? So you can just leave the
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I included the instrumentation base as it surfaces configuration in a consistent way with other instrumented gems.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't typically reach for doubles, but I was apprehensive towards including
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why were you apprehensive? Perfectly happy including the SDK gem as a development dependency (not a runtime dependency) so it's available for tests, if it will make this cleaner.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
|
|
||
| begin | ||
| require 'opencensus' | ||
| OPENCENSUS_AVAILABLE = true |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Uhh, yeah, as much as I don't want to support OpenCensus here anymore, I also don't think we should rip it out unceremoniously. We should rather add a deprecation warning for a time. Can we use the logic of: try requiring opentelemetry and if that works enable it, otherwise try requiring opencensus and if that works enable it, otherwise disable both? So you can just leave the opencensus_{begin,end}_span methods in place, and add new ones for OpenTelemetry.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 'http.host' => url.host.to_s, | ||
| 'http.method' => method.to_s, | ||
| 'http.target' => url.path.to_s, | ||
| 'peer.service' => 'google' |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't think most google backends are actually emitting spans or setting service.name so it may not matter that much... But from my understanding of the semantics of this attribute, I suggest using url.host.to_s which will return the "official" ID of the service being called.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # Log exceptions and continue, so OpenTelemetry failures don't cause | ||
| # the entire request to fail. | ||
| logger.debug { sprintf('Error opening OpenCensus span: %s', e) } | ||
| logger.debug { sprintf('Error opening OpenTelemetry span: %s', e) } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I know the opencensus code used sprintf. That was unfortunate and I should have changed it. Could you just use normal string interpolation for this?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 'peer.service' => 'google' | ||
| } | ||
|
|
||
| @opentelemetry_span = Google::Apis::Core::Instrumentation.instance.tracer.start_span(url.host.to_s, attributes: attributes) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In general, what's the best practice for naming spans? This just provides the service name. Should we include the method being called?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| expect(events[0].uncompressed_size).to eql 0 | ||
| expect(events[1].type).to eql :RECEIVED | ||
| expect(events[1].uncompressed_size).to eql 11 | ||
| span_double = instance_double(OpenTelemetry::Trace::Span) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why were you apprehensive? Perfectly happy including the SDK gem as a development dependency (not a runtime dependency) so it's available for tests, if it will make this cleaner.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
fcb8442 to
d2f2abb
Compare
|
Accidentally did a bad rebase the close the PR :/ Re-opened -> #3414 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.