Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 847 Bytes

README.md

File metadata and controls

33 lines (21 loc) · 847 Bytes

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'

content = open('http://localhost:9100/metrics', 'Accept' => CONTENT_TYPE).read
buffer = Beefcake::Buffer.new(content)

while family = Prometheus::Client::MetricFamily.read_delimited(buffer)
  puts family
end