Sha256: 36c99c98afe14c7e3109318c6dd8cac41ac4d0a7505e2f57693027fdce8a1012

Contents?: true

Size: 799 Bytes

Versions: 6

Compression:

Stored size: 799 Bytes

Contents

# frozen_string_literal: true

# Copyright 2020 OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

module OpenTelemetry
  module Instrumentation
    module Excon
      # The Instrumentation class contains logic to detect and install the Excon
      # instrumentation
      class Instrumentation < OpenTelemetry::Instrumentation::Base
        install do |_config|
          require_dependencies
          add_middleware
        end

        present do
          defined?(::Excon)
        end

        private

        def require_dependencies
          require_relative 'middlewares/tracer_middleware'
        end

        def add_middleware
          ::Excon.defaults[:middlewares] =
            Middlewares::TracerMiddleware.around_default_stack
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-excon-0.10.0 lib/opentelemetry/instrumentation/excon/instrumentation.rb
opentelemetry-instrumentation-excon-0.9.0 lib/opentelemetry/instrumentation/excon/instrumentation.rb
opentelemetry-instrumentation-excon-0.8.0 lib/opentelemetry/instrumentation/excon/instrumentation.rb
opentelemetry-instrumentation-excon-0.7.0 lib/opentelemetry/instrumentation/excon/instrumentation.rb
opentelemetry-instrumentation-excon-0.6.0 lib/opentelemetry/instrumentation/excon/instrumentation.rb
opentelemetry-instrumentation-excon-0.5.0 lib/opentelemetry/instrumentation/excon/instrumentation.rb