appsignal 3.5.4 → 3.5.6
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/.semaphore/semaphore.yml +147 -9
- data/CHANGELOG.md +23 -0
- data/README.md +2 -0
- data/build_matrix.yml +5 -9
- data/ext/Rakefile +7 -1
- data/ext/agent.rb +27 -27
- data/gemfiles/redis-4.gemfile +5 -0
- data/gemfiles/redis-5.gemfile +6 -0
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/config.rb +10 -5
- data/lib/appsignal/demo.rb +1 -1
- data/lib/appsignal/environment.rb +24 -13
- data/lib/appsignal/event_formatter.rb +1 -1
- data/lib/appsignal/extension/jruby.rb +4 -3
- data/lib/appsignal/extension.rb +1 -1
- data/lib/appsignal/helpers/instrumentation.rb +7 -7
- data/lib/appsignal/helpers/metrics.rb +3 -3
- data/lib/appsignal/hooks/redis.rb +1 -0
- data/lib/appsignal/hooks/redis_client.rb +27 -0
- data/lib/appsignal/hooks.rb +3 -2
- data/lib/appsignal/integrations/hanami.rb +1 -1
- data/lib/appsignal/integrations/padrino.rb +1 -1
- data/lib/appsignal/integrations/railtie.rb +1 -1
- data/lib/appsignal/integrations/redis_client.rb +20 -0
- data/lib/appsignal/integrations/sidekiq.rb +1 -1
- data/lib/appsignal/integrations/sinatra.rb +1 -1
- data/lib/appsignal/minutely.rb +4 -4
- data/lib/appsignal/probes/gvl.rb +1 -1
- data/lib/appsignal/probes/helpers.rb +1 -1
- data/lib/appsignal/probes/mri.rb +1 -1
- data/lib/appsignal/probes/sidekiq.rb +5 -5
- data/lib/appsignal/rack/generic_instrumentation.rb +1 -1
- data/lib/appsignal/rack/rails_instrumentation.rb +2 -2
- data/lib/appsignal/rack/sinatra_instrumentation.rb +2 -2
- data/lib/appsignal/rack/streaming_listener.rb +1 -1
- data/lib/appsignal/span.rb +2 -2
- data/lib/appsignal/transaction.rb +11 -11
- data/lib/appsignal/utils/deprecation_message.rb +2 -2
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +37 -31
- data/spec/lib/appsignal/config_spec.rb +2 -2
- data/spec/lib/appsignal/hooks/activejob_spec.rb +1 -1
- data/spec/lib/appsignal/hooks/redis_client_spec.rb +222 -0
- data/spec/lib/appsignal/hooks/redis_spec.rb +98 -76
- data/spec/lib/appsignal/hooks_spec.rb +4 -4
- data/spec/lib/appsignal/integrations/railtie_spec.rb +2 -2
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +3 -3
- data/spec/lib/appsignal/integrations/sinatra_spec.rb +2 -2
- data/spec/lib/appsignal/minutely_spec.rb +2 -2
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +1 -1
- data/spec/lib/appsignal/transaction_spec.rb +4 -4
- data/spec/lib/appsignal_spec.rb +34 -32
- data/spec/spec_helper.rb +1 -1
- data/spec/support/fixtures/projects/valid/config/appsignal.yml +3 -3
- data/spec/support/helpers/config_helpers.rb +6 -2
- data/spec/support/helpers/dependency_helper.rb +9 -1
- data/spec/support/helpers/log_helpers.rb +2 -2
- metadata +8 -3
| @@ -242,14 +242,15 @@ module Appsignal | |
| 242 242 | 
             
                      [:pointer],
         | 
| 243 243 | 
             
                      :appsignal_string
         | 
| 244 244 |  | 
| 245 | 
            -
                    Appsignal.extension_loaded = true
         | 
| 245 | 
            +
                    Appsignal.extension_loaded = true if Appsignal.respond_to? :extension_loaded=
         | 
| 246 246 | 
             
                  rescue LoadError => error
         | 
| 247 247 | 
             
                    error_message = "ERROR: AppSignal failed to load extension. " \
         | 
| 248 248 | 
             
                      "Please run `appsignal diagnose` and email us at support@appsignal.com\n" \
         | 
| 249 249 | 
             
                      "#{error.class}: #{error.message}"
         | 
| 250 | 
            -
                    Appsignal. | 
| 250 | 
            +
                    Appsignal.internal_logger.error(error_message) if Appsignal.respond_to? :internal_logger
         | 
| 251 251 | 
             
                    Kernel.warn error_message
         | 
| 252 | 
            -
                    Appsignal.extension_loaded = false
         | 
| 252 | 
            +
                    Appsignal.extension_loaded = false if Appsignal.respond_to? :extension_loaded=
         | 
| 253 | 
            +
                    raise error if ENV["_APPSIGNAL_EXTENSION_INSTALL"] == "true"
         | 
| 253 254 | 
             
                  end
         | 
| 254 255 |  | 
| 255 256 | 
             
                  def start
         | 
    
        data/lib/appsignal/extension.rb
    CHANGED
    
    | @@ -12,7 +12,7 @@ rescue LoadError => error | |
| 12 12 | 
             
              error_message = "ERROR: AppSignal failed to load extension. " \
         | 
| 13 13 | 
             
                "Please run `appsignal diagnose` and email us at support@appsignal.com\n" \
         | 
| 14 14 | 
             
                "#{error.class}: #{error.message}"
         | 
| 15 | 
            -
              Appsignal. | 
| 15 | 
            +
              Appsignal.internal_logger.error(error_message)
         | 
| 16 16 | 
             
              Kernel.warn error_message
         | 
| 17 17 | 
             
              Appsignal.extension_loaded = false
         | 
| 18 18 | 
             
            end
         | 
| @@ -68,9 +68,9 @@ module Appsignal | |
| 68 68 | 
             
                      namespace = Appsignal::Transaction::HTTP_REQUEST
         | 
| 69 69 | 
             
                      request   = ::Rack::Request.new(env)
         | 
| 70 70 | 
             
                    else
         | 
| 71 | 
            -
                       | 
| 72 | 
            -
                        "either 'perform_job' (for jobs and tasks) or  | 
| 73 | 
            -
                        "(for HTTP requests)"
         | 
| 71 | 
            +
                      internal_logger.error "Unrecognized name '#{name}': names must " \
         | 
| 72 | 
            +
                        "start with either 'perform_job' (for jobs and tasks) or " \
         | 
| 73 | 
            +
                        "'process_action' (for HTTP requests)"
         | 
| 74 74 | 
             
                      return yield
         | 
| 75 75 | 
             
                    end
         | 
| 76 76 |  | 
| @@ -228,8 +228,8 @@ module Appsignal | |
| 228 228 | 
             
                    return unless active?
         | 
| 229 229 |  | 
| 230 230 | 
             
                    unless error.is_a?(Exception)
         | 
| 231 | 
            -
                       | 
| 232 | 
            -
                        "value is not an exception: #{error.inspect}"
         | 
| 231 | 
            +
                      internal_logger.error "Appsignal.send_error: Cannot send error. " \
         | 
| 232 | 
            +
                        "The given value is not an exception: #{error.inspect}"
         | 
| 233 233 | 
             
                      return
         | 
| 234 234 | 
             
                    end
         | 
| 235 235 | 
             
                    transaction = Appsignal::Transaction.new(
         | 
| @@ -319,8 +319,8 @@ module Appsignal | |
| 319 319 | 
             
                          "Appsignal.set_error called on location: #{call_location}"
         | 
| 320 320 | 
             
                    end
         | 
| 321 321 | 
             
                    unless exception.is_a?(Exception)
         | 
| 322 | 
            -
                       | 
| 323 | 
            -
                        "value is not an exception: #{exception.inspect}"
         | 
| 322 | 
            +
                      internal_logger.error "Appsignal.set_error: Cannot set error. " \
         | 
| 323 | 
            +
                        "The given value is not an exception: #{exception.inspect}"
         | 
| 324 324 | 
             
                      return
         | 
| 325 325 | 
             
                    end
         | 
| 326 326 | 
             
                    return if !active? || !Appsignal::Transaction.current?
         | 
| @@ -10,7 +10,7 @@ module Appsignal | |
| 10 10 | 
             
                      Appsignal::Utils::Data.generate(tags)
         | 
| 11 11 | 
             
                    )
         | 
| 12 12 | 
             
                  rescue RangeError
         | 
| 13 | 
            -
                    Appsignal. | 
| 13 | 
            +
                    Appsignal.internal_logger
         | 
| 14 14 | 
             
                      .warn("Gauge value #{value} for key '#{key}' is too big")
         | 
| 15 15 | 
             
                  end
         | 
| 16 16 |  | 
| @@ -37,7 +37,7 @@ module Appsignal | |
| 37 37 | 
             
                      Appsignal::Utils::Data.generate(tags)
         | 
| 38 38 | 
             
                    )
         | 
| 39 39 | 
             
                  rescue RangeError
         | 
| 40 | 
            -
                    Appsignal. | 
| 40 | 
            +
                    Appsignal.internal_logger
         | 
| 41 41 | 
             
                      .warn("Counter value #{value} for key '#{key}' is too big")
         | 
| 42 42 | 
             
                  end
         | 
| 43 43 |  | 
| @@ -48,7 +48,7 @@ module Appsignal | |
| 48 48 | 
             
                      Appsignal::Utils::Data.generate(tags)
         | 
| 49 49 | 
             
                    )
         | 
| 50 50 | 
             
                  rescue RangeError
         | 
| 51 | 
            -
                    Appsignal. | 
| 51 | 
            +
                    Appsignal.internal_logger
         | 
| 52 52 | 
             
                      .warn("Distribution value #{value} for key '#{key}' is too big")
         | 
| 53 53 | 
             
                  end
         | 
| 54 54 | 
             
                end
         | 
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Appsignal
         | 
| 4 | 
            +
              class Hooks
         | 
| 5 | 
            +
                # @api private
         | 
| 6 | 
            +
                class RedisClientHook < Appsignal::Hooks::Hook
         | 
| 7 | 
            +
                  register :redis_client
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  def dependencies_present?
         | 
| 10 | 
            +
                    defined?(::RedisClient) &&
         | 
| 11 | 
            +
                      Appsignal.config &&
         | 
| 12 | 
            +
                      Appsignal.config[:instrument_redis]
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  def install
         | 
| 16 | 
            +
                    require "appsignal/integrations/redis_client"
         | 
| 17 | 
            +
                    ::RedisClient::RubyConnection.prepend Appsignal::Integrations::RedisClientIntegration
         | 
| 18 | 
            +
                    Appsignal::Environment.report_enabled("redis")
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                    return unless defined?(::RedisClient::HiredisConnection)
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                    ::RedisClient::HiredisConnection.prepend Appsignal::Integrations::RedisClientIntegration
         | 
| 23 | 
            +
                    Appsignal::Environment.report_enabled("hiredis")
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
            end
         | 
    
        data/lib/appsignal/hooks.rb
    CHANGED
    
    | @@ -32,12 +32,12 @@ module Appsignal | |
| 32 32 | 
             
                    return unless dependencies_present?
         | 
| 33 33 | 
             
                    return if installed?
         | 
| 34 34 |  | 
| 35 | 
            -
                    Appsignal. | 
| 35 | 
            +
                    Appsignal.internal_logger.debug("Installing #{name} hook")
         | 
| 36 36 | 
             
                    begin
         | 
| 37 37 | 
             
                      install
         | 
| 38 38 | 
             
                      @installed = true
         | 
| 39 39 | 
             
                    rescue => ex
         | 
| 40 | 
            -
                      logger = Appsignal. | 
| 40 | 
            +
                      logger = Appsignal.internal_logger
         | 
| 41 41 | 
             
                      logger.error("Error while installing #{name} hook: #{ex}")
         | 
| 42 42 | 
             
                      logger.debug ex.backtrace.join("\n")
         | 
| 43 43 | 
             
                    end
         | 
| @@ -103,6 +103,7 @@ require "appsignal/hooks/passenger" | |
| 103 103 | 
             
            require "appsignal/hooks/puma"
         | 
| 104 104 | 
             
            require "appsignal/hooks/rake"
         | 
| 105 105 | 
             
            require "appsignal/hooks/redis"
         | 
| 106 | 
            +
            require "appsignal/hooks/redis_client"
         | 
| 106 107 | 
             
            require "appsignal/hooks/resque"
         | 
| 107 108 | 
             
            require "appsignal/hooks/sequel"
         | 
| 108 109 | 
             
            require "appsignal/hooks/shoryuken"
         | 
| @@ -6,7 +6,7 @@ module Appsignal | |
| 6 6 | 
             
              module Integrations
         | 
| 7 7 | 
             
                module HanamiPlugin
         | 
| 8 8 | 
             
                  def self.init
         | 
| 9 | 
            -
                    Appsignal. | 
| 9 | 
            +
                    Appsignal.internal_logger.debug("Loading Hanami integration")
         | 
| 10 10 |  | 
| 11 11 | 
             
                    hanami_app_config = ::Hanami.app.config
         | 
| 12 12 | 
             
                    Appsignal.config = Appsignal::Config.new(
         | 
| @@ -7,7 +7,7 @@ module Appsignal | |
| 7 7 | 
             
                # @api private
         | 
| 8 8 | 
             
                module PadrinoPlugin
         | 
| 9 9 | 
             
                  def self.init
         | 
| 10 | 
            -
                    Appsignal. | 
| 10 | 
            +
                    Appsignal.internal_logger.debug("Loading Padrino (#{Padrino::VERSION}) integration")
         | 
| 11 11 |  | 
| 12 12 | 
             
                    root = Padrino.mounted_root
         | 
| 13 13 | 
             
                    Appsignal.config = Appsignal::Config.new(root, Padrino.env)
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            Appsignal. | 
| 3 | 
            +
            Appsignal.internal_logger.debug("Loading Rails (#{Rails.version}) integration")
         | 
| 4 4 |  | 
| 5 5 | 
             
            require "appsignal/utils/rails_helper"
         | 
| 6 6 | 
             
            require "appsignal/rack/rails_instrumentation"
         | 
| @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Appsignal
         | 
| 4 | 
            +
              module Integrations
         | 
| 5 | 
            +
                module RedisClientIntegration
         | 
| 6 | 
            +
                  def write(command)
         | 
| 7 | 
            +
                    sanitized_command =
         | 
| 8 | 
            +
                      if command[0] == :eval
         | 
| 9 | 
            +
                        "#{command[1]}#{" ?" * (command.size - 3)}"
         | 
| 10 | 
            +
                      else
         | 
| 11 | 
            +
                        "#{command[0]}#{" ?" * (command.size - 1)}"
         | 
| 12 | 
            +
                      end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                    Appsignal.instrument "query.redis", @config.id, sanitized_command do
         | 
| 15 | 
            +
                      super
         | 
| 16 | 
            +
                    end
         | 
| 17 | 
            +
                  end
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
            end
         | 
| @@ -168,7 +168,7 @@ module Appsignal | |
| 168 168 | 
             
                    # Sidekiq issue #1761: in dev mode, it's possible to have jobs enqueued
         | 
| 169 169 | 
             
                    # which haven't been loaded into memory yet so the YAML can't be
         | 
| 170 170 | 
             
                    # loaded.
         | 
| 171 | 
            -
                    Appsignal. | 
| 171 | 
            +
                    Appsignal.internal_logger.warn "Unable to load YAML: #{error.message}"
         | 
| 172 172 | 
             
                    default
         | 
| 173 173 | 
             
                  end
         | 
| 174 174 | 
             
                end
         | 
| @@ -3,7 +3,7 @@ | |
| 3 3 | 
             
            require "appsignal"
         | 
| 4 4 | 
             
            require "appsignal/rack/sinatra_instrumentation"
         | 
| 5 5 |  | 
| 6 | 
            -
            Appsignal. | 
| 6 | 
            +
            Appsignal.internal_logger.debug("Loading Sinatra (#{Sinatra::VERSION}) integration")
         | 
| 7 7 |  | 
| 8 8 | 
             
            app_settings = ::Sinatra::Application.settings
         | 
| 9 9 | 
             
            Appsignal.config = Appsignal::Config.new(
         | 
    
        data/lib/appsignal/minutely.rb
    CHANGED
    
    | @@ -108,7 +108,7 @@ module Appsignal | |
| 108 108 | 
             
                  attr_reader :probes
         | 
| 109 109 |  | 
| 110 110 | 
             
                  def logger
         | 
| 111 | 
            -
                    Appsignal. | 
| 111 | 
            +
                    Appsignal.internal_logger
         | 
| 112 112 | 
             
                  end
         | 
| 113 113 | 
             
                end
         | 
| 114 114 |  | 
| @@ -132,7 +132,7 @@ module Appsignal | |
| 132 132 | 
             
                      sleep initial_wait_time
         | 
| 133 133 | 
             
                      initialize_probes
         | 
| 134 134 | 
             
                      loop do
         | 
| 135 | 
            -
                        logger = Appsignal. | 
| 135 | 
            +
                        logger = Appsignal.internal_logger
         | 
| 136 136 | 
             
                        logger.debug("Gathering minutely metrics with #{probe_instances.count} probes")
         | 
| 137 137 | 
             
                        probe_instances.each do |name, probe|
         | 
| 138 138 | 
             
                          logger.debug("Gathering minutely metrics with '#{name}' probe")
         | 
| @@ -181,13 +181,13 @@ module Appsignal | |
| 181 181 | 
             
                      klass = instance.class
         | 
| 182 182 | 
             
                    end
         | 
| 183 183 | 
             
                    unless dependencies_present?(klass)
         | 
| 184 | 
            -
                      Appsignal. | 
| 184 | 
            +
                      Appsignal.internal_logger.debug "Skipping '#{name}' probe, " \
         | 
| 185 185 | 
             
                        "#{klass}.dependency_present? returned falsy"
         | 
| 186 186 | 
             
                      return
         | 
| 187 187 | 
             
                    end
         | 
| 188 188 | 
             
                    probe_instances[name] = instance
         | 
| 189 189 | 
             
                  rescue => error
         | 
| 190 | 
            -
                    logger = Appsignal. | 
| 190 | 
            +
                    logger = Appsignal.internal_logger
         | 
| 191 191 | 
             
                    logger.error "Error while initializing minutely probe '#{name}': #{error}"
         | 
| 192 192 | 
             
                    logger.debug error.backtrace.join("\n")
         | 
| 193 193 | 
             
                  end
         | 
    
        data/lib/appsignal/probes/gvl.rb
    CHANGED
    
    | @@ -22,7 +22,7 @@ module Appsignal | |
| 22 22 | 
             
                  end
         | 
| 23 23 |  | 
| 24 24 | 
             
                  def initialize(appsignal: Appsignal, gvl_tools: ::GVLTools)
         | 
| 25 | 
            -
                    Appsignal. | 
| 25 | 
            +
                    Appsignal.internal_logger.debug("Initializing GVL probe")
         | 
| 26 26 | 
             
                    @appsignal = appsignal
         | 
| 27 27 | 
             
                    @gvl_tools = gvl_tools
         | 
| 28 28 | 
             
                  end
         | 
| @@ -47,7 +47,7 @@ module Appsignal | |
| 47 47 | 
             
                    # Auto detect hostname as fallback. May be inaccurate.
         | 
| 48 48 | 
             
                    @hostname =
         | 
| 49 49 | 
             
                      config[:hostname] || Socket.gethostname
         | 
| 50 | 
            -
                    Appsignal. | 
| 50 | 
            +
                    Appsignal.internal_logger.debug "Probe helper: Using hostname config " \
         | 
| 51 51 | 
             
                      "option '#{@hostname.inspect}' as hostname"
         | 
| 52 52 |  | 
| 53 53 | 
             
                    @hostname
         | 
    
        data/lib/appsignal/probes/mri.rb
    CHANGED
    
    | @@ -11,7 +11,7 @@ module Appsignal | |
| 11 11 | 
             
                  end
         | 
| 12 12 |  | 
| 13 13 | 
             
                  def initialize(appsignal: Appsignal, gc_profiler: Appsignal::GarbageCollection.profiler)
         | 
| 14 | 
            -
                    Appsignal. | 
| 14 | 
            +
                    Appsignal.internal_logger.debug("Initializing VM probe")
         | 
| 15 15 | 
             
                    @appsignal = appsignal
         | 
| 16 16 | 
             
                    @gc_profiler = gc_profiler
         | 
| 17 17 | 
             
                  end
         | 
| @@ -59,7 +59,7 @@ module Appsignal | |
| 59 59 | 
             
                    @adapter = is_sidekiq7 ? Sidekiq7Adapter : Sidekiq6Adapter
         | 
| 60 60 |  | 
| 61 61 | 
             
                    config_string = " with config: #{config}" unless config.empty?
         | 
| 62 | 
            -
                    Appsignal. | 
| 62 | 
            +
                    Appsignal.internal_logger.debug("Initializing Sidekiq probe#{config_string}")
         | 
| 63 63 | 
             
                    require "sidekiq/api"
         | 
| 64 64 | 
             
                  end
         | 
| 65 65 |  | 
| @@ -123,14 +123,14 @@ module Appsignal | |
| 123 123 |  | 
| 124 124 | 
             
                    if config.key?(:hostname)
         | 
| 125 125 | 
             
                      @hostname = config[:hostname]
         | 
| 126 | 
            -
                      Appsignal. | 
| 127 | 
            -
                        "option #{@hostname.inspect} as hostname"
         | 
| 126 | 
            +
                      Appsignal.internal_logger.debug "Sidekiq probe: Using hostname " \
         | 
| 127 | 
            +
                        "config option #{@hostname.inspect} as hostname"
         | 
| 128 128 | 
             
                      return @hostname
         | 
| 129 129 | 
             
                    end
         | 
| 130 130 |  | 
| 131 131 | 
             
                    host = adapter.hostname
         | 
| 132 | 
            -
                    Appsignal. | 
| 133 | 
            -
                      "#{host.inspect} as hostname"
         | 
| 132 | 
            +
                    Appsignal.internal_logger.debug "Sidekiq probe: Using Redis server " \
         | 
| 133 | 
            +
                      "hostname #{host.inspect} as hostname"
         | 
| 134 134 | 
             
                    @hostname = host
         | 
| 135 135 | 
             
                  end
         | 
| 136 136 | 
             
                end
         | 
| @@ -7,7 +7,7 @@ module Appsignal | |
| 7 7 | 
             
              module Rack
         | 
| 8 8 | 
             
                class GenericInstrumentation
         | 
| 9 9 | 
             
                  def initialize(app, options = {})
         | 
| 10 | 
            -
                    Appsignal. | 
| 10 | 
            +
                    Appsignal.internal_logger.debug "Initializing Appsignal::Rack::GenericInstrumentation"
         | 
| 11 11 | 
             
                    @app = app
         | 
| 12 12 | 
             
                    @options = options
         | 
| 13 13 | 
             
                  end
         | 
| @@ -7,7 +7,7 @@ module Appsignal | |
| 7 7 | 
             
              module Rack
         | 
| 8 8 | 
             
                class RailsInstrumentation
         | 
| 9 9 | 
             
                  def initialize(app, options = {})
         | 
| 10 | 
            -
                    Appsignal. | 
| 10 | 
            +
                    Appsignal.internal_logger.debug "Initializing Appsignal::Rack::RailsInstrumentation"
         | 
| 11 11 | 
             
                    @app = app
         | 
| 12 12 | 
             
                    @options = options
         | 
| 13 13 | 
             
                  end
         | 
| @@ -43,7 +43,7 @@ module Appsignal | |
| 43 43 | 
             
                      begin
         | 
| 44 44 | 
             
                        transaction.set_metadata("method", request.request_method)
         | 
| 45 45 | 
             
                      rescue => error
         | 
| 46 | 
            -
                        Appsignal. | 
| 46 | 
            +
                        Appsignal.internal_logger.error("Unable to report HTTP request method: '#{error}'")
         | 
| 47 47 | 
             
                      end
         | 
| 48 48 | 
             
                      Appsignal::Transaction.complete_current!
         | 
| 49 49 | 
             
                    end
         | 
| @@ -15,7 +15,7 @@ module Appsignal | |
| 15 15 | 
             
                  def initialize(app, options = {})
         | 
| 16 16 | 
             
                    @app = app
         | 
| 17 17 | 
             
                    @options = options
         | 
| 18 | 
            -
                    Appsignal. | 
| 18 | 
            +
                    Appsignal.internal_logger.warn "Please remove Appsignal::Rack::SinatraInstrumentation " \
         | 
| 19 19 | 
             
                      "from your Sinatra::Base class. This is no longer needed."
         | 
| 20 20 | 
             
                  end
         | 
| 21 21 |  | 
| @@ -32,7 +32,7 @@ module Appsignal | |
| 32 32 | 
             
                  attr_reader :raise_errors_on
         | 
| 33 33 |  | 
| 34 34 | 
             
                  def initialize(app, options = {})
         | 
| 35 | 
            -
                    Appsignal. | 
| 35 | 
            +
                    Appsignal.internal_logger.debug "Initializing Appsignal::Rack::SinatraBaseInstrumentation"
         | 
| 36 36 | 
             
                    @app = app
         | 
| 37 37 | 
             
                    @options = options
         | 
| 38 38 | 
             
                    @raise_errors_on = raise_errors?(@app)
         | 
| @@ -7,7 +7,7 @@ module Appsignal | |
| 7 7 | 
             
                # @api private
         | 
| 8 8 | 
             
                class StreamingListener
         | 
| 9 9 | 
             
                  def initialize(app, options = {})
         | 
| 10 | 
            -
                    Appsignal. | 
| 10 | 
            +
                    Appsignal.internal_logger.debug "Initializing Appsignal::Rack::StreamingListener"
         | 
| 11 11 | 
             
                    @app = app
         | 
| 12 12 | 
             
                    @options = options
         | 
| 13 13 | 
             
                  end
         | 
    
        data/lib/appsignal/span.rb
    CHANGED
    
    | @@ -16,8 +16,8 @@ module Appsignal | |
| 16 16 |  | 
| 17 17 | 
             
                def add_error(error)
         | 
| 18 18 | 
             
                  unless error.is_a?(Exception)
         | 
| 19 | 
            -
                    Appsignal. | 
| 20 | 
            -
                      "The given value is not an exception: #{error.inspect}"
         | 
| 19 | 
            +
                    Appsignal.internal_logger.error "Appsignal::Span#add_error: Cannot " \
         | 
| 20 | 
            +
                      "add error. The given value is not an exception: #{error.inspect}"
         | 
| 21 21 | 
             
                    return
         | 
| 22 22 | 
             
                  end
         | 
| 23 23 | 
             
                  return unless error
         | 
| @@ -26,7 +26,7 @@ module Appsignal | |
| 26 26 | 
             
                        Appsignal::Transaction.new(id, namespace, request, options)
         | 
| 27 27 | 
             
                    else
         | 
| 28 28 | 
             
                      # Otherwise, log the issue about trying to start another transaction
         | 
| 29 | 
            -
                      Appsignal. | 
| 29 | 
            +
                      Appsignal.internal_logger.warn_once_then_debug(
         | 
| 30 30 | 
             
                        :transaction_id,
         | 
| 31 31 | 
             
                        "Trying to start new transaction with id " \
         | 
| 32 32 | 
             
                          "'#{id}', but a transaction with id '#{current.transaction_id}' " \
         | 
| @@ -59,7 +59,7 @@ module Appsignal | |
| 59 59 | 
             
                  def complete_current!
         | 
| 60 60 | 
             
                    current.complete
         | 
| 61 61 | 
             
                  rescue => e
         | 
| 62 | 
            -
                    Appsignal. | 
| 62 | 
            +
                    Appsignal.internal_logger.error(
         | 
| 63 63 | 
             
                      "Failed to complete transaction ##{current.transaction_id}. #{e.message}"
         | 
| 64 64 | 
             
                    )
         | 
| 65 65 | 
             
                  ensure
         | 
| @@ -114,7 +114,7 @@ module Appsignal | |
| 114 114 |  | 
| 115 115 | 
             
                def complete
         | 
| 116 116 | 
             
                  if discarded?
         | 
| 117 | 
            -
                    Appsignal. | 
| 117 | 
            +
                    Appsignal.internal_logger.debug "Skipping transaction '#{transaction_id}' " \
         | 
| 118 118 | 
             
                      "because it was manually discarded."
         | 
| 119 119 | 
             
                    return
         | 
| 120 120 | 
             
                  end
         | 
| @@ -188,7 +188,7 @@ module Appsignal | |
| 188 188 | 
             
                #   Breadcrumb reference
         | 
| 189 189 | 
             
                def add_breadcrumb(category, action, message = "", metadata = {}, time = Time.now.utc)
         | 
| 190 190 | 
             
                  unless metadata.is_a? Hash
         | 
| 191 | 
            -
                    Appsignal. | 
| 191 | 
            +
                    Appsignal.internal_logger.error "add_breadcrumb: Cannot add breadcrumb. " \
         | 
| 192 192 | 
             
                      "The given metadata argument is not a Hash."
         | 
| 193 193 | 
             
                    return
         | 
| 194 194 | 
             
                  end
         | 
| @@ -287,7 +287,7 @@ module Appsignal | |
| 287 287 |  | 
| 288 288 | 
             
                  @ext.set_queue_start(start)
         | 
| 289 289 | 
             
                rescue RangeError
         | 
| 290 | 
            -
                  Appsignal. | 
| 290 | 
            +
                  Appsignal.internal_logger.warn("Queue start value #{start} is too big")
         | 
| 291 291 | 
             
                end
         | 
| 292 292 |  | 
| 293 293 | 
             
                # Set the queue time based on the HTTP header or `:queue_start` env key
         | 
| @@ -324,7 +324,7 @@ module Appsignal | |
| 324 324 | 
             
                  return unless key && data
         | 
| 325 325 |  | 
| 326 326 | 
             
                  if !data.is_a?(Array) && !data.is_a?(Hash)
         | 
| 327 | 
            -
                    Appsignal. | 
| 327 | 
            +
                    Appsignal.internal_logger.error(
         | 
| 328 328 | 
             
                      "Invalid sample data for '#{key}'. Value is not an Array or Hash: '#{data.inspect}'"
         | 
| 329 329 | 
             
                    )
         | 
| 330 330 | 
             
                    return
         | 
| @@ -337,11 +337,11 @@ module Appsignal | |
| 337 337 | 
             
                rescue RuntimeError => e
         | 
| 338 338 | 
             
                  begin
         | 
| 339 339 | 
             
                    inspected_data = data.inspect
         | 
| 340 | 
            -
                    Appsignal. | 
| 340 | 
            +
                    Appsignal.internal_logger.error(
         | 
| 341 341 | 
             
                      "Error generating data (#{e.class}: #{e.message}) for '#{inspected_data}'"
         | 
| 342 342 | 
             
                    )
         | 
| 343 343 | 
             
                  rescue => e
         | 
| 344 | 
            -
                    Appsignal. | 
| 344 | 
            +
                    Appsignal.internal_logger.error(
         | 
| 345 345 | 
             
                      "Error generating data (#{e.class}: #{e.message}). Can't inspect data."
         | 
| 346 346 | 
             
                    )
         | 
| 347 347 | 
             
                  end
         | 
| @@ -362,7 +362,7 @@ module Appsignal | |
| 362 362 |  | 
| 363 363 | 
             
                def set_error(error)
         | 
| 364 364 | 
             
                  unless error.is_a?(Exception)
         | 
| 365 | 
            -
                    Appsignal. | 
| 365 | 
            +
                    Appsignal.internal_logger.error "Appsignal::Transaction#set_error: Cannot set error. " \
         | 
| 366 366 | 
             
                      "The given value is not an exception: #{error.inspect}"
         | 
| 367 367 | 
             
                    return
         | 
| 368 368 | 
             
                  end
         | 
| @@ -385,7 +385,7 @@ module Appsignal | |
| 385 385 | 
             
                    break unless error
         | 
| 386 386 |  | 
| 387 387 | 
             
                    if causes.length >= ERROR_CAUSES_LIMIT
         | 
| 388 | 
            -
                      Appsignal. | 
| 388 | 
            +
                      Appsignal.internal_logger.debug "Appsignal::Transaction#set_error: Error has more " \
         | 
| 389 389 | 
             
                        "than #{ERROR_CAUSES_LIMIT} error causes. Only the first #{ERROR_CAUSES_LIMIT} " \
         | 
| 390 390 | 
             
                        "will be reported."
         | 
| 391 391 | 
             
                      root_cause_missing = true
         | 
| @@ -529,7 +529,7 @@ module Appsignal | |
| 529 529 | 
             
                    request.send options[:params_method]
         | 
| 530 530 | 
             
                  rescue => e
         | 
| 531 531 | 
             
                    # Getting params from the request has been know to fail.
         | 
| 532 | 
            -
                    Appsignal. | 
| 532 | 
            +
                    Appsignal.internal_logger.debug "Exception while getting params: #{e}"
         | 
| 533 533 | 
             
                    nil
         | 
| 534 534 | 
             
                  end
         | 
| 535 535 | 
             
                end
         | 
| @@ -3,12 +3,12 @@ | |
| 3 3 | 
             
            module Appsignal
         | 
| 4 4 | 
             
              module Utils
         | 
| 5 5 | 
             
                module DeprecationMessage
         | 
| 6 | 
            -
                  def self.message(message, logger = Appsignal. | 
| 6 | 
            +
                  def self.message(message, logger = Appsignal.internal_logger)
         | 
| 7 7 | 
             
                    Kernel.warn "appsignal WARNING: #{message}"
         | 
| 8 8 | 
             
                    logger.warn message
         | 
| 9 9 | 
             
                  end
         | 
| 10 10 |  | 
| 11 | 
            -
                  def deprecation_message(message, logger = Appsignal. | 
| 11 | 
            +
                  def deprecation_message(message, logger = Appsignal.internal_logger)
         | 
| 12 12 | 
             
                    Appsignal::Utils::DeprecationMessage.message(message, logger)
         | 
| 13 13 | 
             
                  end
         | 
| 14 14 | 
             
                end
         | 
    
        data/lib/appsignal/version.rb
    CHANGED