Sha256: 503d734f2e834d98adc73115994bf19a18e2887ed24a260712c2c999de752b88

Contents?: true

Size: 764 Bytes

Versions: 5

Compression:

Stored size: 764 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

5 entries across 5 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-rspec-0.3.1 lib/opentelemetry/instrumentation/rspec/instrumentation.rb
opentelemetry-instrumentation-rspec-0.3.0 lib/opentelemetry/instrumentation/rspec/instrumentation.rb
opentelemetry-instrumentation-rspec-0.2.1 lib/opentelemetry/instrumentation/rspec/instrumentation.rb
opentelemetry-instrumentation-rspec-0.2.0 lib/opentelemetry/instrumentation/rspec/instrumentation.rb
opentelemetry-instrumentation-rspec-0.1.0 lib/opentelemetry/instrumentation/rspec/instrumentation.rb