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

Ensure framework-level configuration (Rails, Sinatra) is order-independent with their sub-parts

Open marcotc opened this issue 2 years ago • 0 comments

See #520

Our framework-level integrations (e.g. Rails or Sinatra) can perform changes to the configuration of their sub-parts' integrations. For example, the Rails integration configures the Rack integration: https://github.com/DataDog/dd-trace-rb/blob/08c823edb60f61f75c1d96876d599bbf47dd6c62/lib/datadog/tracing/contrib/rails/framework.rb#L66-L71

This means that configuration of integrations is order-dependent. The following configuration block,

Datadog.configure do |c|
  c.tracing.instrument :rack, service_name: 'my-rack'
  c.tracing.instrument :rails, service_name: 'my-rails'
end

would result in Rack spans having the service name 'my-rails' because of this line: https://github.com/DataDog/dd-trace-rb/blob/08c823edb60f61f75c1d96876d599bbf47dd6c62/lib/datadog/tracing/contrib/rails/framework.rb#L69

Having a framework-level integration configure its sub-parts is convenient, but shouldn't come at the cost of inconsistent configuration based on statement declaration order. Configuration should be order-independent, specially since the library supports successive calls to Datadog.configure for overriding configuration.

marcotc avatar May 16 '22 23:05 marcotc