diff --git a/Gemfile b/Gemfile index cd6a1e235..a61523e51 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", "~> 0.54.2" # ddtrace is Datadog’s tracing client for Ruby. +gem "ddtrace", "~> 1.0.0" # 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 6ce3c9198..0f2c7bfa1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -182,11 +182,12 @@ GEM puma (>= 3.8.0) railties (>= 5.2.0) dante (0.2.0) - ddtrace (0.54.2) - debase-ruby_core_source (<= 0.10.14) + ddtrace (1.0.0) + debase-ruby_core_source (<= 0.10.15) + libddwaf (~> 1.3.0.0.0.a) msgpack dead_end (1.1.7) - debase-ruby_core_source (0.10.14) + debase-ruby_core_source (0.10.15) debug (1.5.0) irb (>= 1.3.6) reline (>= 0.2.7) @@ -460,6 +461,14 @@ 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 @@ -504,7 +513,7 @@ GEM connection_pool (>= 2) msgpack (>= 0.5) redis (>= 3.0) - msgpack (1.4.5) + msgpack (1.5.1) multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) @@ -963,7 +972,7 @@ DEPENDENCIES cloudinary (~> 1.23) counter_culture (~> 3.2) cypress-rails (~> 0.5) - ddtrace (~> 0.54.2) + ddtrace (~> 1.0.0) 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 08b60a7e7..5e091885d 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.tracer.trace("feed.query", - span_type: "db", - resource: "#{self.class}.#{__method__}", - tags: { feed_class: feed.class.to_s.dasherize }) do + Datadog::Tracing.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.tracer.trace("feed.query", - span_type: "db", - resource: "#{self.class}.#{__method__}", - tags: { feed_class: feed.class.to_s.dasherize }) do + Datadog::Tracing.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 47f1eb3e7..d846f9ac5 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.tracer.trace operation, tags: tags, &block + Datadog::Tracing.trace operation, tags: tags, &block end end diff --git a/config/initializers/datadog.rb b/config/initializers/datadog.rb index f221a3e20..73fc0de4f 100644 --- a/config/initializers/datadog.rb +++ b/config/initializers/datadog.rb @@ -1,36 +1,36 @@ Datadog.configure do |c| - c.tracer env: Rails.env - c.tracer enabled: ENV["DD_API_KEY"].present? - c.tracer partial_flush: true - c.tracer priority_sampling: true + 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.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 :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 :rest_client - c.use :sidekiq + c.tracing.instrument :rest_client + c.tracing.instrument :sidekiq # Multiple Redis integrations to split Redis usage per-instance to # accommodate having a different Redis instance for each use case. - 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"] } + 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) } # 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["DD_ENABLE_REDIS_SIDEKIQ"] == "true" - c.use :redis, service_name: "redis-sidekiq", describes: { url: ENV["REDIS_SIDEKIQ_URL"] } + 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) } 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.use :redis, service_name: "redis", describes: { url: ENV["REDIS_URL"] } + c.tracing.instrument :redis, service_name: "redis", describes: { url: ENV.fetch("REDIS_URL", nil) } end ForemStatsClient = Datadog::Statsd.new diff --git a/vendor/cache/ddtrace-0.54.2.gem b/vendor/cache/ddtrace-0.54.2.gem deleted file mode 100644 index 9963ccb79..000000000 Binary files a/vendor/cache/ddtrace-0.54.2.gem and /dev/null differ diff --git a/vendor/cache/ddtrace-1.0.0.gem b/vendor/cache/ddtrace-1.0.0.gem new file mode 100644 index 000000000..4294bd19a Binary files /dev/null and b/vendor/cache/ddtrace-1.0.0.gem 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 deleted file mode 100644 index d6ba8836d..000000000 Binary files a/vendor/cache/debase-ruby_core_source-0.10.14.gem and /dev/null 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 new file mode 100644 index 000000000..5bc4a02ad Binary files /dev/null and b/vendor/cache/debase-ruby_core_source-0.10.15.gem 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 new file mode 100644 index 000000000..d86335213 Binary files /dev/null and b/vendor/cache/libddwaf-1.3.0.0.0-arm64-darwin.gem 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 new file mode 100644 index 000000000..7cd0043b3 Binary files /dev/null and b/vendor/cache/libddwaf-1.3.0.0.0-x86_64-darwin.gem 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 new file mode 100644 index 000000000..a5929978e Binary files /dev/null and b/vendor/cache/libddwaf-1.3.0.0.0-x86_64-linux.gem differ diff --git a/vendor/cache/libddwaf-1.3.0.0.0.gem b/vendor/cache/libddwaf-1.3.0.0.0.gem new file mode 100644 index 000000000..311dfcddc Binary files /dev/null and b/vendor/cache/libddwaf-1.3.0.0.0.gem differ diff --git a/vendor/cache/msgpack-1.4.5.gem b/vendor/cache/msgpack-1.4.5.gem deleted file mode 100644 index 1427ec4d0..000000000 Binary files a/vendor/cache/msgpack-1.4.5.gem and /dev/null differ diff --git a/vendor/cache/msgpack-1.5.1.gem b/vendor/cache/msgpack-1.5.1.gem new file mode 100644 index 000000000..04538ba45 Binary files /dev/null and b/vendor/cache/msgpack-1.5.1.gem differ