Sha256: 2b7177a3ce7a77e018f3a7bb2a4b28f9f9f3abc81a4bb049ab782b18c3d2d261

Contents?: true

Size: 794 Bytes

Versions: 3

Compression:

Stored size: 794 Bytes

Contents

require 'ddtrace/contrib/patcher'
require 'ddtrace/contrib/presto/ext'
require 'ddtrace/contrib/presto/instrumentation'
require 'ddtrace/utils/only_once'

module Datadog
  module Contrib
    module Presto
      # Patcher enables patching of 'presto-client' module.
      module Patcher
        include Contrib::Patcher

        PATCH_ONLY_ONCE = Datadog::Utils::OnlyOnce.new

        module_function

        def patched?
          PATCH_ONLY_ONCE.ran?
        end

        def patch
          PATCH_ONLY_ONCE.run do
            begin
              ::Presto::Client::Client.include(Instrumentation::Client)
            rescue StandardError => e
              Datadog.logger.error("Unable to apply Presto integration: #{e}")
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ddtrace-0.51.1 lib/ddtrace/contrib/presto/patcher.rb
ddtrace-0.51.0 lib/ddtrace/contrib/presto/patcher.rb
ddtrace-0.50.0 lib/ddtrace/contrib/presto/patcher.rb