The usual way of configuring a Rails app for APM is to use an initializer - I’m not (yet) deeply familiar with the plugin system in discourse. Is there any way to load such an initializer early in the lifetime of the discourse app using the existing plugin system? If not, what other options exist? I’d prefer not to have to fork the entire app for the purpose of adding a single initializer
@sam I tried that but apparently this particular ddtrace gem expects to be able to run in before_initialize, too. But it doesn’t seem like before_initialize is a valid method in plugin.rb. Are there any other options for a plugin to run earlier in the lifecycle of the app?
My next step would be to not use the automagic instrumentation that is applied with that gem’s “patchers” but instead fold some of the actual instrumentation logic into the plugin itself, similar to how you’ve done it with discourse-prometheus. I guess that would make sense anyway to plug into some of the specifics of discourse. Was just hoping there’s a way to leverage the magic that I haven’t seen yet.