class ElasticAPM::ServiceInfo

@api private

def self.build(config)

def self.build(config)
  new(config).build
end

def build

rubocop:disable Metrics/MethodLength
def build
  base = {
    name: @config.service_name,
    environment: @config.environment,
    agent: {
      name: 'ruby',
      version: VERSION
    },
    framework: nil,
    language: {
      name: 'ruby',
      version: RUBY_VERSION
    },
    runtime: runtime,
    version: @config.service_version || Util.git_sha
  }
  if @config.framework_name
    base[:framework] = {
      name: @config.framework_name,
      version: @config.framework_version
    }
  end
  base
end

def initialize(config)

def initialize(config)
  @config = config
end

def runtime

def runtime
  case RUBY_ENGINE
  when 'ruby'
    { name: RUBY_ENGINE, version: RUBY_VERSION }
  when 'jruby'
    { name: RUBY_ENGINE, version: ENV['JRUBY_VERSION'] }
  end
end