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

feat: instrument google apis core #631

Closed

Conversation

robertlaurin
Copy link
Contributor

@robertlaurin robertlaurin commented Mar 2, 2021

module GoogleApisCore
module Patches
# Module to prepend to ::Google::Apis::Core::HttpCommand for instrumentation
module HttpCommand
Copy link
Contributor Author

@robertlaurin robertlaurin Mar 2, 2021

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I would strongly prefer just to edit google-apis-core itself to provide whatever explicit hooks are needed. Or perhaps even to build the instrumentation directly into google-apis-core, the way that it currently has opencensus built in. So we can avoid monkey patches. (I effectively own google-apis-core myself, so I can fast-track any such work and release.)

[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/LICENSE
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
[ruby-gitter]: https://gitter.im/open-telemetry/opentelemetry-ruby
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to fix the generator script to refer to GitHub Discussions instead of Gitter? I thought I'd fixed every reference 😞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used the generator before your change went in :), I'll remove this from the PR.

module HttpCommand
def opencensus_begin_span
return if @opentelemetry_tracing_span
return unless OpenTelemetry::Trace.current_span.context.trace_flags.sampled?
Copy link
Contributor

Choose a reason for hiding this comment

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

I know we did this in the Shopify instrumentation, to match the check in the method we're monkey-patching, but I don't think that's really in the spirit of OpenTelemetry. If we're trying to avoid overhead from instrumentation when we're not recording, the supported way to do that is:

Suggested change
return unless OpenTelemetry::Trace.current_span.context.trace_flags.sampled?
return unless OpenTelemetry::Trace.current_span.recording?

@dazuma do you have an opinion on this?


The `opentelemetry-instrumentation-google_apis_core` gem source is [on github][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`.

The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us on our [gitter channel][ruby-gitter] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
Copy link
Contributor

Choose a reason for hiding this comment

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

on our [gitter channel][ruby-gitter]

This should refer to GitHub Discussions instead.

@mwear
Copy link
Member

mwear commented Mar 23, 2021

Closing as this will be added directly to the google apis core gem.

@mwear mwear closed this Mar 23, 2021
@robertlaurin robertlaurin deleted the google-apis-core branch March 23, 2021 16:27
@robertlaurin
Copy link
Contributor Author

Google apis core gem PR googleapis/google-api-ruby-client#3414

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.

Google API client instrumentation
4 participants