-
Notifications
You must be signed in to change notification settings - Fork 231
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
alias_method vs prepend infinite looping #352
Comments
I encourage you to read this feedback I made to APM vendors: elastic/apm-agent-ruby#379 (comment) tl;dr: just use prepend. FYI list of instrumentors now using prepend:
At Sqreen we went the extra mile and detect those to fall back to alias method chain, or warn and bail out when there's a mix, but as of today just using prepend consistently is the solid choice. |
I was being able to execute Opentelemetry with Prometheus exporter using the latest version of Prometheus Exporter. The latest version of Prometheus Exporter seems to work also with prepend: https://github.com/discourse/prometheus_exporter#choosing-the-style-of-method-patching |
We only have one instance of |
When opentelemetry-ruby instrumentations is run in parallel with other Gems (like prometheus-exporter) which use a different patching technique and patch the same low level adapter method, we observe
SystemStackError (stack level too deep)
error at runtime.More details related to
SystemStackError
originating because of patching conflicts betweenalias_method
vsModule#prepend
can be read from https://blog.newrelic.com/engineering/ruby-agent-module-prepend-alias-method-chains/The patching problem between both techniques looks to a common issue among the APM providers community.
- elastic/apm-agent-ruby#379
- https://docs.newrelic.com/docs/agents/ruby-agent/troubleshooting/systemstackerror-stack-level-too-deep
- scoutapp/scout_apm_ruby#309 (data dog integration)
- DataDog/dd-trace-rb#862
May be we can provide a config toggle flag for the end user to choose which technique they need similar to New Relic implementation ?
New Relic config reference:
https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration
The text was updated successfully, but these errors were encountered: