Sha256: 708d0a9a73ea18e47328f4e2944b070a09f1a29e611ce7e93d2315febd2d84e7
Contents?: true
Size: 1.1 KB
Versions: 16
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true require "active_record" require "opentracing" require "active_record/open_tracing/version" require "active_record/open_tracing/processor" require "active_record/open_tracing/sql_sanitizer" module ActiveRecord module OpenTracing # Instruments activerecord for use with OpenTracing # # @param tracer [OpenTracing::Tracer] The tracer to which to send traces # @param sanitizer [Symbol, String, nil] The sanitizer to use. Options are :mysql, # :postgres, :sql_server, :sqlite. If no sanitizer is specified, or a falsy value # is passed, sql will not be sanitized. # @param sql_logging [Boolean] Whether to log sql statements to the tracer def self.instrument(tracer: ::OpenTracing.global_tracer, sanitizer: nil, sql_logging_enabled: true) sql_sanitizer = sanitizer && SqlSanitizer.build_sanitizer(sanitizer) processor = Processor.new(tracer, sanitizer: sql_sanitizer, sql_logging_enabled: sql_logging_enabled) ActiveSupport::Notifications.subscribe("sql.active_record") do |*args| processor.call(*args) end end end end
Version data entries
16 entries across 16 versions & 1 rubygems