Sha256: 8a71ee5f892290a7c396df8444b28c85c852a9b68aff76c002489357d049d8f9

Contents?: true

Size: 866 Bytes

Versions: 14

Compression:

Stored size: 866 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Instrumentation
    module ActiveRecord
      module Patches
        # Module to prepend to ActiveRecord::Base for instrumentation
        module Querying
          def self.prepended(base)
            class << base
              prepend ClassMethods
            end
          end

          # Contains ActiveRecord::Querying to be patched
          module ClassMethods
            def find_by_sql(sql, binds = [], preparable: nil, &block)
              tracer.in_span("#{self}.find_by_sql") do
                super
              end
            end

            private

            def tracer
              ActiveRecord::Instrumentation.instance.tracer
            end
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-active_record-0.7.0 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.6.3 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.6.2 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.6.1 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.6.0 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.5.0 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.4.1 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.4.0 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.3.0 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.2.2 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.2.1 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.2.0 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.1.1 lib/opentelemetry/instrumentation/active_record/patches/querying.rb
opentelemetry-instrumentation-active_record-0.1.0 lib/opentelemetry/instrumentation/active_record/patches/querying.rb