Created
December 1, 2014 17:40
-
-
Save goyox86/4290e0c95abd86d76858 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'influxdb' | |
class InfluxdbEmitter | |
def initialize | |
@username = "root" | |
@password = "root" | |
@database = "rbx1" | |
#InfluxDB::Client.new.create_database(@database) | |
@influxdb = InfluxDB::Client.new @database, username: @username, | |
password: @password | |
end | |
def start! | |
if RUBY_ENGINE != 'rbx' | |
puts "Not RBX. Nothing to do here!" | |
return | |
end | |
Thread.new do | |
loop do | |
metrics = Rubinius::Metrics.data.keys | |
metrics.each do |metric| | |
@influxdb.write_point(metric, { value: Rubinius::Metrics.data[metric] }) | |
end | |
sleep 1 | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment