Skip to content

Commit

Permalink
Merge pull request #4422 from pulibrary/only-instrument-datadog-in-prod
Browse files Browse the repository at this point in the history
Only load datadog in production
  • Loading branch information
sandbergja authored Oct 4, 2024
2 parents c0085b8 + 28eae14 commit 1af8ff3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ gem 'bootstrap', '~> 4.6'
# In the Capistrano documentation, it has these limited to the development group, and `require: false``
gem 'capistrano', '~> 3.4'
gem 'capistrano-passenger'
gem 'ddtrace'
# Authentication and authorization
gem 'devise'
gem 'devise-guests'
Expand Down Expand Up @@ -120,3 +119,6 @@ group :development, :test do
gem 'pry-byebug'
gem 'solargraph'
end
group :production do
gem 'datadog', require: 'datadog/auto_instrument'
end
19 changes: 8 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,12 @@ GEM
rexml
crass (1.0.6)
csv (3.3.0)
datadog-ci (0.8.3)
msgpack
date (3.3.4)
ddtrace (1.23.3)
datadog-ci (~> 0.8.1)
datadog (2.3.0)
debase-ruby_core_source (= 3.3.1)
libdatadog (~> 7.0.0.1.0)
libdatadog (~> 11.0.0.1.0)
libddwaf (~> 1.14.0.0.0)
msgpack
date (3.3.4)
debase-ruby_core_source (3.3.1)
deprecation (1.1.0)
activesupport
Expand Down Expand Up @@ -348,9 +345,9 @@ GEM
kramdown (~> 2.0)
language_server-protocol (3.17.0.3)
lcsort (0.9.1)
libdatadog (7.0.0.1.0)
libdatadog (7.0.0.1.0-aarch64-linux)
libdatadog (7.0.0.1.0-x86_64-linux)
libdatadog (11.0.0.1.0)
libdatadog (11.0.0.1.0-aarch64-linux)
libdatadog (11.0.0.1.0-x86_64-linux)
libddwaf (1.14.0.0.0)
ffi (~> 1.0)
libddwaf (1.14.0.0.0-aarch64-linux)
Expand Down Expand Up @@ -389,7 +386,7 @@ GEM
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.25.1)
msgpack (1.7.2)
msgpack (1.7.3)
multi_xml (0.6.0)
mutex_m (0.2.0)
net-http (0.4.1)
Expand Down Expand Up @@ -747,7 +744,7 @@ DEPENDENCIES
capistrano-rails
capybara
coveralls_reborn
ddtrace
datadog
devise
devise-guests
ed25519
Expand Down
20 changes: 11 additions & 9 deletions config/initializers/datadog.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# frozen_string_literal: true

Datadog.configure do |c|
c.tracing.enabled = false unless Rails.env.production?
c.env = 'production'
# Rails
c.tracing.instrument :rails
if Rails.env.production?
Datadog.configure do |c|
c.tracing.enabled = false
c.env = 'production'
# Rails
c.tracing.instrument :rails

# Net::HTTP
c.tracing.instrument :http
# Net::HTTP
c.tracing.instrument :http

# Faraday
c.tracing.instrument :faraday
# Faraday
c.tracing.instrument :faraday
end
end

0 comments on commit 1af8ff3

Please sign in to comment.