Skip to content

Commit

Permalink
(#780) Use dedicated parameter for jruby profiler
Browse files Browse the repository at this point in the history
This introduces a new parameter to disable the profiling indepently from
the metrics. Previously this was enabled by default. However Puppet Inc.
disables it in their standard configuration and the profiler causes a
significate memory and CPU overhead so I guess we should stick with the
upstream default.
  • Loading branch information
bastelfreak authored and ekohl committed Mar 29, 2021
1 parent 2ffa254 commit 12154ce
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,12 @@
#
# $server_puppetserver_jruby9k:: For Puppetserver 5, use JRuby 9k? Defaults to false
#
# $server_puppetserver_metrics:: Enable metrics (Puppetserver 5.x only) and JRuby profiling?
# $server_puppetserver_metrics:: Enable metrics (Puppetserver 5.x only)
# Defaults to true on Puppetserver 5.x and to false on Puppetserver 2.x
#
# $server_puppetserver_profiler:: Enable JRuby profiling.
# Defaults to false because that's the Puppet Inc. default behaviour.
#
# $server_metrics_jmx_enable:: Enable or disable JMX metrics reporter. Defaults to true
#
# $server_metrics_graphite_enable:: Enable or disable Graphite metrics reporter. Defaults to false
Expand Down Expand Up @@ -707,6 +710,7 @@
Integer[0] $server_web_idle_timeout = $puppet::params::server_web_idle_timeout,
Boolean $server_puppetserver_jruby9k = $puppet::params::server_puppetserver_jruby9k,
Optional[Boolean] $server_puppetserver_metrics = $puppet::params::server_puppetserver_metrics,
Boolean $server_puppetserver_profiler = false,
Boolean $server_metrics_jmx_enable = $puppet::params::server_metrics_jmx_enable,
Boolean $server_metrics_graphite_enable = $puppet::params::server_metrics_graphite_enable,
String $server_metrics_graphite_host = $puppet::params::server_metrics_graphite_host,
Expand Down
3 changes: 3 additions & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@
# $puppetserver_metrics:: Enable metrics (Puppetserver 5.x only) and JRuby profiling?
# Defaults to true on Puppetserver 5.x and to false on Puppetserver 2.x
#
# $puppetserver_profiler:: Enable JRuby profiling.
# Defaults to false because that's the Puppet Inc. default behaviour.#
#
# $metrics_jmx_enable:: Enable or disable JMX metrics reporter. Defaults to true
#
Expand Down Expand Up @@ -423,6 +425,7 @@
Boolean $allow_header_cert_info = $puppet::server_allow_header_cert_info,
Boolean $puppetserver_jruby9k = $puppet::server_puppetserver_jruby9k,
Optional[Boolean] $puppetserver_metrics = $puppet::server_puppetserver_metrics,
Boolean $puppetserver_profiler = $puppet::server_puppetserver_profiler,
Boolean $metrics_jmx_enable = $puppet::server_metrics_jmx_enable,
Boolean $metrics_graphite_enable = $puppet::server_metrics_graphite_enable,
String $metrics_graphite_host = $puppet::server_metrics_graphite_host,
Expand Down
1 change: 1 addition & 0 deletions manifests/server/puppetserver.pp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
$server_environment_class_cache_enabled = $puppet::server::environment_class_cache_enabled,
$server_jruby9k = $puppet::server::puppetserver_jruby9k,
$server_metrics = $puppet::server::real_puppetserver_metrics,
$server_profiler = $puppet::server::puppetserver_profiler,
$metrics_jmx_enable = $puppet::server::metrics_jmx_enable,
$metrics_graphite_enable = $puppet::server::metrics_graphite_enable,
$metrics_graphite_host = $puppet::server::metrics_graphite_host,
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/puppet_server_puppetserver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
it {
should contain_file(puppetserver_conf)
.with_content(/^ # Whether to enable http-client metrics; defaults to 'true'.\n metrics-enabled: true$(.*)/)
.with_content(/^profiler: \{\n # enable or disable profiling for the Ruby code;\n enabled: true/)
.with_content(/^profiler: \{\n # enable or disable profiling for the Ruby code;\n enabled: false/)
}
it {
should contain_file('/etc/custom/puppetserver/conf.d/metrics.conf')
Expand Down
2 changes: 1 addition & 1 deletion templates/server/puppetserver/conf.d/puppetserver.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,5 @@ http-client: {
# settings related to profiling the puppet Ruby code
profiler: {
# enable or disable profiling for the Ruby code;
enabled: <%= @server_metrics %>
enabled: <%= @server_profiler %>
}

0 comments on commit 12154ce

Please sign in to comment.