Skip to content

Commit

Permalink
Merge pull request #59 from pulibrary/datadog
Browse files Browse the repository at this point in the history
Add datadog gems and configuration
  • Loading branch information
christinach authored Sep 14, 2023
2 parents fe0b560 + bc4f829 commit 191a786
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ gem 'activemodel'
gem 'activerecord'
gem 'activesupport'
gem 'bootsnap', require: false
gem 'ddtrace', require: 'ddtrace/auto_instrument'
gem 'dogstatsd-ruby'
gem 'pg'
gem 'puma', '~> 5.0'
gem 'railties'
Expand Down
18 changes: 18 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,30 @@ GEM
crack (0.4.5)
rexml
crass (1.0.6)
ddtrace (1.14.0)
debase-ruby_core_source (= 3.2.1)
libdatadog (~> 3.0.0.1.0)
libddwaf (~> 1.9.0.0.0)
msgpack
debase-ruby_core_source (3.2.1)
diff-lcs (1.5.0)
dogstatsd-ruby (5.6.1)
erubi (1.12.0)
ffi (1.15.5)
hashdiff (1.0.1)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.6.3)
kwalify (0.7.2)
language_server-protocol (3.17.0.3)
libdatadog (3.0.0.1.0)
libdatadog (3.0.0.1.0-x86_64-linux)
libddwaf (1.9.0.0.1-arm64-darwin)
ffi (~> 1.0)
libddwaf (1.9.0.0.1-x86_64-darwin)
ffi (~> 1.0)
libddwaf (1.9.0.0.1-x86_64-linux)
ffi (~> 1.0)
loofah (2.21.3)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -166,6 +182,8 @@ DEPENDENCIES
activerecord
activesupport
bootsnap
ddtrace
dogstatsd-ruby
pg
pry-byebug
puma (~> 5.0)
Expand Down
39 changes: 39 additions & 0 deletions config/initializers/datadog.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

require 'datadog/statsd'
require 'ddtrace'

Datadog.configure do |c|
c.env = Rails.env
c.service = 'allsearch-backend'
c.tracing.report_hostname = true
c.tracing.analytics.enabled = true
c.tracing.enabled = Rails.env.production?
c.tracing.report_hostname = true
c.tracing.log_injection = true

# From https://docs.datadoghq.com/tracing/metrics/runtime_metrics/ruby/
# To enable runtime metrics collection, set `true`. Defaults to `false`
# You can also set DD_RUNTIME_METRICS_ENABLED=true to configure this.
c.runtime_metrics.enabled = true

# Optionally, you can configure the DogStatsD instance used for sending runtime metrics.
# DogStatsD is automatically configured with default settings if `dogstatsd-ruby` is available.
# You can configure with host and port of Datadog agent; defaults to 'localhost:8125'.
c.runtime_metrics.statsd = Datadog::Statsd.new

# Rails
c.tracing.instrument :rails

# Redis
c.tracing.instrument :redis

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

# Sidekiq
c.tracing.instrument :sidekiq

# Faraday
c.tracing.instrument :faraday
end

0 comments on commit 191a786

Please sign in to comment.