Skip to content
This repository was archived by the owner on Jan 21, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions jobs/uaa/templates/newrelic.yml.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
<% if properties.uaa && properties.uaa.newrelic && properties.uaa.newrelic.common && properties.uaa.newrelic.common.license_key %>
<%= require 'yaml'; YAML.dump(p('uaa.newrelic')) %>
<% end %>
<%
if properties.uaa && properties.uaa.newrelic
newrelicenv = String.new("production")
if properties.uaa && properties.uaa.newrelic && properties.uaa.newrelic.environment
newrelicenv = p('uaa.newrelic.environment')
end

hasnewreliclic = false
if properties.uaa.newrelic.common && properties.uaa.newrelic.common.license_key
hasnewreliclic = true
elsif p('uaa.newrelic.'+newrelicenv+'.license_key').to_s.strip.length > 0
hasnewreliclic = true
end

if hasnewreliclic %>
<%= require 'yaml'; YAML.dump(p('uaa.newrelic').tap{|x| x.delete('environment')}) %><%
end
end
%>
23 changes: 20 additions & 3 deletions jobs/uaa/templates/uaa_ctl.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,26 @@ fi
<% end %>

NEWRELIC_OPTS=
<% if properties.uaa && properties.uaa.newrelic && properties.uaa.newrelic.common && properties.uaa.newrelic.common.license_key %>
NEWRELIC_OPTS="-javaagent:/var/vcap/data/uaa/tomcat/bin/newrelic.jar -Dnewrelic.config.file=$JOB_DIR/config/newrelic.yml"
<% end %>
<%
if properties.uaa && properties.uaa.newrelic
newrelicenv = String.new("production")
if properties.uaa && properties.uaa.newrelic && properties.uaa.newrelic.environment
newrelicenv = p('uaa.newrelic.environment')
end

hasnewreliclic = false
if properties.uaa.newrelic.common && properties.uaa.newrelic.common.license_key
hasnewreliclic = true
elsif p('uaa.newrelic.'+newrelicenv+'.license_key').to_s.strip.length > 0
hasnewreliclic = true
end

if hasnewreliclic %>
<%= "NEWRELIC_OPTS=\"-javaagent:/var/vcap/data/uaa/tomcat/bin/newrelic.jar -Dnewrelic.config.file=$JOB_DIR/config/newrelic.yml -Dnewrelic.environment="+newrelicenv+"\"" %><%
end
end
%>

export NEWRELIC_OPTS

source /var/vcap/packages/common/utils.sh
Expand Down