From b6d75021c2b9379bfb7e2a7e35de3c9194b632dc Mon Sep 17 00:00:00 2001 From: Brett Langdon Date: Thu, 17 Jan 2019 09:11:29 -0500 Subject: [PATCH] [rack] Remove deprecation warning on :datadog_rack_request_span (#672) * [rack] Remove deprecation warning on :datadog_rack_request_span * Remove call to env.without_datadog_warnings --- lib/ddtrace/contrib/rack/middlewares.rb | 16 ++++++++++------ spec/ddtrace/contrib/rack/middleware_spec.rb | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/ddtrace/contrib/rack/middlewares.rb b/lib/ddtrace/contrib/rack/middlewares.rb index aa6620f74d..fe7e6d3fbc 100644 --- a/lib/ddtrace/contrib/rack/middlewares.rb +++ b/lib/ddtrace/contrib/rack/middlewares.rb @@ -62,12 +62,16 @@ def call(env) request_span = tracer.trace(Ext::SPAN_REQUEST, trace_options) env[RACK_REQUEST_SPAN] = request_span - # Add deprecation warnings - add_deprecation_warnings(env) - env.without_datadog_warnings do - # TODO: For backwards compatibility; this attribute is deprecated. - env[:datadog_rack_request_span] = env[RACK_REQUEST_SPAN] - end + # TODO: Add deprecation warnings back in + # DEV: Some third party Gems will loop over the rack env causing our deprecation + # warnings to be shown even when the user is not accessing them directly + # + # add_deprecation_warnings(env) + # env.without_datadog_warnings do + # # TODO: For backwards compatibility; this attribute is deprecated. + # env[:datadog_rack_request_span] = env[RACK_REQUEST_SPAN] + # end + env[:datadog_rack_request_span] = env[RACK_REQUEST_SPAN] # Copy the original env, before the rest of the stack executes. # Values may change; we want values before that happens. diff --git a/spec/ddtrace/contrib/rack/middleware_spec.rb b/spec/ddtrace/contrib/rack/middleware_spec.rb index 337155a94c..b9a2101eb9 100644 --- a/spec/ddtrace/contrib/rack/middleware_spec.rb +++ b/spec/ddtrace/contrib/rack/middleware_spec.rb @@ -55,7 +55,7 @@ end it do - expect(Datadog::Tracer.log).to have_received(:warn) + expect(Datadog::Tracer.log).to_not have_received(:warn) .with(/:datadog_rack_request_span/) end end