prometheus-client 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzhlZTZiM2NkOGU1ZDUzZWRlMDBkMmQyY2EwMDIxMTg5MjJkZDVhMQ==
4
+ NjQwNjBmMGRjMjYwMzJmOWVlMDRkNDJiNWM0MTQzYTkwNGE5MWVlZA==
5
5
  data.tar.gz: !binary |-
6
- ZmZkZjY1YWM0YjM1MThiOTlhODZiZDAyNDE2MjRjZDQ5YmQ1YzAxNQ==
6
+ MzEyNGViYThkNTViN2RlZTllYTE4MDE1OTQwNDBiMjdhZDQ4MmViNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Yjk5ODdiMjg2N2JjYWY0YmI0OTYwODg2M2I5ZDRjMWFjOGZmYmMxY2MyM2Q4
10
- YjZkODNmNzI3NzUzNWUxOTRkZGNkYWFkM2VmNzdmMjlmMjFlNjNhODMwNjky
11
- MjNhNmYzNzMwMDZjMWJkMTFlMTQzNzg0NDZmZGQ0ZTQ4ZmE1YWM=
9
+ MTBlMDI5NWY3M2UxODgxOTM2MTdiMWM1ODJhZDQxYzRmMGE4NTY2NTBmNWM1
10
+ ZjczYTQxZTk0ODNlYjk5YmQ3MDJjMzE0MDU1NTljOGU1ODBlYmY5YjRjOTYy
11
+ MmJlZTY4YWEyMjczMzQwNjVlMWEzZDNlM2VhZTIwZWYyYjY4MGM=
12
12
  data.tar.gz: !binary |-
13
- NWVhZDQ0ZDdjMTZiNzc4MDAyNWUzMTU5MzJmYzUyMjBlZDBhMzVlODZhMmY4
14
- OTE4ZDc2YTliNjU2YzVkZmI1NzA5YmZjNjA3OTZiMGEwMzBjNTVjNmU2YTJi
15
- YmZiMTFjNmYyNGEwNDhlOTljMDZiZTU4ZmFjMzUzMjY2YjMzNjI=
13
+ YWY2ZWRmOTcwZDE0YTdiOTI3MTRlMzE0MDVmNzU3M2RkMjlmYWMyN2E1OGQx
14
+ MjJlMTk4ZTg3OTQ3YzQyZTE0Nzg4NTEzYjk0ZDI3MDc5OTU5NWQyMjcyOTNk
15
+ MDg1MjcyNTllNmZjMzM5N2MxMGI5OWFiODUyNjA4MGYzMGNiMDA=
data/README.md CHANGED
@@ -35,8 +35,8 @@ http_requests.increment
35
35
  ### Rack middleware
36
36
 
37
37
  There are two [Rack][2] middlewares available, one to expose a metrics HTTP
38
- endpoint to be scraped by a prometheus server and one to trace all HTTP
39
- requests.
38
+ endpoint to be scraped by a prometheus server ([Exporter][9]) and one to trace all HTTP
39
+ requests ([Collector][10]).
40
40
 
41
41
  ```ruby
42
42
  # config.ru
@@ -160,3 +160,5 @@ rake
160
160
  [6]: https://codeclimate.com/github/prometheus/client_ruby.png
161
161
  [7]: https://coveralls.io/repos/prometheus/client_ruby/badge.png?branch=master
162
162
  [8]: https://github.com/prometheus/pushgateway
163
+ [9]: lib/prometheus/client/rack/exporter.rb
164
+ [10]: lib/prometheus/client/rack/collector.rb
@@ -11,8 +11,7 @@ module Prometheus
11
11
  MEDIA_TYPE = 'application/json'
12
12
  SCHEMA = 'prometheus/telemetry'
13
13
  VERSION = '0.0.2'
14
- CONTENT_TYPE = \
15
- %Q(#{MEDIA_TYPE}; schema="#{SCHEMA}"; version=#{VERSION})
14
+ CONTENT_TYPE = %(#{MEDIA_TYPE}; schema="#{SCHEMA}"; version=#{VERSION})
16
15
 
17
16
  MAPPING = { summary: :histogram }
18
17
 
@@ -7,7 +7,7 @@ module Prometheus
7
7
  module Text
8
8
  MEDIA_TYPE = 'text/plain'
9
9
  VERSION = '0.0.4'
10
- CONTENT_TYPE = %Q(#{MEDIA_TYPE}; version=#{VERSION})
10
+ CONTENT_TYPE = "#{MEDIA_TYPE}; version=#{VERSION}"
11
11
 
12
12
  METRIC_LINE = '%s%s %s'
13
13
  TYPE_LINE = '# TYPE %s %s'
@@ -55,7 +55,7 @@ module Prometheus
55
55
 
56
56
  l = labels(set)
57
57
  yield metric("#{name}_sum", l, value.sum)
58
- yield metric("#{name}_total", l, value.total)
58
+ yield metric("#{name}_count", l, value.total)
59
59
  end
60
60
 
61
61
  def self.metric(name, labels, value)
@@ -8,10 +8,10 @@ module Prometheus
8
8
  # TODO: we might allow setting :instance in the future
9
9
  RESERVED_LABELS = [:job, :instance]
10
10
 
11
- class LabelSetError < StandardError; end
11
+ class LabelSetError < StandardError; end
12
12
  class InvalidLabelSetError < LabelSetError; end
13
- class InvalidLabelError < LabelSetError; end
14
- class ReservedLabelError < LabelSetError; end
13
+ class InvalidLabelError < LabelSetError; end
14
+ class ReservedLabelError < LabelSetError; end
15
15
 
16
16
  def initialize
17
17
  @validated = {}
@@ -18,7 +18,8 @@ module Prometheus
18
18
  validate_docstring(docstring)
19
19
  @validator.valid?(base_labels)
20
20
 
21
- @name, @docstring = name, docstring
21
+ @name = name
22
+ @docstring = docstring
22
23
  @base_labels = base_labels
23
24
  end
24
25
 
@@ -20,9 +20,10 @@ module Prometheus
20
20
  attr_reader :job, :instance, :gateway, :path
21
21
 
22
22
  def initialize(job, instance = nil, gateway = nil)
23
- @job, @instance, @gateway = job, instance, gateway || DEFAULT_GATEWAY
24
-
25
- @uri = parse(@gateway)
23
+ @job = job
24
+ @instance = instance
25
+ @gateway = gateway || DEFAULT_GATEWAY
26
+ @uri = parse(@gateway)
26
27
  @path = build_path(job, instance)
27
28
  @http = Net::HTTP.new(@uri.host, @uri.port)
28
29
  end
@@ -6,7 +6,8 @@ module Prometheus
6
6
  module Client
7
7
  module Rack
8
8
  # Collector is a Rack middleware that provides a sample implementation of
9
- # a Prometheus HTTP client API.
9
+ # a HTTP tracer. The default label builder can be modified to export a
10
+ # different set of labels per recorded metric.
10
11
  class Collector
11
12
  attr_reader :app, :registry
12
13
 
@@ -37,7 +38,7 @@ module Prometheus
37
38
  @requests_duration = @registry.counter(
38
39
  :http_request_durations_total_microseconds,
39
40
  'The total amount of time spent answering HTTP requests ' \
40
- '(microseconds).',)
41
+ '(microseconds).')
41
42
  @durations = @registry.summary(
42
43
  :http_request_durations_microseconds,
43
44
  'A histogram of the response latency (microseconds).')
@@ -8,8 +8,7 @@ module Prometheus
8
8
  module Client
9
9
  module Rack
10
10
  # Exporter is a Rack middleware that provides a sample implementation of
11
- # a HTTP tracer. The default label builder can be modified to export a
12
- # differet set of labels per recorded metric.
11
+ # a Prometheus HTTP client API.
13
12
  class Exporter
14
13
  attr_reader :app, :registry, :path
15
14
 
@@ -13,7 +13,8 @@ module Prometheus
13
13
  attr_accessor :sum, :total
14
14
 
15
15
  def initialize(estimator)
16
- @sum, @total = estimator.sum, estimator.observations
16
+ @sum = estimator.sum
17
+ @total = estimator.observations
17
18
 
18
19
  estimator.invariants.each do |invariant|
19
20
  self[invariant.quantile] = estimator.query(invariant.quantile)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Prometheus
4
4
  module Client
5
- VERSION = '0.4.1'
5
+ VERSION = '0.4.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prometheus-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Schmidt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-23 00:00:00.000000000 Z
11
+ date: 2015-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: quantile