From 05492c03a029057eeab4f06a571902fd32365e9f Mon Sep 17 00:00:00 2001 From: Paul Borg Date: Mon, 29 Aug 2016 11:05:53 +1000 Subject: [PATCH 1/6] Update Java Agent to emit max_stack_trace_lines --- providers/agent_java.rb | 1 + recipes/java_agent.rb | 1 + resources/agent_java.rb | 1 + templates/default/agent/newrelic.yml.erb | 7 +++++++ 4 files changed, 10 insertions(+) diff --git a/providers/agent_java.rb b/providers/agent_java.rb index 4b1aa327..e57a19d6 100644 --- a/providers/agent_java.rb +++ b/providers/agent_java.rb @@ -1,3 +1,4 @@ + # # Cookbook Name:: newrelic # Recipe:: agent_java diff --git a/recipes/java_agent.rb b/recipes/java_agent.rb index 9e376a0f..c86d87a4 100644 --- a/recipes/java_agent.rb +++ b/recipes/java_agent.rb @@ -16,6 +16,7 @@ enabled node['newrelic']['application_monitoring']['enabled'] unless node['newrelic']['application_monitoring']['enabled'].nil? app_name node['newrelic']['application_monitoring']['app_name'] unless node['newrelic']['application_monitoring']['app_name'].nil? high_security NewRelic.to_boolean(node['newrelic']['application_monitoring']['high_security']) unless node['newrelic']['application_monitoring']['high_security'].nil? + max_stack_trace_lines node['newrelic']['java_agent']['max_stack_trace_lines'] unless node['newrelic']['java_agent']['max_stack_trace_lines'].nil? app_user node['newrelic']['java_agent']['app_user'] unless node['newrelic']['java_agent']['app_user'].nil? app_group node['newrelic']['java_agent']['app_group'] unless node['newrelic']['java_agent']['app_group'].nil? logfile node['newrelic']['application_monitoring']['logfile'] unless node['newrelic']['application_monitoring']['logfile'].nil? diff --git a/resources/agent_java.rb b/resources/agent_java.rb index 06388561..8e41e62f 100644 --- a/resources/agent_java.rb +++ b/resources/agent_java.rb @@ -22,6 +22,7 @@ attribute :enabled, :kind_of => [TrueClass, FalseClass], :default => true attribute :app_name, :kind_of => String, :default => nil attribute :high_security, :kind_of => [TrueClass, FalseClass], :default => false +attribute :max_stack_trace_lines, :kind_of => String, :default => nil attribute :logfile, :kind_of => String, :default => nil attribute :logfile_path, :kind_of => String, :default => nil attribute :loglevel, :kind_of => String, :default => nil diff --git a/templates/default/agent/newrelic.yml.erb b/templates/default/agent/newrelic.yml.erb index 3c291d5b..4a4dca18 100644 --- a/templates/default/agent/newrelic.yml.erb +++ b/templates/default/agent/newrelic.yml.erb @@ -62,6 +62,13 @@ common: &default_settings high_security: <%= @resource.high_security %> <% end %> + # Limits the number of lines the agent collects from each stack trace. + # Increasing this value may impact performance, because it increases the amount of memory the agent uses and + # the amount of data sent to New Relic. + <% unless @resource.max_stack_trace_lines.nil? %> + max_stack_trace_lines: <%= @resource.max_stack_trace_lines %> + <% end %> + # The agent uses its own log file to keep its logging # separate from that of your application. Specify the log level here. # This setting is dynamic, so changes do not require restarting your application. From eab15ccfb3e3d47fb137ec8d3be9e4d6e0dc6a26 Mon Sep 17 00:00:00 2001 From: Paul Borg Date: Mon, 29 Aug 2016 14:07:20 +1000 Subject: [PATCH 2/6] Update README and modify comments --- README.md | 5 ++++- templates/default/agent/newrelic.yml.erb | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d8c7cc7..97809237 100644 --- a/README.md +++ b/README.md @@ -414,10 +414,13 @@ The `newrelic_agent_java` resource will handle the requirements to install java * `'template_cookbook'` Sets cookbook for template, defaults to 'newrelic' * `'template_source'` Sets source for template, defaults to `agent/newrelic.yml.erb` -#### Advanced parameters +#### Advanced parameters +See https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-configuration-config-file +for an explanation on each attribute. * `'enabled'` default => true * `'high_security'` default => false +* `'max_stack_trace_lines'` default => false * `'owner'` default => 'newrelic' * `'group'` default => 'newrelic' * `'logfile'` default => nil diff --git a/templates/default/agent/newrelic.yml.erb b/templates/default/agent/newrelic.yml.erb index 4a4dca18..7fa7b681 100644 --- a/templates/default/agent/newrelic.yml.erb +++ b/templates/default/agent/newrelic.yml.erb @@ -65,6 +65,7 @@ common: &default_settings # Limits the number of lines the agent collects from each stack trace. # Increasing this value may impact performance, because it increases the amount of memory the agent uses and # the amount of data sent to New Relic. + # Default is 30. <% unless @resource.max_stack_trace_lines.nil? %> max_stack_trace_lines: <%= @resource.max_stack_trace_lines %> <% end %> From 5827a509f10287ae6c92baaca32d52777bb185e4 Mon Sep 17 00:00:00 2001 From: Paul Borg Date: Mon, 29 Aug 2016 14:32:36 +1000 Subject: [PATCH 3/6] Remove newline at top --- providers/agent_java.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/providers/agent_java.rb b/providers/agent_java.rb index e57a19d6..4b1aa327 100644 --- a/providers/agent_java.rb +++ b/providers/agent_java.rb @@ -1,4 +1,3 @@ - # # Cookbook Name:: newrelic # Recipe:: agent_java From 8ca51f3776eb287b17047e641a15736082aaba70 Mon Sep 17 00:00:00 2001 From: Paul Borg Date: Mon, 29 Aug 2016 14:51:02 +1000 Subject: [PATCH 4/6] Add unnecessary attribute :max_stack_trace_lines to ruby agent config so it can use the same erb tample as the java agent --- resources/agent_ruby.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/agent_ruby.rb b/resources/agent_ruby.rb index 860401c4..16c3dffe 100644 --- a/resources/agent_ruby.rb +++ b/resources/agent_ruby.rb @@ -19,6 +19,7 @@ attribute :enabled, :kind_of => [TrueClass, FalseClass], :default => true attribute :app_name, :kind_of => String, :default => nil attribute :high_security, :kind_of => [TrueClass, FalseClass], :default => false +attribute :max_stack_trace_lines, :kind_of => String, :default => nil attribute :owner, :kind_of => String, :default => 'newrelic' attribute :group, :kind_of => String, :default => 'newrelic' attribute :logfile, :kind_of => String, :default => 'newrelic-daemon.log' From 33a16aa9f72f30f644eed64b0addddc689706664 Mon Sep 17 00:00:00 2001 From: Paul Borg Date: Thu, 29 Sep 2016 10:23:54 +1000 Subject: [PATCH 5/6] Update newrelic.yml ERB --- templates/default/agent/newrelic.yml.erb | 87 ++++++++++++++++-------- 1 file changed, 58 insertions(+), 29 deletions(-) diff --git a/templates/default/agent/newrelic.yml.erb b/templates/default/agent/newrelic.yml.erb index 7fa7b681..d0d056c3 100644 --- a/templates/default/agent/newrelic.yml.erb +++ b/templates/default/agent/newrelic.yml.erb @@ -62,14 +62,6 @@ common: &default_settings high_security: <%= @resource.high_security %> <% end %> - # Limits the number of lines the agent collects from each stack trace. - # Increasing this value may impact performance, because it increases the amount of memory the agent uses and - # the amount of data sent to New Relic. - # Default is 30. - <% unless @resource.max_stack_trace_lines.nil? %> - max_stack_trace_lines: <%= @resource.max_stack_trace_lines %> - <% end %> - # The agent uses its own log file to keep its logging # separate from that of your application. Specify the log level here. # This setting is dynamic, so changes do not require restarting your application. @@ -170,28 +162,34 @@ common: &default_settings proxy_password: <%= @resource.daemon_proxy_password %> <% end %> - # Tells transaction tracer and error collector (when enabled) - # whether or not to capture HTTP params. When true, frameworks can - # exclude HTTP parameters from being captured. - # Default is false. - <% if @resource.capture_params.nil? %> - capture_params: false - <% else %> - capture_params: <%= @resource.capture_params %> - <% end %> - - # Tells transaction tracer and error collector to not to collect - # specific http request parameters. - <% if @resource.ignored_params.nil? %> - # ignored_params: credit_card, ssn, password - <% else %> - ignored_params: <%= @resource.ignored_params %> - <% end %> - # Configure New Relic to detect custom traces # https://docs.newrelic.com/docs/agents/java-agent/custom-instrumentation/java-instrumentation-annotation enable_custom_tracing: <%= @resource.enable_custom_tracing %> + # Limits the number of lines the agent collects from each stack trace. + # Increasing this value may impact performance, because it increases the amount of memory the agent uses and + # the amount of data sent to New Relic. + # Default is 30. + <% unless @resource.max_stack_trace_lines.nil? %> + max_stack_trace_lines: <%= @resource.max_stack_trace_lines %> + <% end %> + + # Provides the ability to configure the attributes sent to New Relic. These + # attributes can be found in transaction traces, traced errors, Insight's + # transaction events, and Insight's page views. + attributes: + + # When true, attributes will be sent to New Relic. The default is true. + enabled: true + + #A comma separated list of attribute keys whose values should + # be sent to New Relic. + #include: + + # A comma separated list of attribute keys whose values should + # not be sent to New Relic. + #exclude: + # Transaction tracer captures deep information about slow # transactions and sends this to the New Relic service once a # minute. Included in the transaction is the exact call sequence of @@ -275,7 +273,6 @@ common: &default_settings # Default is 20. top_n: 20 - # Error collector captures information about uncaught exceptions and # sends them to New Relic for viewing error_collector: @@ -306,10 +303,22 @@ common: &default_settings ignore_status_codes: <%= @resource.error_collector_ignore_status_codes %> <% end %> + # Transaction Events are used for Histograms and Percentiles. Unaggregated data is collected + # for each web transaction and sent to the server on harvest. + transaction_events: + + # Set to false to disable transaction events. + # Default is true. + enabled: true + + # Events are collected up to the configured amount. Afterwards, events are sampled to + # maintain an even distribution across the harvest cycle. + # Default is 2000. Setting to 0 will disable. + max_samples_stored: 2000 + # Cross Application Tracing adds request and response headers to - # external calls using the Apache HttpClient libraries to provided better + # external calls using supported HTTP libraries to provide better # performance data when calling applications monitored by other New Relic Agents. - # cross_application_tracer: # Set to true to enable cross application tracing. # Default is true. @@ -358,6 +367,26 @@ common: &default_settings # Default is true. enabled: true + class_transformer: + # This instrumentation reports the name of the user principal returned from + # HttpServletRequest.getUserPrincipal() when servlets and filters are invoked. + com.newrelic.instrumentation.servlet-user: + enabled: false + + com.newrelic.instrumentation.spring-aop-2: + enabled: false + + # Classes loaded by classloaders in this list will not be instrumented. + # This is a useful optimization for runtimes which use classloaders to + # load dynamic classes which the agent would not instrument. + classloader_excludes: + groovy.lang.GroovyClassLoader$InnerLoader, + org.codehaus.groovy.runtime.callsite.CallSiteClassLoader, + com.collaxa.cube.engine.deployment.BPELClassLoader, + org.springframework.data.convert.ClassGeneratingEntityInstantiator$ObjectInstantiatorClassGenerator, + org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer$ContextClassLoader, + gw.internal.gosu.compiler.SingleServingGosuClassLoader, + # Application Environments # ------------------------------------------ # Environment specific settings are in this section. From f91c1f4efe3b2369f84424eb2904316e8402f3af Mon Sep 17 00:00:00 2001 From: Paul Borg Date: Fri, 2 Dec 2016 10:04:59 +1100 Subject: [PATCH 6/6] Update call to reboot and terminate --- .idea/newrelic.iml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.idea/newrelic.iml b/.idea/newrelic.iml index 579af63c..1a4cad63 100644 --- a/.idea/newrelic.iml +++ b/.idea/newrelic.iml @@ -1,5 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +