class ElasticAPM::Transport::UserAgent

@api private

Public Class Methods

new(config, version: VERSION) click to toggle source
# File lib/elastic_apm/transport/user_agent.rb, line 24
def initialize(config, version: VERSION)
  @version = version
  @built = build(config)
end

Public Instance Methods

to_s() click to toggle source
# File lib/elastic_apm/transport/user_agent.rb, line 29
def to_s
  @built
end

Private Instance Methods

build(config) click to toggle source
# File lib/elastic_apm/transport/user_agent.rb, line 35
def build(config)
  service = Metadata::ServiceInfo.new(config)

  [
    "elastic-apm-ruby/#{@version}",
    HTTP::Request::USER_AGENT,
    [
      service.runtime.name,
      service.runtime.version
    ].join('/')
  ].join(' ')
end