diff --git a/Gemfile b/Gemfile index 680d337f2..0dbcca70d 100644 --- a/Gemfile +++ b/Gemfile @@ -23,7 +23,7 @@ gem "carrierwave", "~> 2.2" # Upload files in your Ruby applications, map them t gem "carrierwave-bombshelter", "~> 0.2" # Protect your carrierwave from image bombs gem "cloudinary", "~> 1.23" # Client library for easily using the Cloudinary service gem "counter_culture", "~> 3.2" # counter_culture provides turbo-charged counter caches that are kept up-to-date -gem "ddtrace", "~> 1.0.0" # ddtrace is Datadog’s tracing client for Ruby. +gem "ddtrace", "~> 0.54.2" # ddtrace is Datadog’s tracing client for Ruby. gem "devise", "~> 4.8" # Flexible authentication solution for Rails gem "devise_invitable", "~> 2.0.6" # Allows invitations to be sent for joining gem "dogstatsd-ruby", "~> 4.8" # A client for DogStatsD, an extension of the StatsD metric server for Datadog diff --git a/Gemfile.lock b/Gemfile.lock index 782720496..7b8db340e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -182,12 +182,11 @@ GEM puma (>= 3.8.0) railties (>= 5.2.0) dante (0.2.0) - ddtrace (1.0.0) - debase-ruby_core_source (<= 0.10.15) - libddwaf (~> 1.3.0.0.0.a) + ddtrace (0.54.2) + debase-ruby_core_source (<= 0.10.14) msgpack dead_end (1.1.7) - debase-ruby_core_source (0.10.15) + debase-ruby_core_source (0.10.14) debug (1.5.0) irb (>= 1.3.6) reline (>= 0.2.7) @@ -461,14 +460,6 @@ GEM kramdown (~> 2.0) launchy (2.5.0) addressable (~> 2.7) - libddwaf (1.3.0.0.0) - ffi (~> 1.0) - libddwaf (1.3.0.0.0-arm64-darwin) - ffi (~> 1.0) - libddwaf (1.3.0.0.0-x86_64-darwin) - ffi (~> 1.0) - libddwaf (1.3.0.0.0-x86_64-linux) - ffi (~> 1.0) libhoney (2.1.0) addressable (~> 2.0) excon @@ -513,7 +504,7 @@ GEM connection_pool (>= 2) msgpack (>= 0.5) redis (>= 3.0) - msgpack (1.5.1) + msgpack (1.4.5) multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) @@ -972,7 +963,7 @@ DEPENDENCIES cloudinary (~> 1.23) counter_culture (~> 3.2) cypress-rails (~> 0.5) - ddtrace (~> 1.0.0) + ddtrace (~> 0.54.2) debug (>= 1.0.0) derailed_benchmarks (~> 2.1) devise (~> 4.8) diff --git a/app/controllers/stories/feeds_controller.rb b/app/controllers/stories/feeds_controller.rb index 5e091885d..08b60a7e7 100644 --- a/app/controllers/stories/feeds_controller.rb +++ b/app/controllers/stories/feeds_controller.rb @@ -46,10 +46,10 @@ module Stories number_of_articles: 25, ) end - Datadog::Tracing.trace("feed.query", - span_type: "db", - resource: "#{self.class}.#{__method__}", - tags: { feed_class: feed.class.to_s.dasherize }) do + Datadog.tracer.trace("feed.query", + span_type: "db", + resource: "#{self.class}.#{__method__}", + tags: { feed_class: feed.class.to_s.dasherize }) do # Hey, why the to_a you say? Because the # LargeForemExperimental has already done this. But the # weighted strategy has not. I also don't want to alter the @@ -71,10 +71,10 @@ module Stories number_of_articles: 25, ) end - Datadog::Tracing.trace("feed.query", - span_type: "db", - resource: "#{self.class}.#{__method__}", - tags: { feed_class: feed.class.to_s.dasherize }) do + Datadog.tracer.trace("feed.query", + span_type: "db", + resource: "#{self.class}.#{__method__}", + tags: { feed_class: feed.class.to_s.dasherize }) do # Hey, why the to_a you say? Because the # LargeForemExperimental has already done this. But the # weighted strategy has not. I also don't want to alter the diff --git a/app/services/instrumentation.rb b/app/services/instrumentation.rb index d846f9ac5..47f1eb3e7 100644 --- a/app/services/instrumentation.rb +++ b/app/services/instrumentation.rb @@ -2,6 +2,6 @@ module Instrumentation def instrument(operation, tags: [], &block) # TODO: (@jgaskins): Extract the knowledge of which tracing library # we're using, like we did with ForemStatsDriver - Datadog::Tracing.trace operation, tags: tags, &block + Datadog.tracer.trace operation, tags: tags, &block end end diff --git a/config/initializers/datadog.rb b/config/initializers/datadog.rb index 73fc0de4f..f221a3e20 100644 --- a/config/initializers/datadog.rb +++ b/config/initializers/datadog.rb @@ -1,36 +1,36 @@ Datadog.configure do |c| - c.env = Rails.env - c.tracing.enabled = ENV["DD_API_KEY"].present? - c.tracing.partial_flush.enabled = true - c.tracing.priority_sampling = true ## Can't find this in the new api, and I think it's on by default + c.tracer env: Rails.env + c.tracer enabled: ENV["DD_API_KEY"].present? + c.tracer partial_flush: true + c.tracer priority_sampling: true - c.tracing.instrument :concurrent_ruby - c.tracing.instrument :excon, split_by_domain: true - c.tracing.instrument :faraday, split_by_domain: true - c.tracing.instrument :http, split_by_domain: false - c.tracing.instrument :httpclient, split_by_domain: false - c.tracing.instrument :httprb, split_by_domain: true - c.tracing.instrument :rails + c.use :concurrent_ruby + c.use :excon, split_by_domain: true + c.use :faraday, split_by_domain: true + c.use :http, split_by_domain: false + c.use :httpclient, split_by_domain: false + c.use :httprb, split_by_domain: true + c.use :rails - c.tracing.instrument :rest_client - c.tracing.instrument :sidekiq + c.use :rest_client + c.use :sidekiq # Multiple Redis integrations to split Redis usage per-instance to # accommodate having a different Redis instance for each use case. - c.tracing.instrument :redis, service_name: "redis-rpush", describes: { url: ENV.fetch("REDIS_RPUSH_URL", nil) } - c.tracing.instrument :redis, service_name: "redis-sessions", describes: { url: ENV.fetch("REDIS_SESSIONS_URL", nil) } + c.use :redis, service_name: "redis-rpush", describes: { url: ENV["REDIS_RPUSH_URL"] } + c.use :redis, service_name: "redis-sessions", describes: { url: ENV["REDIS_SESSIONS_URL"] } # Sidekiq jobs that spin up thousands of other jobs end up consuming a # *lot* of memory on instrumentation alone. This env var allows us to # enable it only when needed. - if ENV.fetch("DD_ENABLE_REDIS_SIDEKIQ", nil) == "true" - c.tracing.instrument :redis, service_name: "redis-sidekiq", describes: { url: ENV.fetch("REDIS_SIDEKIQ_URL", nil) } + if ENV["DD_ENABLE_REDIS_SIDEKIQ"] == "true" + c.use :redis, service_name: "redis-sidekiq", describes: { url: ENV["REDIS_SIDEKIQ_URL"] } end # Generic REDIS_URL comes last, allowing it to overwrite any of the # above when multiple Redis use cases are backed by the same Redis URL. - c.tracing.instrument :redis, service_name: "redis", describes: { url: ENV.fetch("REDIS_URL", nil) } + c.use :redis, service_name: "redis", describes: { url: ENV["REDIS_URL"] } end ForemStatsClient = Datadog::Statsd.new diff --git a/vendor/cache/ddtrace-0.54.2.gem b/vendor/cache/ddtrace-0.54.2.gem new file mode 100644 index 000000000..9963ccb79 Binary files /dev/null and b/vendor/cache/ddtrace-0.54.2.gem differ diff --git a/vendor/cache/ddtrace-1.0.0.gem b/vendor/cache/ddtrace-1.0.0.gem deleted file mode 100644 index 4294bd19a..000000000 Binary files a/vendor/cache/ddtrace-1.0.0.gem and /dev/null differ diff --git a/vendor/cache/debase-ruby_core_source-0.10.14.gem b/vendor/cache/debase-ruby_core_source-0.10.14.gem new file mode 100644 index 000000000..d6ba8836d Binary files /dev/null and b/vendor/cache/debase-ruby_core_source-0.10.14.gem differ diff --git a/vendor/cache/debase-ruby_core_source-0.10.15.gem b/vendor/cache/debase-ruby_core_source-0.10.15.gem deleted file mode 100644 index 5bc4a02ad..000000000 Binary files a/vendor/cache/debase-ruby_core_source-0.10.15.gem and /dev/null differ diff --git a/vendor/cache/libddwaf-1.3.0.0.0-arm64-darwin.gem b/vendor/cache/libddwaf-1.3.0.0.0-arm64-darwin.gem deleted file mode 100644 index d86335213..000000000 Binary files a/vendor/cache/libddwaf-1.3.0.0.0-arm64-darwin.gem and /dev/null differ diff --git a/vendor/cache/libddwaf-1.3.0.0.0-x86_64-darwin.gem b/vendor/cache/libddwaf-1.3.0.0.0-x86_64-darwin.gem deleted file mode 100644 index 7cd0043b3..000000000 Binary files a/vendor/cache/libddwaf-1.3.0.0.0-x86_64-darwin.gem and /dev/null differ diff --git a/vendor/cache/libddwaf-1.3.0.0.0-x86_64-linux.gem b/vendor/cache/libddwaf-1.3.0.0.0-x86_64-linux.gem deleted file mode 100644 index a5929978e..000000000 Binary files a/vendor/cache/libddwaf-1.3.0.0.0-x86_64-linux.gem and /dev/null differ diff --git a/vendor/cache/libddwaf-1.3.0.0.0.gem b/vendor/cache/libddwaf-1.3.0.0.0.gem deleted file mode 100644 index 311dfcddc..000000000 Binary files a/vendor/cache/libddwaf-1.3.0.0.0.gem and /dev/null differ diff --git a/vendor/cache/msgpack-1.4.5.gem b/vendor/cache/msgpack-1.4.5.gem new file mode 100644 index 000000000..1427ec4d0 Binary files /dev/null and b/vendor/cache/msgpack-1.4.5.gem differ diff --git a/vendor/cache/msgpack-1.5.1.gem b/vendor/cache/msgpack-1.5.1.gem deleted file mode 100644 index 04538ba45..000000000 Binary files a/vendor/cache/msgpack-1.5.1.gem and /dev/null differ