Mobrovac has uploaded a new change for review.
https://gerrit.wikimedia.org/r/303599
Change subject: service::node: Allow users to specify the logging name
......................................................................
service::node: Allow users to specify the logging name
Some services use the same service::node definition in different
contexts, so allow them to specify different logging names and statsd
prefixes for them.
One such case is Parsoid. In production, the 'parsoid' tag is used, but
on ruthenium (acting as the round-trip host), the logs and metrics ought
to have a different name. This patch also sets them to 'parsoid-tests'
for ruthenium.
Bug: T141464
Change-Id: I16d0b03e119d659ef2c977948af2e5fd831fe853
---
M hieradata/hosts/ruthenium.yaml
M modules/parsoid/manifests/init.pp
M modules/service/manifests/node.pp
M modules/service/templates/node/config.yaml.erb
4 files changed, 23 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/99/303599/1
diff --git a/hieradata/hosts/ruthenium.yaml b/hieradata/hosts/ruthenium.yaml
index 2fd7fb5..73adb06 100644
--- a/hieradata/hosts/ruthenium.yaml
+++ b/hieradata/hosts/ruthenium.yaml
@@ -3,3 +3,6 @@
- parsoid-admin
- parsoid-test-admins
- parsoid-test-roots
+
+parsoid::logging_name: parsoid-tests
+parsoid::statsd_prefix: parsoid-tests
diff --git a/modules/parsoid/manifests/init.pp
b/modules/parsoid/manifests/init.pp
index 99bee7c..6ac7399 100644
--- a/modules/parsoid/manifests/init.pp
+++ b/modules/parsoid/manifests/init.pp
@@ -13,6 +13,12 @@
# that Parsoid still draws part of its configuration from there when it is
# specified. Default: 'conf/wmf/localsettings.js'
#
+# [*logging_name*]
+# The logging name to send to logstash. Default: 'parsoid'
+#
+# [*statsd_prefix*]
+# The statsd metric prefix to use. Default: 'parsoid'
+#
# [*deployment*]
# Deployment system to use: available are trebuchet, scap3 or git.
# Default: trebuchet
@@ -20,6 +26,8 @@
class parsoid(
$port = 8000,
$settings_file = 'conf/wmf/localsettings.js',
+ $logging_name = 'parsoid',
+ $statsd_prefix = 'parsoid',
$deployment = undef,
) {
@@ -35,6 +43,8 @@
heartbeat_to => 180000,
healthcheck_url => '/',
has_spec => false,
+ logging_name => $logging_name,
+ statsd_prefix => $statsd_prefix,
auto_refresh => false,
deployment => $deployment,
}
diff --git a/modules/service/manifests/node.pp
b/modules/service/manifests/node.pp
index 64a88aa..f8668cc 100644
--- a/modules/service/manifests/node.pp
+++ b/modules/service/manifests/node.pp
@@ -72,6 +72,12 @@
# [*local_logging*]
# Whether to store log entries on the target node as well. Default: true
#
+# [*logging_name*]
+# The logging name to send to logstash. Default: $title
+#
+# [*statsd_prefix*]
+# The statsd metric prefix to use. Default: $title
+#
# [*auto_refresh*]
# Whether the service should be automatically restarted after config changes.
# Default: true
@@ -134,6 +140,8 @@
$entrypoint = '',
$starter_script = 'src/server.js',
$local_logging = true,
+ $logging_name = $title,
+ $statsd_prefix = $title,
$auto_refresh = true,
$init_restart = true,
$deployment = undef,
diff --git a/modules/service/templates/node/config.yaml.erb
b/modules/service/templates/node/config.yaml.erb
index ae20393..7bddd9c 100644
--- a/modules/service/templates/node/config.yaml.erb
+++ b/modules/service/templates/node/config.yaml.erb
@@ -28,7 +28,7 @@
# Logger info
logging:
- name: <%= @title %>
+ name: <%= @logging_name %>
level: warn
streams:
# Use gelf-stream -> logstash
@@ -43,7 +43,7 @@
# Statsd metrics reporter
metrics:
- name: <%= @title %>
+ name: <%= @statsd_prefix %>
type: statsd
host: <%= cvars['stat_host'] %>
port: <%= cvars['stat_port'] %>
--
To view, visit https://gerrit.wikimedia.org/r/303599
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I16d0b03e119d659ef2c977948af2e5fd831fe853
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mobrovac <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits