class Jaeger::Samplers::RemoteControlled::InstructionsFetcher
Constants
- FetchFailed
Public Class Methods
new(host:, port:, service_name:)
click to toggle source
# File lib/jaeger/samplers/remote_controlled/instructions_fetcher.rb, line 9 def initialize(host:, port:, service_name:) @host = host @port = port @service_name = service_name end
Public Instance Methods
fetch()
click to toggle source
# File lib/jaeger/samplers/remote_controlled/instructions_fetcher.rb, line 15 def fetch http = Net::HTTP.new(@host, @port) path = "/sampling?service=#{CGI.escape(@service_name)}" response = begin http.request(Net::HTTP::Get.new(path)) rescue StandardError => e raise FetchFailed, e.inspect end unless response.is_a?(Net::HTTPSuccess) raise FetchFailed, "Unsuccessful response (code=#{response.code})" end JSON.parse(response.body) end