binctr/vendor/github.com/prometheus/client_model/ruby
Jess Frazelle cdd93563f5 add better generate
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
2018-03-20 01:33:56 -04:00
..
lib/prometheus/client add better generate 2018-03-20 01:33:56 -04:00
.gitignore add better generate 2018-03-20 01:33:56 -04:00
Gemfile add better generate 2018-03-20 01:33:56 -04:00
LICENSE add better generate 2018-03-20 01:33:56 -04:00
Makefile add better generate 2018-03-20 01:33:56 -04:00
prometheus-client-model.gemspec add better generate 2018-03-20 01:33:56 -04:00
Rakefile add better generate 2018-03-20 01:33:56 -04:00
README.md add better generate 2018-03-20 01:33:56 -04:00

Prometheus Ruby client model

Data model artifacts for the Prometheus Ruby client.

Installation

gem install prometheus-client-model

Usage

Build the artifacts from the protobuf specification:

make build

While this Gem's main purpose is to define the Prometheus data types for the client, it's possible to use it without the client to decode a stream of delimited protobuf messages:

require 'open-uri'
require 'prometheus/client/model'

CONTENT_TYPE = 'application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited'

stream = open('http://localhost:9090/metrics', 'Accept' => CONTENT_TYPE).read
while family = Prometheus::Client::MetricFamily.read_delimited(stream)
  puts family
end