-
Notifications
You must be signed in to change notification settings - Fork 176
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
bug: Rack configuration options ignored due to ActionPack instrumentation #88
Comments
As suggested by @arielvalentin, here, using ENV variables works as expected as this pulls this is pulled in separately from the user-supplied configuration: export OTEL_RUBY_INSTRUMENTATION_RACK_CONFIG_OPTS="untraced_endpoints=/health" |
I believe this is something of a known issue (although I do not recall where we have discussed prior). It’s probably worth figuring out how to make this work correctly regardless of the ordering in the config block. Or, we could at least document this behavior (and the workarounds) somewhere more prominently. If I remember correctly, we had presumed that folks wouldn’t typically be installing Rack instrumentation in addition to something that builds on it. However, I think that presumption originated in a time when we didn’t have as many interesting Rack options for one to set. :) |
I am experiencing this too. Tried the following: config.use "OpenTelemetry::Instrumentation::Rack", ...
config.use_all But it raises:
Would make sense if we could combine these two. |
Yes, they are exclusive (although we may be able to make it more permissive). When I think about the reasons someone would wish to do this, it sounds like you wish to use all instrumentation but pass specific options to one of the libraries. That is possible with OpenTelemetry::SDK.configure do |c|
c.use_all { 'OpenTelemetry::Instrumentation::Rack' => { untraced_endpoints: ['probes/ready'] } }
end ...however, I don't know that this is documented well enough. I'll make a note on our documentation issue that this is a thing that could be more clear. |
Yes, but as noted above, this currently doesn't work b/c ActionPack auto-loads Rack without the options. |
@robertlaurin et.al. I looked into this a bit today and a proper fix for this issue is going to be a bit difficult due to state management of the configuration options and the interactions between the SDK Configurator, Registry, and the Instrumentations. The instrumentation options are passed as arguments to the registry at configuration time: The registry is unaware of any dependent installation order and installs them in the order they were registered: The As @johnnyshields pointed out the I think we need to review the Configurator's design and consider an approach where either... |
This is perhaps a bold take, but I suspect this will be useful. I also don't think it would be terribly hard to implement; I think Rails has some examples we could Other approaches could work, though - collecting all installation options and deferring the actual installation until the end of the Since this is only stuff run at SDK initialization, we can probably do something friendly and backwards-compatible with the registry (something something something metaprogramming) to make it a non-breaking enhancement, if we're careful? Footnotes |
@ahayworth dependency graphs are lovely, but I think there is a much simpler solution, which is to allow using both |
@johnnyshields That's true, but if you squint at it that feels (to me) like it's a shortcut to a dependency graph. Or more specifically, making our users construct the appropriate dependency graph 😆 😆 |
👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the |
Summary
When thinning out our instrumentations, solely using Rack, I found that the middleware wasn't being installed.
I then stumbled across this: https://cloud-native.slack.com/archives/C01NWKKMKMY/p1629852592034300?thread_ts=1629850975.033500&cid=C01NWKKMKMY
After adding ActievJob, as follows:
I noticed the following INFO logs:
Seeing that
untraced_endpoints
was an empty Array and not taking in my config (see ☝️ logs), I then switch the ordering of ActionPack & Rack and got this (👇):Now
:untraced_endpoints
is correctly populated.I believe this is happening due to the ActiveJob instrumentation installing Rack with an empty config
{}
, here: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/action_pack/lib/opentelemetry/instrumentation/action_pack/railtie.rb#L13Share details about your runtime
Operating system details: macOS, Catalina 10.15.7
RUBY_ENGINE: "ruby"
RUBY_VERSION: "2.7.1" & "3.0.3"
RAILS_VERSION: "6.0.4.8" & "6.1.5"
The text was updated successfully, but these errors were encountered: