From 817a90863298a77c43bc8478c474c6646f825c15 Mon Sep 17 00:00:00 2001 From: David Elner Date: Tue, 5 May 2020 11:26:34 -0400 Subject: [PATCH 1/3] Fixed: Components#teardown! NoMethodError when Statsd is nil --- lib/ddtrace/configuration/components.rb | 4 ++-- spec/ddtrace/configuration/components_spec.rb | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/ddtrace/configuration/components.rb b/lib/ddtrace/configuration/components.rb index 2dee58cc5b3..afdc5c58b3b 100644 --- a/lib/ddtrace/configuration/components.rb +++ b/lib/ddtrace/configuration/components.rb @@ -135,13 +135,13 @@ def teardown!(replacement = nil) old_statsd = [ runtime_metrics.metrics.statsd, health_metrics.statsd - ].uniq + ].compact.uniq new_statsd = if replacement [ replacement.runtime_metrics.metrics.statsd, replacement.health_metrics.statsd - ].uniq + ].compact.uniq else [] end diff --git a/spec/ddtrace/configuration/components_spec.rb b/spec/ddtrace/configuration/components_spec.rb index 0aaff03f7b5..a92474a4fb9 100644 --- a/spec/ddtrace/configuration/components_spec.rb +++ b/spec/ddtrace/configuration/components_spec.rb @@ -673,6 +673,25 @@ teardown! end + + context 'and Statsd is not initialized' do + before do + allow(components.runtime_metrics.metrics) + .to receive(:statsd) + .and_return(nil) + end + + it 'shuts down all components' do + expect(components.tracer).to receive(:shutdown!) + expect(components.runtime_metrics).to receive(:enabled=) + .with(false) + expect(components.runtime_metrics).to receive(:stop) + .with(true) + expect(components.health_metrics.statsd).to receive(:close) + + teardown! + end + end end context 'when the tracer is re-used' do From a847e696855b0ce0ce16757e22523809112d09b8 Mon Sep 17 00:00:00 2001 From: Marco Costa Date: Tue, 5 May 2020 15:27:16 -0400 Subject: [PATCH 2/3] Added: 0.35.1 to CHANGELOG.md --- CHANGELOG.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bcf45f76b9..cbeea9dd1f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ ## [Unreleased] +## [0.35.1] - 2020-05-05 + +Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.35.1 + +Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.35.0...v0.35.1 + +### Fixed + +- Components#teardown! NoMethodError (#1021, #1023) (@bzf) + ## [0.35.0] - 2020-04-29 Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.35.0 @@ -1195,7 +1205,8 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1 Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1 -[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v0.35.0...master +[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v0.35.1...master +[0.35.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.35.0...v0.35.1 [0.35.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.34.2...v0.35.0 [0.34.2]: https://github.com/DataDog/dd-trace-rb/compare/v0.34.1...v0.34.2 [0.34.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.34.0...v0.34.1 From bed70809f3e21bb85ca72dc054527f2908f19371 Mon Sep 17 00:00:00 2001 From: Marco Costa Date: Tue, 5 May 2020 15:29:08 -0400 Subject: [PATCH 3/3] bumping version 0.35.0 => 0.35.1 --- lib/ddtrace/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ddtrace/version.rb b/lib/ddtrace/version.rb index db37a5244eb..2f373b5fd2b 100644 --- a/lib/ddtrace/version.rb +++ b/lib/ddtrace/version.rb @@ -2,7 +2,7 @@ module Datadog module VERSION MAJOR = 0 MINOR = 35 - PATCH = 0 + PATCH = 1 PRE = nil STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')