protor-ruby
Prometheus aggregator client for ruby
Installation
In Gemfile
gem 'protor'
Then run
bundle install
Usage
Counter
It automatically aggregate value
Protor.counter(:counter, 1, {label1: 1}) # value => 1
Protor.counter(:counter, 1, {label1: 1}) # value => 2
Gauge
It automatically replace value
Protor.gauge(:gauge, 50) # value 50
Protor.gauge(:gauge, 20) # value 20
Histogram
It save all observed values
Protor.histogram(:histogram, 10, {label1: 1}, [1,2,3,4]) # observed value [10]
Protor.histogram(:histogram, 2, {label1: 1}, [1,2,3,4]( # observed value [10,2]
Publish
To publish all saved metrics to aggregator
Protor.publish
Configuration
To configure protor:
Protor.configure do |config|
config.host = 'localhost' # aggregator host, default to localhost
config.port = 10601 # aggregator port, default to 10601
config.max_packet_size = 56607 # max udp packet buffer, default to 56607
end
Contributing
Fork the project and send pull requests.