From 4d20e8c0d0c319c11cdda64af9104ffe8dbd5f74 Mon Sep 17 00:00:00 2001 From: Michael Messmore Date: Thu, 10 Jun 2021 12:15:00 -0500 Subject: [PATCH] Restore unique_host_name logic PR #870 reversed the logic overriding the default_unique_host_name with the application_name. This results in problems with AppDynamics where applications running on multiple foundations are unable to add metrics when using the same application name in Cloud Foundry. Really, application_name should never be used. unique_host_name is by definition a unique identifier vs an application_name, which is not guaranteed to be unique. But this restores the previous logic, which was functional and may have handled cases I am not aware of. --- lib/java_buildpack/framework/app_dynamics_agent.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/java_buildpack/framework/app_dynamics_agent.rb b/lib/java_buildpack/framework/app_dynamics_agent.rb index 545ff70daa..dada5ce87b 100644 --- a/lib/java_buildpack/framework/app_dynamics_agent.rb +++ b/lib/java_buildpack/framework/app_dynamics_agent.rb @@ -138,8 +138,8 @@ def tier_name(java_opts, credentials) end def unique_host_name(java_opts) - name = @configuration['default_unique_host_name'] - name = Shellwords.escape(@application.details['application_name']) if @application.details['application_name'] + name = Shellwords.escape(@application.details['application_name']) + name = @configuration['default_unique_host_name'] if @configuration['default_unique_host_name'] java_opts.add_system_property('appdynamics.agent.uniqueHostId', name.to_s) end