Sha256: dfdcfcc6779c834b30cc89b6238505da0e595bee8f0a8c0129ef3258b162c880
Contents?: true
Size: 1.36 KB
Versions: 7
Compression:
Stored size: 1.36 KB
Contents
module Skylight module Probes module Elasticsearch class Probe def install # Prepending doesn't work here since this a module that's already been included ::Elasticsearch::Transport::Transport::Base.class_eval do alias_method :perform_request_without_sk, :perform_request def perform_request(method, path, *args, &block) ActiveSupport::Notifications.instrument( "request.elasticsearch", name: "Request", method: method, path: path ) do # Prevent HTTP-related probes from firing Skylight::Normalizers::Faraday::Request.disable do disable_skylight_probe(:NetHTTP) do disable_skylight_probe(:HTTPClient) { perform_request_without_sk(method, path, *args, &block) } end end end end def disable_skylight_probe(class_name) klass = ::ActiveSupport::Inflector.safe_constantize("Skylight::Probes::#{class_name}::Probe") (klass ? klass.disable { yield } : yield).tap { Skylight.log(:debug, "re-enabling: #{klass}") } end end end end end register(:elasticsearch, "Elasticsearch", "elasticsearch", Elasticsearch::Probe.new) end end
Version data entries
7 entries across 7 versions & 1 rubygems