scout_apm 2.6.2 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.markdown +6 -0
 - data/lib/scout_apm/app_server_load.rb +7 -2
 - data/lib/scout_apm/instruments/http.rb +48 -0
 - data/lib/scout_apm/instruments/mongoid.rb +9 -4
 - data/lib/scout_apm/version.rb +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6a0344ecd846204d2b4057246c9719ebf4453a1c240847e54357a75cecda39b6
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 55b8b4c379fee7e5f8275bde73f27fa7d9e1e16b560c70207e51e4225e45184c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 45cd0a3dc5b6632a980a38324e6c933d2552eb33aa32e1e9e9da74e5a6b848b5bdb694c27f017502c6a437dd6576486d8186ccbea8ae3c5563b8778bac158870
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d20753a142c71ef03a47608bcae15acdb2aeec11e5f7f75c78ece78657ac828b077af15c152b4e1aac92eb81f98e6a7b211db1aa35349cd8746a37ae76089b25
         
     | 
    
        data/CHANGELOG.markdown
    CHANGED
    
    
| 
         @@ -29,12 +29,17 @@ module ScoutApm 
     | 
|
| 
       29 
29 
     | 
    
         
             
                end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
                def data
         
     | 
| 
       32 
     | 
    
         
            -
                  {  
     | 
| 
      
 32 
     | 
    
         
            +
                  { 
         
     | 
| 
      
 33 
     | 
    
         
            +
                    :language           => 'ruby',
         
     | 
| 
      
 34 
     | 
    
         
            +
                    :language_version   => RUBY_VERSION,
         
     | 
| 
      
 35 
     | 
    
         
            +
                    :ruby_version       => RUBY_VERSION, # Deprecated.
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
       33 
37 
     | 
    
         
             
                    :framework          => to_s_safe(environment.framework_integration.human_name),
         
     | 
| 
       34 
38 
     | 
    
         
             
                    :framework_version  => to_s_safe(environment.framework_integration.version),
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                    :server_time        => to_s_safe(Time.now),
         
     | 
| 
       35 
41 
     | 
    
         
             
                    :environment        => to_s_safe(environment.framework_integration.env),
         
     | 
| 
       36 
42 
     | 
    
         
             
                    :app_server         => to_s_safe(environment.app_server),
         
     | 
| 
       37 
     | 
    
         
            -
                    :ruby_version       => RUBY_VERSION,
         
     | 
| 
       38 
43 
     | 
    
         
             
                    :hostname           => to_s_safe(environment.hostname),
         
     | 
| 
       39 
44 
     | 
    
         
             
                    :database_engine    => to_s_safe(environment.database_engine),      # Detected
         
     | 
| 
       40 
45 
     | 
    
         
             
                    :database_adapter   => to_s_safe(environment.raw_database_adapter), # Raw
         
     | 
| 
         @@ -0,0 +1,48 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module ScoutApm
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Instruments
         
     | 
| 
      
 3 
     | 
    
         
            +
                class HTTP
         
     | 
| 
      
 4 
     | 
    
         
            +
                  attr_reader :context
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  def initialize(context)
         
     | 
| 
      
 7 
     | 
    
         
            +
                    @context = context
         
     | 
| 
      
 8 
     | 
    
         
            +
                    @installed = false
         
     | 
| 
      
 9 
     | 
    
         
            +
                  end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  def logger
         
     | 
| 
      
 12 
     | 
    
         
            +
                    context.logger
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  def installed?
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @installed
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  def install
         
     | 
| 
      
 20 
     | 
    
         
            +
                    if defined?(::HTTP) && defined?(::HTTP::Client)
         
     | 
| 
      
 21 
     | 
    
         
            +
                      @installed = true
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                      logger.info "Instrumenting HTTP::Client"
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                      ::HTTP::Client.class_eval do
         
     | 
| 
      
 26 
     | 
    
         
            +
                        include ScoutApm::Tracer
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                        def request_with_scout_instruments(verb, uri, opts = {})
         
     | 
| 
      
 29 
     | 
    
         
            +
                          self.class.instrument("HTTP", verb, :ignore_children => true, :desc => request_scout_description(verb, uri)) do
         
     | 
| 
      
 30 
     | 
    
         
            +
                            request_without_scout_instruments(verb, uri, opts)
         
     | 
| 
      
 31 
     | 
    
         
            +
                          end
         
     | 
| 
      
 32 
     | 
    
         
            +
                        end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                        def request_scout_description(verb, uri)
         
     | 
| 
      
 35 
     | 
    
         
            +
                          max_length = ScoutApm::Agent.instance.context.config.value('instrument_http_url_length')
         
     | 
| 
      
 36 
     | 
    
         
            +
                          (String(uri).split('?').first)[0..(max_length - 1)]
         
     | 
| 
      
 37 
     | 
    
         
            +
                        rescue
         
     | 
| 
      
 38 
     | 
    
         
            +
                          ""
         
     | 
| 
      
 39 
     | 
    
         
            +
                        end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                        alias request_without_scout_instruments request
         
     | 
| 
      
 42 
     | 
    
         
            +
                        alias request request_with_scout_instruments
         
     | 
| 
      
 43 
     | 
    
         
            +
                      end
         
     | 
| 
      
 44 
     | 
    
         
            +
                    end
         
     | 
| 
      
 45 
     | 
    
         
            +
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
              end
         
     | 
| 
      
 48 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -37,8 +37,8 @@ module ScoutApm 
     | 
|
| 
       37 
37 
     | 
    
         
             
                      ### See moped instrument for Moped driven deploys
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
                      ### 5.x Mongoid
         
     | 
| 
       40 
     | 
    
         
            -
                      if (mongoid_v5? || mongoid_v6?) && defined?(::Mongoid::Contextual::Mongo)
         
     | 
| 
       41 
     | 
    
         
            -
                        logger.info "Instrumenting Mongoid 5.x/6.x"
         
     | 
| 
      
 40 
     | 
    
         
            +
                      if (mongoid_v5? || mongoid_v6? || mongoid_v7?) && defined?(::Mongoid::Contextual::Mongo)
         
     | 
| 
      
 41 
     | 
    
         
            +
                        logger.info "Instrumenting Mongoid 5.x/6.x/7.x"
         
     | 
| 
       42 
42 
     | 
    
         
             
                        # All the public methods from Mongoid::Contextual::Mongo.
         
     | 
| 
       43 
43 
     | 
    
         
             
                        # TODO: Geo and MapReduce support (?). They are in other Contextual::* classes
         
     | 
| 
       44 
44 
     | 
    
         
             
                        methods = [
         
     | 
| 
         @@ -54,8 +54,6 @@ module ScoutApm 
     | 
|
| 
       54 
54 
     | 
    
         
             
                          if ::Mongoid::Contextual::Mongo.method_defined?(method)
         
     | 
| 
       55 
55 
     | 
    
         
             
                            with_scout_instruments = %Q[
         
     | 
| 
       56 
56 
     | 
    
         
             
                            def #{method}_with_scout_instruments(*args, &block)
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
57 
     | 
    
         
             
                              req = ScoutApm::RequestManager.lookup
         
     | 
| 
       60 
58 
     | 
    
         
             
                              *db, collection = view.collection.namespace.split(".")
         
     | 
| 
       61 
59 
     | 
    
         | 
| 
         @@ -112,6 +110,13 @@ module ScoutApm 
     | 
|
| 
       112 
110 
     | 
    
         
             
                    end
         
     | 
| 
       113 
111 
     | 
    
         
             
                  end
         
     | 
| 
       114 
112 
     | 
    
         | 
| 
      
 113 
     | 
    
         
            +
                  def mongoid_v7?
         
     | 
| 
      
 114 
     | 
    
         
            +
                    if defined?(::Mongoid::VERSION)
         
     | 
| 
      
 115 
     | 
    
         
            +
                      ::Mongoid::VERSION =~ /\A7/
         
     | 
| 
      
 116 
     | 
    
         
            +
                    else
         
     | 
| 
      
 117 
     | 
    
         
            +
                      false
         
     | 
| 
      
 118 
     | 
    
         
            +
                    end
         
     | 
| 
      
 119 
     | 
    
         
            +
                  end
         
     | 
| 
       115 
120 
     | 
    
         | 
| 
       116 
121 
     | 
    
         
             
                  # Example of what a filter looks like: => {"founded"=>{"$gte"=>"1980-1-1"}, "name"=>{"$in"=>["Tool", "Deftones", "Melvins"]}}
         
     | 
| 
       117 
122 
     | 
    
         
             
                  # Approach: find every leaf-node, clear it. inspect the whole thing when done.
         
     | 
    
        data/lib/scout_apm/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: scout_apm
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.6. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.6.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Derek Haynes
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2019-10- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2019-10-31 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: minitest
         
     | 
| 
         @@ -287,6 +287,7 @@ files: 
     | 
|
| 
       287 
287 
     | 
    
         
             
            - lib/scout_apm/instruments/active_record.rb
         
     | 
| 
       288 
288 
     | 
    
         
             
            - lib/scout_apm/instruments/elasticsearch.rb
         
     | 
| 
       289 
289 
     | 
    
         
             
            - lib/scout_apm/instruments/grape.rb
         
     | 
| 
      
 290 
     | 
    
         
            +
            - lib/scout_apm/instruments/http.rb
         
     | 
| 
       290 
291 
     | 
    
         
             
            - lib/scout_apm/instruments/http_client.rb
         
     | 
| 
       291 
292 
     | 
    
         
             
            - lib/scout_apm/instruments/influxdb.rb
         
     | 
| 
       292 
293 
     | 
    
         
             
            - lib/scout_apm/instruments/memcached.rb
         
     |