prometheus-client 4.1.0 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47fef80d530cba8aed214132cb1eb512c7094f9e0daa89db9d5db3f2f0393980
4
- data.tar.gz: 98cfad337c9ff3907ba519fbd355e81697108af3251ec574fbb2c14bdd35af2c
3
+ metadata.gz: d4744fe6d558634c6fa56a7280a4e7f19f4e7007236f61fbf70da25ffba2b2f9
4
+ data.tar.gz: 4b7e9ba6a1f32a30105317233e86dfbb67c292a554fa1f1b75e93b9aae3004de
5
5
  SHA512:
6
- metadata.gz: 844a860cf2090a1833a0f3a24d0c7629a761391f69aac8ebea5550463a2219947144438caae36662038cdf242747eea0afe42f3fbe2e86e2e4177f75ee1e50bf
7
- data.tar.gz: 3429071dd55ee6f0493790b8860639e653e0e0bb4ddfdc1dffc30c051a66df598272ea2056e9ef87e0c67eb964606cfeba29c9faf05408f2e40e48ab09e31fbc
6
+ metadata.gz: 48e636ba5c9b9b192f0342988ee971fdebf6e6ed88e2054468cae841aff6b984bd6210ee9a0e2d5a84a9ae36f0e5d65ec668601f21af0c980eb4d3e27f861b10
7
+ data.tar.gz: 6ba530af29c963aa1c1088f0a2319da994c11cc032d2fc799ca24ffc331bf372c2bc213dff2eb29651e01f46d17f9be85d503ee367df6a13888f72c204830c5a
@@ -20,6 +20,10 @@ module Prometheus
20
20
  @store.set(labels: label_set_for(labels), val: value)
21
21
  end
22
22
 
23
+ def set_to_current_time(labels: {})
24
+ @store.set(labels: label_set_for(labels), val: Time.now.to_f)
25
+ end
26
+
23
27
  # Increments Gauge value by 1 or adds the given value to the Gauge.
24
28
  # (The value can be negative, resulting in a decrease of the Gauge.)
25
29
  def increment(by: 1, labels: {})
@@ -23,7 +23,7 @@ module Prometheus
23
23
  class HttpServerError < HttpError; end
24
24
 
25
25
  DEFAULT_GATEWAY = 'http://localhost:9091'.freeze
26
- PATH = '/metrics/job/%s'.freeze
26
+ PATH = '/metrics'.freeze
27
27
  SUPPORTED_SCHEMES = %w(http https).freeze
28
28
 
29
29
  attr_reader :job, :gateway, :path
@@ -87,7 +87,14 @@ module Prometheus
87
87
  end
88
88
 
89
89
  def build_path(job, grouping_key)
90
- path = format(PATH, ERB::Util::url_encode(job))
90
+ # Job can't be empty, but it can contain `/`, so we need to base64
91
+ # encode it in that case
92
+ if job.include?('/')
93
+ encoded_job = Base64.urlsafe_encode64(job)
94
+ path = "#{PATH}/job@base64/#{encoded_job}"
95
+ else
96
+ path = "#{PATH}/job/#{ERB::Util::url_encode(job)}"
97
+ end
91
98
 
92
99
  grouping_key.each do |label, value|
93
100
  if value.include?('/')
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Prometheus
4
4
  module Client
5
- VERSION = '4.1.0'
5
+ VERSION = '4.2.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prometheus-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Kochie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-03-20 00:00:00.000000000 Z
13
+ date: 2023-08-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: benchmark-ips
@@ -40,6 +40,20 @@ dependencies:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: timecop
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
43
57
  description:
44
58
  email:
45
59
  - superq@gmail.com
@@ -89,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
103
  - !ruby/object:Gem::Version
90
104
  version: '0'
91
105
  requirements: []
92
- rubygems_version: 3.3.26
106
+ rubygems_version: 3.4.10
93
107
  signing_key:
94
108
  specification_version: 4
95
109
  summary: A suite of instrumentation metric primitivesthat can be exposed through a