dd-trace-rb icon indicating copy to clipboard operation
dd-trace-rb copied to clipboard

Resource tagging/management of Rails Engines dynamically mounted on initialization (SubSystem Resources)

Open davidhatten opened this issue 1 month ago • 2 comments

Is your feature request related to a problem? Please describe. Problem: I mount engines to my Rails app which are entirely defined within an external gem (ex: Flipper UI, Sidekiq UI). When Datadog attempts to process the users making a request to one of these engines via link on the app dashboard UI, but Datadog groups the resource as a Rack request using the quantized name (GET 304) instead of something like Flipper#features (as though it were a proper resource defined by the application)

Describe the goal of the feature To be able to view Engine-based resources as distinct traffic, labeled like the rest of my rails resources that Datadog shows me on the Service. EX: something like Flipper#features instead of a resource name of GET 304 with the path_group inside the trace being my info

Describe alternatives you've considered I've played with the after_request hook to try to manually tag the traces, but that's going away in a future version.

I could try to monkey-patch something into the gems but that's fragile and opaque, and would have to be custom for each gem.

Additional context I've specified flipper, but I am also doing this with the sidekiq UI.

The app in question does not run sidekiq or flipper itself either.

Basic code example:

routes.rb
...
mount Flipper::UI.app(flipper_adapter), at: '/flipper/my_app'
...

datadog.rb
...
c.tracing.instrument rails
...

How does datadog help you? Love the profiling especially, incredible tool for checking behaviors and visualizing problems you don't know you have

davidhatten avatar May 09 '24 14:05 davidhatten