File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 22
33# Unreleased changes
44
5- _ None outstanding_
5+ ## Bug fixes
6+
7+ - [ #296 ] ( https://github.com/prometheus/client_ruby/pull/296 ) Stringify non-string job
8+ names in push client:
9+ Previously, an error would be raised if you passed a symbol as the job name, which
10+ is inconsistent with how we handle label values in the rest of the client. This
11+ change converts the job name to a string before trying to use it.
612
713# 4.2.1 / 2023-08-04
814
Original file line number Diff line number Diff line change @@ -87,6 +87,8 @@ def parse(url)
8787 end
8888
8989 def build_path ( job , grouping_key )
90+ job = job . to_s
91+
9092 # Job can't be empty, but it can contain `/`, so we need to base64
9193 # encode it in that case
9294 if job . include? ( '/' )
Original file line number Diff line number Diff line change 9393 expect ( push . path ) . to eql ( '/metrics/job/test-job/foo/bar/baz/qux' )
9494 end
9595
96+ it 'converts non-string job names to strings' do
97+ push = Prometheus ::Client ::Push . new (
98+ job : :foo ,
99+ )
100+
101+ expect ( push . path ) . to eql ( '/metrics/job/foo' )
102+ end
103+
96104 it 'encodes the job name in url-safe base64 if it contains `/`' do
97105 push = Prometheus ::Client ::Push . new (
98106 job : 'foo/test-job' ,
You can’t perform that action at this time.
0 commit comments