Skip to content

Commit

Permalink
fix: add logs and traces correlation for datadog
Browse files Browse the repository at this point in the history
  • Loading branch information
karolsojko committed Oct 19, 2020
1 parent de43030 commit a5860ff
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions config/initializers/lograge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@
config.lograge.formatter = Lograge::Formatters::Json.new
config.lograge.ignore_actions = ['HealthCheckController#index']
config.lograge.custom_options = lambda do |event|
correlation = Datadog.tracer.active_correlation
{
:ddsource => ["ruby"],
:time => event.time,
:params => event.payload[:params],
:level => event.payload[:level]
dd: {
trace_id: correlation.trace_id.to_s,
span_id: correlation.span_id.to_s,
env: correlation.env.to_s,
service: correlation.service.to_s,
version: correlation.version.to_s
},
ddsource: ['ruby'],
time: event.time,
params: event.payload[:params],
level: event.payload[:level]
}
end
end

0 comments on commit a5860ff

Please sign in to comment.