Sha256: fce4ecdc3d3cb9d356a1362e106dd793ea2ba26f9923d19ee739fb0a60ffd4ee

Contents?: true

Size: 808 Bytes

Versions: 5

Compression:

Stored size: 808 Bytes

Contents

# typed: true
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

5 entries across 5 versions & 1 rubygems

Version Path
ddtrace-0.54.2 lib/ddtrace/contrib/presto/patcher.rb
ddtrace-0.54.1 lib/ddtrace/contrib/presto/patcher.rb
ddtrace-0.54.0 lib/ddtrace/contrib/presto/patcher.rb
ddtrace-0.53.0 lib/ddtrace/contrib/presto/patcher.rb
ddtrace-0.52.0 lib/ddtrace/contrib/presto/patcher.rb