-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added LWRP for New Relic Dot Net Core Agent install
Changes to be committed: modified: .kitchen.yml modified: attributes/repository.rb modified: libraries/helpers.rb modified: libraries/matchers.rb modified: metadata.rb modified: providers/agent_dotnet.rb new file: providers/agent_dotnetcore.rb modified: recipes/default.rb new file: recipes/dotnetcore_agent.rb new file: resources/agent_dotnetcore.rb modified: spec/unit/agent_dotnet_spec.rb new file: spec/unit/agent_dotnetcore_spec.rb modified: spec/unit/agent_php_spec.rb modified: spec/unit/default_spec.rb modified: spec/unit/repository_spec.rb new file: test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_dotnetcore.rb modified: test/fixtures/cookbooks/newrelic_lwrp_test/recipes/agent_php.rb new file: test/integration/dotnetcore-agent/serverspec/default_spec.rb
- Loading branch information
Chris Norman
committed
Dec 31, 2018
1 parent
cf50a25
commit e69eed2
Showing
18 changed files
with
415 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# | ||
# Cookbook Name:: newrelic | ||
# Recipe:: agent_dotnetcore | ||
# | ||
# | ||
|
||
# include helper methods | ||
include NewRelic::Helpers | ||
|
||
use_inline_resources if defined?(use_inline_resources) | ||
|
||
action :install do | ||
check_license | ||
newrelic_repository | ||
newrelic_install | ||
end | ||
|
||
action :remove do | ||
remove_newrelic | ||
end | ||
|
||
def newrelic_install | ||
# run newrelic-install dependent on execution platform_family | ||
case node['platform_family'] | ||
when 'debian', 'rhel', 'amazon' | ||
install_newrelic_dotnetcore_linux | ||
when 'windows' | ||
install_newrelic_dotnetcore_windows | ||
end | ||
end | ||
|
||
def install_newrelic_dotnetcore_linux | ||
case node['platform_family'] | ||
when 'debian' | ||
install_newrelic_apt | ||
when 'rhel', 'amazon' | ||
install_newrelic_yum | ||
end | ||
|
||
magic_shell_environment 'CORECLR_NEWRELIC_HOME' do | ||
action :add | ||
value new_resource.CoreCLR_NewRelic_home | ||
end | ||
|
||
template "#{new_resource.CoreCLR_NewRelic_home}/newrelic.config" do | ||
cookbook new_resource.cookbook | ||
source new_resource.source | ||
variables( | ||
:resource => new_resource | ||
) | ||
sensitive true | ||
end | ||
end | ||
|
||
def install_newrelic_apt | ||
apt_update 'update' do | ||
action :update | ||
end | ||
apt_package 'Install New Relic .Net Core Agent using apt' do | ||
package_name 'newrelic-netcore20-agent' | ||
action :upgrade | ||
end | ||
end | ||
|
||
def install_newrelic_yum | ||
yum_package 'newrelic-netcore20-agent' do | ||
flush_cache [:before] | ||
allow_downgrade true | ||
package_name 'newrelic-netcore20-agent' | ||
action :install | ||
end | ||
end | ||
|
||
def install_newrelic_dotnetcore_windows | ||
zipfile 'unzip source to NewRelic directory' do | ||
from new_resource.https_download | ||
into new_resource.config_dir | ||
not_if { ::File.exist?('#{new_resource.config_dir}\NewRelic.Profiler.dll') } | ||
end | ||
|
||
env 'CORECLR_NEWRELIC_HOME' do | ||
action :create | ||
value new_resource.config_dir | ||
end | ||
|
||
env 'CORECLR_PROFILER' do | ||
action :create | ||
value '{36032161-FFC0-4B61-B559-F6C5D41BAE5A}' | ||
end | ||
|
||
env 'CORECLR_PROFILER_PATH' do | ||
action :create | ||
value '%CORECLR_NEWRELIC_HOME%\NewRelic.Profiler.dll' | ||
end | ||
|
||
template "#{new_resource.config_dir}\\newrelic.config" do | ||
cookbook new_resource.cookbook | ||
source new_resource.source | ||
variables( | ||
:resource => new_resource | ||
) | ||
sensitive true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# Cookbook Name:: newrelic | ||
# Recipe:: dotnet_agent | ||
# | ||
# | ||
# | ||
|
||
newrelic_agent_dotnetcore 'Install' do | ||
https_download node['newrelic']['dotnetcore_agent']['https_download'] unless node['newrelic']['dotnetcore_agent']['https_download'].nil? | ||
# install_level node['newrelic']['dotnet_agent']['install_level'] unless node['newrelic']['dotnet_agent']['install_level'].nil? | ||
license lazy { NewRelic.application_monitoring_license(node) } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# | ||
# Cookbook Name:: newrelic | ||
# Resource:: agent_dotnetcore | ||
# | ||
# | ||
|
||
actions :install, :remove | ||
default_action :install | ||
|
||
attribute :CoreCLR_NewRelic_home, :kind_of => String, :default => '/usr/local/newrelic-netcore20-agent' | ||
attribute :https_download, :kind_of => String, :default => 'http://download.newrelic.com/dot_net_agent/latest_release/newrelic-netcore20-agent-win-x64-8.5.186.0.zip' | ||
attribute :install_level, :kind_of => String, :default => '1' | ||
attribute :config_dir, :kind_of => String, :default => 'C:\New Relic\newrelic-netcore20-agent' | ||
attribute :cookbook, :kind_of => String, :default => 'newrelic' | ||
attribute :source, :kind_of => String, :default => 'agent/dotnet/newrelic.config.erb' | ||
|
||
attribute :enabled, :kind_of => [TrueClass, FalseClass], :default => true | ||
attribute :max_stack_trace_lines, :kind_of => Integer, :default => 80 | ||
attribute :timing_precision, :kind_of => String, :default => 'low' | ||
|
||
attribute :license, :kind_of => String, :default => lazy { NewRelic.application_monitoring_license(node) } | ||
attribute :daemon_ssl, :kind_of => [TrueClass, FalseClass], :default => true | ||
attribute :svc_send_env_info, :kind_of => [TrueClass, FalseClass], :default => true | ||
attribute :svc_sync_startup, :kind_of => [TrueClass, FalseClass], :default => false | ||
attribute :svc_send_data_on_exit, :kind_of => [TrueClass, FalseClass], :default => false | ||
attribute :svc_send_data_on_exit_threshold, :kind_of => Integer, :default => 60_000 | ||
attribute :svc_auto_start, :kind_of => [TrueClass, FalseClass], :default => true | ||
|
||
attribute :use_proxy, :kind_of => [TrueClass, FalseClass], :default => false | ||
attribute :proxy_host, :kind_of => String, :default => '' | ||
attribute :proxy_port, :kind_of => Integer, :default => 8080 | ||
attribute :proxy_domain, :kind_of => String, :default => '' | ||
attribute :proxy_user, :kind_of => String, :default => '' | ||
attribute :proxy_password, :kind_of => String, :default => '' | ||
|
||
attribute :app_log_level, :kind_of => String, :default => 'info' | ||
attribute :audit_log_enabled, :kind_of => [TrueClass, FalseClass], :default => false | ||
attribute :log_to_console, :kind_of => [TrueClass, FalseClass], :default => false | ||
attribute :log_directory, :kind_of => String, :default => 'C:\ProgramData\New Relic\.NETCore Agent\Logs' | ||
attribute :log_file_name, :kind_of => String, :default => 'newrelic.log' | ||
|
||
attribute :app_name, :kind_of => String, :default => 'Default Application' | ||
attribute :app_disable_samplers, :kind_of => [TrueClass, FalseClass], :default => false | ||
|
||
attribute :instrumentation_applications, :kind_of => Array, :default => [] | ||
attribute :instrumentation_log_enable, :kind_of => [TrueClass, FalseClass], :default => false | ||
|
||
attribute :attributes_collection_enabled, :kind_of => [TrueClass, FalseClass], :default => true | ||
attribute :attributes_exclude, :kind_of => Array, :default => [] | ||
attribute :attributes_include, :kind_of => Array, :default => [] | ||
|
||
attribute :app_pools, :kind_of => Array, :default => [] # [{name: '', instrument: true|false}] | ||
attribute :app_pools_instrument_default_behavior, :kind_of => [TrueClass, FalseClass], :default => false | ||
|
||
attribute :cross_application_tracer_enabled, :kind_of => [TrueClass, FalseClass], :default => true | ||
|
||
attribute :error_collector_enabled, :kind_of => [TrueClass, FalseClass], :default => true | ||
attribute :ignored_exceptions, :kind_of => Array, :default => [ | ||
'System.IO.FileNotFoundException', | ||
'System.Threading.ThreadAbortException' | ||
] | ||
attribute :ignored_status_codes, :kind_of => Array, :default => [401, 404] | ||
|
||
attribute :high_security_enabled, :kind_of => [TrueClass, FalseClass], :default => false | ||
|
||
attribute :tx_events_enabled, :kind_of => [TrueClass, FalseClass], :default => true | ||
attribute :tx_events_max_samples_per_minute, :kind_of => Integer, :default => 10_000 | ||
attribute :tx_events_max_samples_stored, :kind_of => Integer, :default => 10_000 | ||
attribute :tx_events_attributes_collection_enabled, :kind_of => [TrueClass, FalseClass], :default => true | ||
attribute :tx_events_attributes_exclude, :kind_of => Array, :default => [] | ||
attribute :tx_events_attributes_include, :kind_of => Array, :default => [] | ||
|
||
attribute :custom_events_enabled, :kind_of => [TrueClass, FalseClass], :default => true | ||
|
||
attribute :labels, :kind_of => String, :default => '' | ||
|
||
attribute :browser_monitoring_auto_instrument, :kind_of => [TrueClass, FalseClass], :default => true | ||
attribute :browser_monitoring_req_paths_excluded, :kind_of => Array, :default => [] | ||
attribute :browser_monitoring_attributes_collection_enabled, :kind_of => [TrueClass, FalseClass], :default => true | ||
attribute :browser_monitoring_attributes_exclude, :kind_of => Array, :default => [] | ||
attribute :browser_monitoring_attributes_include, :kind_of => Array, :default => [] | ||
|
||
attribute :slow_queries_enabled, :kind_of => [TrueClass, FalseClass], :default => true | ||
|
||
attribute :tx_tracer_enabled, :kind_of => [TrueClass, FalseClass], :default => true | ||
attribute :tx_tracer_transaction_threshold, :kind_of => String, :default => 'apdex_f' | ||
attribute :tx_tracer_stack_trace_threshold, :kind_of => Integer, :default => 500 | ||
attribute :tx_tracer_record_sql, :kind_of => String, :default => 'obfuscated' | ||
attribute :tx_tracer_explain_enabled, :kind_of => [TrueClass, FalseClass], :default => true | ||
attribute :tx_tracer_explain_threshold, :kind_of => Integer, :default => 500 | ||
attribute :tx_tracer_max_segments, :kind_of => Integer, :default => 3_000 | ||
attribute :tx_tracer_max_stack_trace, :kind_of => Integer, :default => 30 | ||
attribute :tx_tracer_max_explain_plans, :kind_of => Integer, :default => 20 | ||
attribute :tx_tracer_attributes_collection_enabled, :kind_of => [TrueClass, FalseClass], :default => true | ||
attribute :tx_tracer_attributes_exclude, :kind_of => Array, :default => [] | ||
attribute :tx_tracer_attributes_include, :kind_of => Array, :default => [] | ||
|
||
attribute :ignored_thread_profiling_methods, :kind_of => Array, :default => [ | ||
'System.Threading.WaitHandle:InternalWaitOne', | ||
'System.Threading.WaitHandle:WaitAny' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.