diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | lib/longboat/server.rb | 13 | ||||
-rwxr-xr-x | longboat | 8 |
3 files changed, 16 insertions, 6 deletions
@@ -1 +1,2 @@ *.swp +env diff --git a/lib/longboat/server.rb b/lib/longboat/server.rb new file mode 100644 index 0000000..474a7ed --- /dev/null +++ b/lib/longboat/server.rb @@ -0,0 +1,13 @@ +require 'sinatra/base' + +module Longboat + module Server + def self.serve!(collector) + Sinatra.new { + get '/metrics' do + collector.prometheus_metrics + end + }.run! + end + end +end @@ -2,7 +2,6 @@ $LOAD_PATH << './lib' require 'longboat' -#require 'longboat/server' collector = Longboat::Collector.new @@ -10,8 +9,5 @@ jobs = Longboat::Jobs.new jobs.load(collector) t = jobs.collect_every -sleep 5 -puts collector.prometheus_metrics -t.exit - -#Longboat::Server.serve! +require 'longboat/server' +Longboat::Server.serve!(collector) |