Sha256: 78697bf2d64774dbc8a834848a97e756d80bb6b0e233557b0fca03d6b6393279
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
# frozen_string_literal: true # Copyright The OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Instrumentation module Faraday # The Instrumentation class contains logic to detect and install the Faraday # instrumentation class Instrumentation < OpenTelemetry::Instrumentation::Base MINIMUM_VERSION = Gem::Version.new('1.0') install do |_config| require_dependencies register_tracer_middleware use_middleware_by_default end compatible do gem_version >= MINIMUM_VERSION end present do defined?(::Faraday) end option :span_kind, default: :client, validate: %i[client internal] option :peer_service, default: nil, validate: :string private def gem_version Gem::Version.new(::Faraday::VERSION) end def require_dependencies require_relative 'middlewares/tracer_middleware' require_relative 'patches/connection' end def register_tracer_middleware ::Faraday::Middleware.register_middleware( open_telemetry: Middlewares::TracerMiddleware ) end def use_middleware_by_default ::Faraday::Connection.prepend(Patches::Connection) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems