Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve path handling in pushgateway client #220

Merged
merged 5 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/prometheus/client/push.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Push

def initialize(job:, instance: nil, gateway: DEFAULT_GATEWAY, **kwargs)
raise ArgumentError, "job cannot be nil" if job.nil?
raise ArgumentError, "job cannot be empty" if job.empty?
Sinjo marked this conversation as resolved.
Show resolved Hide resolved

@mutex = Mutex.new
@job = job
Expand Down
6 changes: 6 additions & 0 deletions spec/prometheus/client/push_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
end.to raise_error ArgumentError
end

it 'raises an ArgumentError if the job is empty' do
expect do
Prometheus::Client::Push.new(job: "")
end.to raise_error ArgumentError
end

it 'raises an ArgumentError if the given gateway URL is invalid' do
['inva.lid:1233', 'http://[invalid]'].each do |url|
expect do
Expand Down