Skip to content

Commit

Permalink
Connect logs and traces. #470
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 15, 2020
1 parent 09c8873 commit 74c23ab
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,18 @@ class Application < Rails::Application
config.lograge.base_controller_class = "ActionController::API"

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

exceptions = %w(controller action format id)

{
# Adds IDs as tags to log output
dd: {
trace_id: correlation.trace_id,
span_id: correlation.span_id
},
ddsource: ["ruby"],
params: event.payload[:params].except(*exceptions),
uid: event.payload[:uid],
}
Expand Down

0 comments on commit 74c23ab

Please sign in to comment.