class Fluent::Plugin::PrometheusInput::AsyncWrapper::AsyncHttpWrapper

Public Class Methods

new(http) click to toggle source
# File lib/fluent/plugin/in_prometheus/async_wrapper.rb, line 24
def initialize(http)
  @http = http
end

Public Instance Methods

get(path) click to toggle source
# File lib/fluent/plugin/in_prometheus/async_wrapper.rb, line 28
def get(path)
  error = nil
  response = Async::Task.current.async {
    begin
      @http.get(path)
    rescue => e               # Async::Reactor rescue all error. handle it by itself
      error = e
    end
  }.wait

  if error
    raise error
  end

  Response.new(response.status.to_s, response.read || '', response.headers)
end