prometheus-client 4.2.0 → 4.2.2

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: 6a1dc488e71cf101782ff38e48a4fb76477ac8806f48d9af033b599e2dd6381d
4
- data.tar.gz: d8ec80118888f89365a66af533e2465660a4cc4034b30812354c7c833bb42fcc
3
+ metadata.gz: 2b36b20b2f61361da60e32c5d29776dcfb5137ab36a1fe08efbaa40ab0bee9ae
4
+ data.tar.gz: 84dcf52b5225ccf0d1aa06038bb93158002d418251d6612f00178415be3285c9
5
5
  SHA512:
6
- metadata.gz: fb7fbb85311059b82805454a7582d326ac792584d0784744b3f6c767316101474d2e4afe980aefc984bc6cbec01a4a246ece74dca0bc2738bfc8fa0f8f3c5705
7
- data.tar.gz: d9d8e28717b85f2ced2dbbf796d8ce4eb475457dd2302bc5aabfdf45767cf846067ef55a3b1a923d0a8d233ba86bb6d205ed0f9984590bfceff19d7b30b79c33
6
+ metadata.gz: 74472339fc3183ac0ea27c2d3c95e716452f51cdea3f0c0e4055f2bf34c23da0e507c8b638b0fe489b425b4d667e1046349df5d4eef8cc29c74c6f31738f313b
7
+ data.tar.gz: 6e71e65c6b3f9f04124dce86fb7fd8b08c5bdfb0f02d71f89815ea88ef7e9880f2c2b0ec60c2b2c74cb06056befbfdde42534f33a688d78252b880ea44a00ee5
@@ -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,9 +87,20 @@ 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 = job.to_s
91
+
92
+ # Job can't be empty, but it can contain `/`, so we need to base64
93
+ # encode it in that case
94
+ if job.include?('/')
95
+ encoded_job = Base64.urlsafe_encode64(job)
96
+ path = "#{PATH}/job@base64/#{encoded_job}"
97
+ else
98
+ path = "#{PATH}/job/#{ERB::Util::url_encode(job)}"
99
+ end
91
100
 
92
101
  grouping_key.each do |label, value|
102
+ value = value.to_s
103
+
93
104
  if value.include?('/')
94
105
  encoded_value = Base64.urlsafe_encode64(value)
95
106
  path += "/#{label}@base64/#{encoded_value}"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Prometheus
4
4
  module Client
5
- VERSION = '4.2.0'
5
+ VERSION = '4.2.2'
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.2.0
4
+ version: 4.2.2
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-07-28 00:00:00.000000000 Z
13
+ date: 2023-10-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: benchmark-ips