Class: Skylight::Core::Probes::Excon::Probe Private

Inherits:
Object
  • Object
show all
Defined in:
lib/skylight/core/probes/excon.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Probe for instrumenting Excon requests. Installs Middleware to achieve this.

Instance Method Summary collapse

Instance Method Details

#installObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/skylight/core/probes/excon.rb', line 6

def install
  if defined?(::Excon::Middleware)
    # Don't require until installation since it depends on Excon being loaded
    require "skylight/core/probes/excon/middleware"

    idx = ::Excon.defaults[:middlewares].index(::Excon::Middleware::Instrumentor)

    # TODO: Handle possibility of idx being nil
    ::Excon.defaults[:middlewares].insert(idx, Probes::Excon::Middleware)
  else
    # Using $stderr here isn't great, but we don't have a logger accessible
    $stderr.puts "[SKYLIGHT::CORE] [#{Skylight::Core::VERSION}] The installed version of Excon doesn't " \
                  "support Middlewares. The Excon probe will be disabled."
  end
end