rookout 0.1.42 → 0.1.43
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/lib/rookout/augs/aug_factory.rb +3 -1
- data/lib/rookout/com_ws/agent_com_ws.rb +2 -4
- data/lib/rookout/commit.rb +1 -1
- data/lib/rookout/config.rb +3 -1
- data/lib/rookout/exceptions.rb +1 -1
- data/lib/rookout/interface.rb +1 -0
- data/lib/rookout/utils.rb +27 -19
- data/lib/rookout/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 451da8de695dcbffddf0e548b213741155298be1877e390c7cbcb776a21744e6
         | 
| 4 | 
            +
              data.tar.gz: 5d006c7a1e89e0ab1d6e407c4afa4e1410f50f2770e92c1cdc083498cee54af0
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 743f3550703c0cfaa55527a185f014c31129761addff6584dbd01dc63d8bd0bc245188ce6cb51812de8ebb1c0d8ac1b6df9460c6a9f9c47b342ef5519cba1137
         | 
| 7 | 
            +
              data.tar.gz: bb0dbcbb2ee6bbc8fa0b0d957e197021fb156e8a49fd2f8bd365072f665f23d7b7d6eb06bf490ccd880602f02dd43a226496d0e25dbb67e4c90932121a7d2f01
         | 
| @@ -107,7 +107,9 @@ module Rookout | |
| 107 107 |  | 
| 108 108 | 
             
                    unless config.nil? || config.empty?
         | 
| 109 109 | 
             
                      rate_limit_split = config.split "/"
         | 
| 110 | 
            -
                      unless rate_limit_split.length == 2 &&  | 
| 110 | 
            +
                      unless rate_limit_split.length == 2 && \
         | 
| 111 | 
            +
                             Utils.is_number?(rate_limit_split[0]) && \
         | 
| 112 | 
            +
                             Utils.is_number?(rate_limit_split[1])
         | 
| 111 113 | 
             
                        raise Exceptions::RookInvalidRateLimitConfiguration, config
         | 
| 112 114 | 
             
                      end
         | 
| 113 115 |  | 
| @@ -105,7 +105,6 @@ module Rookout | |
| 105 105 |  | 
| 106 106 | 
             
                  private
         | 
| 107 107 |  | 
| 108 | 
            -
                  # rubocop:disable Style/StderrPuts
         | 
| 109 108 | 
             
                  def connection_thread
         | 
| 110 109 | 
             
                    backoff = Backoff.new
         | 
| 111 110 |  | 
| @@ -115,7 +114,8 @@ module Rookout | |
| 115 114 |  | 
| 116 115 | 
             
                        if @print_on_initial_connection
         | 
| 117 116 | 
             
                          @print_on_initial_connection = false
         | 
| 118 | 
            -
                           | 
| 117 | 
            +
                          Utils.quiet_puts "[Rookout] Successfully connected to controller"
         | 
| 118 | 
            +
                          Utils.quiet_puts "[Rookout] Rook's ID is #{@agent_id}"
         | 
| 119 119 | 
             
                        end
         | 
| 120 120 | 
             
                        Logger.instance.debug "WebSocket connected successfully"
         | 
| 121 121 | 
             
                        Logger.instance.info "Finished initialization"
         | 
| @@ -139,13 +139,11 @@ module Rookout | |
| 139 139 | 
             
                  rescue Exception => e
         | 
| 140 140 | 
             
                    Logger.instance.error "Unexpected error in connection_thread", e
         | 
| 141 141 | 
             
                  end
         | 
| 142 | 
            -
                  # rubocop:enable Style/StderrPuts
         | 
| 143 142 |  | 
| 144 143 | 
             
                  def open_new_connection
         | 
| 145 144 | 
             
                    client = WebsocketClient.new @uri, @proxy, @token
         | 
| 146 145 | 
             
                    client.connect
         | 
| 147 146 |  | 
| 148 | 
            -
                    Logger.instance.info "Registering agent with id #{@agent_id}"
         | 
| 149 147 | 
             
                    msg = Com::Rookout::NewAgentMessage.new agent_info: @info.pack
         | 
| 150 148 | 
             
                    client.send_frame wrap_in_envelope(msg)
         | 
| 151 149 |  | 
    
        data/lib/rookout/commit.rb
    CHANGED
    
    
    
        data/lib/rookout/config.rb
    CHANGED
    
    | @@ -6,8 +6,10 @@ module Rookout | |
| 6 6 | 
             
                # Magic to allow for module variables to be easily accessible
         | 
| 7 7 | 
             
                class << self
         | 
| 8 8 | 
             
                  attr_accessor :debug
         | 
| 9 | 
            +
                  attr_accessor :quiet
         | 
| 9 10 |  | 
| 10 11 | 
             
                  Rookout::Config.debug = false
         | 
| 12 | 
            +
                  Rookout::Config.quiet = false
         | 
| 11 13 |  | 
| 12 14 | 
             
                  attr_accessor :logger_filename
         | 
| 13 15 | 
             
                  attr_accessor :logger_log_to_stderr
         | 
| @@ -112,7 +114,7 @@ module Rookout | |
| 112 114 | 
             
                      quota = configuration["RUBY_GLOBAL_RATE_LIMIT_QUOTA_MS"]
         | 
| 113 115 | 
             
                      window_size = configuration["RUBY_GLOBAL_RATE_LIMIT_WINDOW_SIZE_MS"]
         | 
| 114 116 |  | 
| 115 | 
            -
                      if quota != "" && window_size != ""
         | 
| 117 | 
            +
                      if quota != "" && !quota.nil? && window_size != "" && !window_size.nil?
         | 
| 116 118 | 
             
                        global_rate_limit = "#{quota}/#{window_size}"
         | 
| 117 119 | 
             
                      end
         | 
| 118 120 | 
             
                    end
         | 
    
        data/lib/rookout/exceptions.rb
    CHANGED
    
    
    
        data/lib/rookout/interface.rb
    CHANGED
    
    
    
        data/lib/rookout/utils.rb
    CHANGED
    
    | @@ -1,26 +1,34 @@ | |
| 1 | 
            -
            module  | 
| 2 | 
            -
               | 
| 1 | 
            +
            module Rookout
         | 
| 2 | 
            +
              module Utils
         | 
| 3 | 
            +
                require "securerandom"
         | 
| 4 | 
            +
                require_relative "config"
         | 
| 3 5 |  | 
| 4 | 
            -
             | 
| 6 | 
            +
                module_function
         | 
| 5 7 |  | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 8 | 
            +
                def uuid
         | 
| 9 | 
            +
                  SecureRandom.uuid.gsub(/-/, "")
         | 
| 10 | 
            +
                end
         | 
| 9 11 |  | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 12 | 
            +
                def milliseconds_to_nanoseconds milliseconds
         | 
| 13 | 
            +
                  nano = milliseconds * (10**6)
         | 
| 14 | 
            +
                  nano.to_i
         | 
| 15 | 
            +
                end
         | 
| 14 16 |  | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 17 | 
            +
                def time_to_nanoseconds time_obj
         | 
| 18 | 
            +
                  secs = time_obj.to_i
         | 
| 19 | 
            +
                  nsecs = time_obj.nsec
         | 
| 20 | 
            +
                  ((10**9) * secs) + nsecs
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                def quiet_puts msg
         | 
| 24 | 
            +
                  # rubocop:disable Style/StderrPuts
         | 
| 25 | 
            +
                  return if Config.quiet
         | 
| 26 | 
            +
                  $stderr.puts msg
         | 
| 27 | 
            +
                  # rubocop:enable Style/StderrPuts
         | 
| 28 | 
            +
                end
         | 
| 21 29 |  | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
                 | 
| 30 | 
            +
                def is_number? string
         | 
| 31 | 
            +
                  true if Float(string) rescue false
         | 
| 32 | 
            +
                end
         | 
| 25 33 | 
             
              end
         | 
| 26 34 | 
             
            end
         | 
    
        data/lib/rookout/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rookout
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.43
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Liran Haimovitch
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022- | 
| 11 | 
            +
            date: 2022-10-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: binding_of_caller
         |