Skip to content

Commit

Permalink
Update datadog tracing to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed Jan 11, 2024
1 parent a19ba8f commit a9af66b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ gem "countries", "~> 2.1", ">= 2.1.2"
gem "country_select", "~> 3.1"
gem "crawler_detect"
gem "dalli", "~> 2.7", ">= 2.7.6"
gem "ddtrace", "~> 0.32.0"
gem 'ddtrace', require: 'ddtrace/auto_instrument'
gem "departure", "~> 6.2"
gem "diffy", "~> 3.2", ">= 3.2.1"
gem "dotenv"
Expand Down
17 changes: 1 addition & 16 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,6 @@ class Application < Rails::Application
# secret_key_base is not used by Rails API, as there are no sessions
config.secret_key_base = "blipblapblup"

# enable datadog tracing here so that we can inject tracing
# information into logs
Datadog.configure do |c|
c.tracer hostname: "datadog.local",
enabled: Rails.env.production?,
env: Rails.env
c.use :rails, service_name: "client-api"
c.use :elasticsearch
c.use :active_record, analytics_enabled: false
# define graphql integration in app/graphql/lupo_schema.rb
# c.use :graphql, schemas: [LupoSchema]
c.analytics_enabled = true
end

# disable ActiveJob logging, as it is very verbose at log level INFO
config.active_job.logger = Logger.new(nil)

Expand All @@ -132,8 +118,7 @@ class Application < Rails::Application

config.lograge.custom_options = lambda do |event|
# Retrieves trace information for current thread
correlation =
Datadog.tracer.active_correlation
correlation = Datadog::Tracing.correlation

exceptions = %w[controller action format id]

Expand Down
17 changes: 17 additions & 0 deletions config/initializers/datadog.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'ddtrace'

Datadog.configure do |c|
# Global
c.agent.host = 'datadog.local'
c.runtime_metrics.enabled = true
c.service = 'client-api'
c.env = Rails.env

# Tracing settings
c.tracing.analytics.enabled = Rails.env.production?

# Instrumentation
c.tracing.instrument :rails
c.tracing.instrument :elasticsearch
c.tracing.instrument :shoryuken
end

0 comments on commit a9af66b

Please sign in to comment.