module Fluent::Plugin::PrometheusInput::AsyncWrapper

Constants

Response

Public Instance Methods

do_request(host:, port:, secure:) { |async_http_wrapper| ... } click to toggle source
# File lib/fluent/plugin/in_prometheus/async_wrapper.rb, line 6
def do_request(host:, port:, secure:)
  endpoint =
    if secure
      context = OpenSSL::SSL::SSLContext.new
      context.verify_mode = OpenSSL::SSL::VERIFY_NONE
      Async::HTTP::Endpoint.parse("https://#{host}:#{port}", ssl_context: context)
    else
      Async::HTTP::Endpoint.parse("http://#{host}:#{port}")
    end

  Async::HTTP::Client.open(endpoint) do |client|
    yield(AsyncHttpWrapper.new(client))
  end
end