Skip to content

Commit

Permalink
Merge pull request #1354 from DataDog/fix/metrics-statsd-init-flaky
Browse files Browse the repository at this point in the history
[ART-380] Fix ArgumentError due to concurrent require and class use
  • Loading branch information
ivoanjo authored Feb 5, 2021
2 parents 9ee8fc7 + 4863e65 commit d6e0e93
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ gem 'redcarpet', '~> 3.4' if RUBY_PLATFORM != 'java'
gem 'rspec', '~> 3.0'
gem 'rspec-collection_matchers', '~> 1.1'
gem 'rspec_junit_formatter', '>= 0.4.1'
gem 'rspec_n', '~> 1.3' if RUBY_VERSION >= '2.3.0'
gem 'rubocop', '= 0.50.0' if RUBY_VERSION >= '2.1.0'
gem 'ruby-prof', '~> 1.4' if RUBY_PLATFORM != 'java' && RUBY_VERSION >= '2.4.0'
gem 'simplecov', '~> 0.17'
Expand Down
2 changes: 1 addition & 1 deletion lib/ddtrace/metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def default_port
end

def default_statsd_client
require 'datadog/statsd' unless defined?(::Datadog::Statsd)
require 'datadog/statsd'

# Create a StatsD client that points to the agent.
Datadog::Statsd.new(default_hostname, default_port)
Expand Down
4 changes: 4 additions & 0 deletions spec/ddtrace/tracer_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
subject(:tracer) { described_class.new(writer: FauxWriter.new) }
let(:spans) { tracer.writer.spans(:keep) }

after do
tracer.shutdown! # Ensure no state gets left behind
end

def sampling_priority_metric(span)
span.get_metric(Datadog::Ext::DistributedTracing::SAMPLING_PRIORITY_KEY)
end
Expand Down

0 comments on commit d6e0e93

Please sign in to comment.