Sha256: e8f40a69a76118ab66cc76f89a58124425d41cd0fc60053ce33aa7dcc34626f8

Contents?: true

Size: 762 Bytes

Versions: 2

Compression:

Stored size: 762 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Instrumentation
    module RSpec
      # The Instrumentation class contains logic to detect and install the Rspec instrumentation
      class Instrumentation < OpenTelemetry::Instrumentation::Base
        install do |_config|
          require_dependencies
          add_formatter!
        end

        present do
          defined?(::RSpec)
        end

        private

        def require_dependencies
          require_relative 'formatter'
        end

        def add_formatter!
          ::RSpec.configure do |config|
            config.add_formatter(Formatter)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-rspec-0.3.3 lib/opentelemetry/instrumentation/rspec/instrumentation.rb
opentelemetry-instrumentation-rspec-0.3.2 lib/opentelemetry/instrumentation/rspec/instrumentation.rb