service_skeleton 0.0.0.20.gb9a0460 → 0.0.0.25.gbf57918
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/README.md +8 -8
- data/lib/service_skeleton/config_variables.rb +6 -0
- data/lib/service_skeleton/signal_handler.rb +3 -0
- 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: 89afe58f5f8ce484ee0250284bae409b7d3a4f8f279747d1ee17e575befaa7df
         | 
| 4 | 
            +
              data.tar.gz: 2c6cc5ff9cf019be8e8c8258e5713c86090aa62dd2dddda7d10c22fece7a992d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7ab638d056ee90b752eb55fe4494fc2c395295413c651ad4e5f7b1b322e611ac02b02caf1c2b782c0518afb120708409ea92ec00f8d8258ef6116b12277e6885
         | 
| 7 | 
            +
              data.tar.gz: 73be99a6c35c5885e1e6edbac125ed0998f657421fa0b0a2dff019e468e47d14ae95d55ad6396cf81ddeb46867dea8e0f3b233bda13355d72c88333de90adb9d
         | 
    
        data/README.md
    CHANGED
    
    | @@ -146,7 +146,7 @@ that way you can get coerced values (numbers and booleans, rather than strings | |
| 146 146 | 
             
            everywhere), range and format checking (say "the number must be between one and
         | 
| 147 147 | 
             
            ten", or "the string must match this regex"), default values, and error
         | 
| 148 148 | 
             
            reporting.  You also get direct access to the configuration value as a method
         | 
| 149 | 
            -
            call on the  | 
| 149 | 
            +
            call on the `config` object.
         | 
| 150 150 |  | 
| 151 151 | 
             
            To declare configuration variables, simply call one of the "config declaration
         | 
| 152 152 | 
             
            methods" (as listed in the `ServiceSkeleton::ConfigVariables` module) in your
         | 
| @@ -263,9 +263,9 @@ class method in your service's class definition, like this: | |
| 263 263 |  | 
| 264 264 | 
             
                  def run
         | 
| 265 265 | 
             
                    loop do
         | 
| 266 | 
            -
             | 
| 267 | 
            -
             | 
| 268 | 
            -
             | 
| 266 | 
            +
                      puts config.something_funny
         | 
| 267 | 
            +
                      sleep 1
         | 
| 268 | 
            +
                    end
         | 
| 269 269 | 
             
                  end
         | 
| 270 270 | 
             
                end
         | 
| 271 271 |  | 
| @@ -327,7 +327,7 @@ All are all-uppercase, and the `<SERVICENAME>_` portion is the all-uppercase | |
| 327 327 | 
             
              override the default log level for messages with a specific progname, by
         | 
| 328 328 | 
             
              specifying one or more "progname severities" separated by commas.  A progname
         | 
| 329 329 | 
             
              severity looks like this:
         | 
| 330 | 
            -
             | 
| 330 | 
            +
             | 
| 331 331 | 
             
                    <progname>=<severity>
         | 
| 332 332 |  | 
| 333 333 | 
             
              To make things even more fun, if `<progname>` looks like a regular expression
         | 
| @@ -418,7 +418,7 @@ infinite loop. | |
| 418 418 |  | 
| 419 419 | 
             
            To register a metric, use one of the standard metric registration methods from
         | 
| 420 420 | 
             
            [Prometheus::Client::Registry](https://www.rubydoc.info/gems/prometheus-client/0.8.0/Prometheus/Client/Registry)
         | 
| 421 | 
            -
            (`#counter`,  | 
| 421 | 
            +
            (`#counter`, `#gauge`, `#histogram`, `#summary`, or `#register`) on the `metrics`
         | 
| 422 422 | 
             
            object to create or register the metric.
         | 
| 423 423 |  | 
| 424 424 | 
             
            In our generic greeter service we've been using as an example so far, you might
         | 
| @@ -451,7 +451,7 @@ on `metrics`.  Thus, to increment our greeting counter, you can simply do: | |
| 451 451 |  | 
| 452 452 | 
             
                    loop do
         | 
| 453 453 | 
             
                      puts "Hello, #{config.recipient}!"
         | 
| 454 | 
            -
             | 
| 454 | 
            +
                      metrics.greetings_total.increment(recipient: config.recipient)
         | 
| 455 455 | 
             
                      sleep 1
         | 
| 456 456 | 
             
                    end
         | 
| 457 457 | 
             
                  end
         | 
| @@ -470,7 +470,7 @@ before defining the metric accessor method, which keeps typing to a minimum: | |
| 470 470 |  | 
| 471 471 | 
             
                    loop do
         | 
| 472 472 | 
             
                      puts "Hello, #{config.recipient}!"
         | 
| 473 | 
            -
             | 
| 473 | 
            +
                      metrics.greetings_total.increment(recipient: config.recipient)
         | 
| 474 474 | 
             
                      sleep 1
         | 
| 475 475 | 
             
                    end
         | 
| 476 476 | 
             
                  end
         | 
| @@ -75,6 +75,12 @@ class ServiceSkeleton | |
| 75 75 | 
             
                  end
         | 
| 76 76 | 
             
                end
         | 
| 77 77 |  | 
| 78 | 
            +
                def path_list(var_name, default: UNDEFINED, sensitive: false)
         | 
| 79 | 
            +
                  register_variable(var_name, sensitive: sensitive) do |value|
         | 
| 80 | 
            +
                    value.split(":")
         | 
| 81 | 
            +
                  end
         | 
| 82 | 
            +
                end
         | 
| 83 | 
            +
             | 
| 78 84 | 
             
                private
         | 
| 79 85 |  | 
| 80 86 | 
             
                def maybe_default(value, default, var_name)
         | 
| @@ -112,6 +112,9 @@ class ServiceSkeleton | |
| 112 112 | 
             
                          logger.error(logloc) { "Mysterious return from select: #{ios.inspect}" }
         | 
| 113 113 | 
             
                        end
         | 
| 114 114 | 
             
                      end
         | 
| 115 | 
            +
                    rescue IOError
         | 
| 116 | 
            +
                      # Something has gone terribly wrong here... bail
         | 
| 117 | 
            +
                      break
         | 
| 115 118 | 
             
                    rescue StandardError => ex
         | 
| 116 119 | 
             
                      log_exception(ex) { "Exception in select loop" }
         | 
| 117 120 | 
             
                    end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: service_skeleton
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0.0. | 
| 4 | 
            +
              version: 0.0.0.25.gbf57918
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Matt Palmer
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2019- | 
| 11 | 
            +
            date: 2019-03-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: frankenstein
         |