class ElasticAPM::Config::ServerInfo

@api private

Constants

VERSION_0
VERSION_8_0

Attributes

config[R]
http[R]
payload[R]

Public Class Methods

new(config) click to toggle source
# File lib/elastic_apm/config/server_info.rb, line 29
def initialize(config)
  @config = config
  @http = Transport::Connection::Http.new(config)
end

Public Instance Methods

execute() click to toggle source
# File lib/elastic_apm/config/server_info.rb, line 34
def execute
  resp = http.get(config.server_url)
  @payload = JSON.parse(resp.body)
rescue
  @payload = { "version" => VERSION_0 }
end
version() click to toggle source
# File lib/elastic_apm/config/server_info.rb, line 41
def version
  @version ||= begin
    execute
    payload["version"] ? payload["version"].to_s : VERSION_0
  end
end