Sha256: 5033f682af221a304ae4d9130111bab785fa21445fe427d7bc1ad2ca7ee57248

Contents?: true

Size: 913 Bytes

Versions: 4

Compression:

Stored size: 913 Bytes

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

require_relative 'elasticsearch/instrumentation'
require_relative 'elasticsearch/chain'
require_relative 'elasticsearch/prepend'

DependencyDetection.defer do
  named :elasticsearch

  depends_on do
    defined?(Elasticsearch)
  end

  executes do
    NewRelic::Agent.logger.info('Installing Elasticsearch instrumentation')

    to_instrument = if Gem::Version.create(Elasticsearch::VERSION) < Gem::Version.create("8.0.0")
      Elasticsearch::Transport::Client
    else
      Elastic::Transport::Client
    end

    if use_prepend?
      prepend_instrument to_instrument, NewRelic::Agent::Instrumentation::Elasticsearch::Prepend
    else
      chain_instrument NewRelic::Agent::Instrumentation::Elasticsearch
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
newrelic_rpm-9.0.0 lib/new_relic/agent/instrumentation/elasticsearch.rb
newrelic_rpm-8.16.0 lib/new_relic/agent/instrumentation/elasticsearch.rb
newrelic_rpm-8.15.0 lib/new_relic/agent/instrumentation/elasticsearch.rb
newrelic_rpm-8.14.0 lib/new_relic/agent/instrumentation/elasticsearch.rb