lib/contrast/components/app_context.rb in contrast-agent-4.6.0 vs lib/contrast/components/app_context.rb in contrast-agent-4.7.0
- old
+ new
@@ -35,13 +35,13 @@
tmp = Contrast::Agent.framework_manager.server_type unless Contrast::Utils::StringUtils.present?(tmp)
tmp
end
end
- def name
- @_name ||= begin
- tmp = CONFIG.root.application.name
+ def app_name
+ @_app_name ||= begin
+ tmp = CONFIG.root.application.name # rubocop:disable Security/Module/Name
tmp = Contrast::Agent.framework_manager.app_name unless Contrast::Utils::StringUtils.present?(tmp)
tmp = File.basename(Dir.pwd) unless Contrast::Utils::StringUtils.present?(tmp)
Contrast::Utils::StringUtils.truncate(tmp, DEFAULT_APP_NAME)
rescue StandardError
DEFAULT_APP_NAME
@@ -57,11 +57,11 @@
end
end
def server_name
@_server_name ||= begin
- tmp = CONFIG.root.server.name
+ tmp = CONFIG.root.server.name # rubocop:disable Security/Module/Name
tmp = Socket.gethostname unless Contrast::Utils::StringUtils.present?(tmp)
tmp = Contrast::Utils::StringUtils.force_utf8(tmp)
Contrast::Utils::StringUtils.truncate(tmp, DEFAULT_SERVER_NAME)
rescue StandardError
DEFAULT_SERVER_NAME
@@ -86,11 +86,11 @@
msg = Contrast::Api::Dtm::AgentStartup.build(server_name, server_path, server_type)
logger.info('Application context',
server_name: msg.server_name,
server_path: msg.server_path,
server_type: msg.server_type,
- application_name: name,
+ application_name: app_name,
application_path: path,
application_language: Contrast::Utils::ObjectShare::RUBY)
msg
end
@@ -106,10 +106,10 @@
def pgid
Process.getpgid(pid)
end
def client_id
- @_client_id ||= [name, pgid].join('-')
+ @_client_id ||= [app_name, pgid].join('-')
end
def instrument_middleware_stack?
!Contrast::Utils::JobServersRunning.job_servers_running?
end