From 74c23abb876cbcb90d7dcb3cf4a88a236f0f5193 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Wed, 15 Apr 2020 19:57:36 +0200 Subject: [PATCH] Connect logs and traces. #470 --- config/application.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/application.rb b/config/application.rb index ef92425a5..c9f644d72 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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], }