Sha256: 1108637f5e9441d09f6de0691597b9d2ec08653ad7d8109ee52d6dac8eb4f1ea

Contents?: true

Size: 999 Bytes

Versions: 16

Compression:

Stored size: 999 Bytes

Contents

module Datadog
  module Tracing
    module Contrib
      # Instrument Rails.
      module Rails
        # Rails log injection helper methods
        module LogInjection
          module_function

          # Use `app.config.log_tags` to inject propagation tags into the default Rails logger.
          def configure_log_tags(app_config)
            # When using SemanticLogger, app_config.log_tags could be a Hash and should not be modified here
            return unless app_config.log_tags.nil? || app_config.log_tags.respond_to?(:<<)

            app_config.log_tags ||= [] # Can be nil, we initialized it if so
            app_config.log_tags << proc { Tracing.log_correlation if Datadog.configuration.tracing.log_injection }
          rescue StandardError => e
            Datadog.logger.warn(
              "Unable to add Datadog Trace context to ActiveSupport::TaggedLogging: #{e.class.name} #{e.message}"
            )
            false
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ddtrace-1.23.3 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.23.2 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.23.1 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.22.0 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.21.1 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.21.0 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.20.0 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.19.0 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.18.0 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.17.0 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.16.2 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.16.1 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.16.0 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.15.0 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.14.0 lib/datadog/tracing/contrib/rails/log_injection.rb
ddtrace-1.13.1 lib/datadog/tracing/contrib/rails/log_injection.rb