Restore basic process metrics

Restore basic process metrics

Previously we had rich process metrics from: frankenstein/process_metrics.rb at master · mpalmer/frankenstein · GitHub

and so on.

This restores some of the basic metrics

diff --git a/Gemfile.lock b/Gemfile.lock
index 85daa5a..2aebc9b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -55,7 +55,7 @@ GEM
     parser (2.6.0.0)
       ast (~> 2.4.0)
     powerpack (0.1.2)
-    prometheus_exporter (0.4.3)
+    prometheus_exporter (0.4.4)
     pry (0.12.2)
       coderay (~> 1.1.0)
       method_source (~> 0.9.0)
@@ -85,7 +85,7 @@ GEM
       diff-lcs (>= 1.2.0, < 2.0)
       rspec-support (~> 3.8.0)
     rspec-support (3.8.0)
-    rubocop (0.63.1)
+    rubocop (0.64.0)
       jaro_winkler (~> 1.5.1)
       parallel (~> 1.10)
       parser (>= 2.5, != 2.5.1.1)
diff --git a/lib/mobystash/system.rb b/lib/mobystash/system.rb
index 05bc909..8f16631 100644
--- a/lib/mobystash/system.rb
+++ b/lib/mobystash/system.rb
@@ -39,6 +39,8 @@ module Mobystash
       if @config.enable_metrics
 
         require 'prometheus_exporter/server'
+        require 'prometheus_exporter/client'
+        require 'prometheus_exporter/instrumentation'
 
         @logger.info(progname) { "Starting metrics server" }
 
@@ -46,6 +48,11 @@ module Mobystash
         PrometheusExporter::Metric::Base.default_prefix = ""
         @metrics_server = PrometheusExporter::Server::WebServer.new(port: 9367)
 
+        PrometheusExporter::Client.default = PrometheusExporter::LocalClient.new(collector:  @metrics_server.collector)
+
+        # basic process instrumentation including rss, gc stats
+        PrometheusExporter::Instrumentation::Process.start
+
         @config.metrics.each do |metric|
           @metrics_server.collector.register_metric(metric)
         end
@@ -94,7 +101,11 @@ module Mobystash
           @containers.values.each { |c| c.shutdown! }
           write_state_file
           @config.logstash_writer.stop
-          @metrics_server.stop if @metrics_server
+
+          if @metrics_server
+            PrometheusExporter::Instrumentation::Process.stop
+            @metrics_server.stop
+          end
           break
         else
           @logger.error(progname) { "SHOULDN'T HAPPEN: docker watcher sent an unrecognized message: #{item.inspect}.  This is a bug, please report it." }

GitHub sha: 95a9f415