Initial delivery of metrics code (#81)

* Initial delivery of metrics code

* Fix build issues

* Fix build issue with go vet
This commit is contained in:
Stephen Marshall
2018-05-24 09:15:12 +01:00
committed by Rob Parker
parent e251839639
commit a4b9a9abaf
727 changed files with 108381 additions and 71624 deletions

View File

@@ -0,0 +1,31 @@
# Prometheus Ruby client model
Data model artifacts for the [Prometheus Ruby client][1].
## 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][1], it's possible to use it without the client to decode a stream of
delimited protobuf messages:
```ruby
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
```
[1]: https://github.com/prometheus/client_ruby