From 88e1b275b015de398aefd2a7c820a4183fac96ce Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Wed, 16 Jan 2019 17:07:12 -0500 Subject: [PATCH 1/2] [rack] Remove deprecation warning on :datadog_rack_request_span --- lib/ddtrace/contrib/rack/middlewares.rb | 6 ++++-- spec/ddtrace/contrib/rack/middleware_spec.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ddtrace/contrib/rack/middlewares.rb b/lib/ddtrace/contrib/rack/middlewares.rb index aa6620f74d1..7bbd25f77c4 100644 --- a/lib/ddtrace/contrib/rack/middlewares.rb +++ b/lib/ddtrace/contrib/rack/middlewares.rb @@ -62,8 +62,10 @@ 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) + # 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] diff --git a/spec/ddtrace/contrib/rack/middleware_spec.rb b/spec/ddtrace/contrib/rack/middleware_spec.rb index 337155a94cb..b9a2101eb9b 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 From 37a863b5a1da26406043021e000d6562355986e2 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Wed, 16 Jan 2019 17:17:01 -0500 Subject: [PATCH 2/2] Remove call to env.without_datadog_warnings --- lib/ddtrace/contrib/rack/middlewares.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/ddtrace/contrib/rack/middlewares.rb b/lib/ddtrace/contrib/rack/middlewares.rb index 7bbd25f77c4..fe7e6d3fbc0 100644 --- a/lib/ddtrace/contrib/rack/middlewares.rb +++ b/lib/ddtrace/contrib/rack/middlewares.rb @@ -65,11 +65,13 @@ def call(env) # 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 + # + # 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.