Ori.livneh has submitted this change and it was merged.

Change subject: webperf: factor out local configuration to role class
......................................................................


webperf: factor out local configuration to role class

- Do not configure 'statsd' in webperf module
- Parametrize statsd host / port in asset_check and navtiming
- Provision via role::webperf
- Replace StatsD with txStatsD

Change-Id: I3bc7e1a998a8eedeb77bfdad7aaf24f34f412054
---
A manifests/role/webperf.pp
M manifests/site.pp
M modules/webperf/manifests/asset_check.pp
M modules/webperf/manifests/navtiming.pp
4 files changed, 55 insertions(+), 36 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/manifests/role/webperf.pp b/manifests/role/webperf.pp
new file mode 100644
index 0000000..4273404
--- /dev/null
+++ b/manifests/role/webperf.pp
@@ -0,0 +1,20 @@
+# == Class: role::webperf
+#
+# This role provisions a set of front-end monitoring tools that feed
+# into StatsD.
+#
+class role::webperf {
+    include ::role::txstatsd
+
+    # Aggregate client-side latency measurements collected via the
+    # NavigationTiming MediaWiki extension and send them to Graphite.
+    # See <https://www.mediawiki.org/wiki/Extension:NavigationTiming>
+    class { '::webperf::navtiming':
+        endpoint => 'tcp://vanadium.eqiad.wmnet:8600',
+    }
+
+    # Provisions a service which gather stats about static assets count
+    # and size using a headless browser instance. Stats are forwarded to
+    # Ganglia using gmetric.
+    class { '::webperf::asset_check': }
+}
diff --git a/manifests/site.pp b/manifests/site.pp
index 9285dd5..33a4a14 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -2528,16 +2528,14 @@
 }
 
 # Hosts visualization / monitoring of EventLogging event streams
-# and MediaWiki errors. Non-critical at the moment. See RT #5514.
+# and MediaWiki errors.
 node 'hafnium.wikimedia.org' {
-    include standard,
-        role::eventlogging::graphite,
-        webperf,
-        webperf::asset_check,
-        webperf::navtiming
+    include standard
+    include role::eventlogging::graphite
+    include role::webperf
 }
 
-# StatsD & Graphite
+# Primary Graphite, StatsD, and profiling data aggregation host.
 node 'tungsten.eqiad.wmnet' {
     include standard
     include role::graphite
diff --git a/modules/webperf/manifests/asset_check.pp 
b/modules/webperf/manifests/asset_check.pp
index 84b4d35..8b918ab 100644
--- a/modules/webperf/manifests/asset_check.pp
+++ b/modules/webperf/manifests/asset_check.pp
@@ -2,9 +2,22 @@
 #
 # Provisions a service which gather stats about static assets count
 # and size using a headless browser instance. Stats are forwarded to
-# Ganglia using gmetric.
+# StatsD.
 #
-class webperf::asset_check {
+# === Parameters
+#
+# [*statsd_host*]
+#   Write stats to this StatsD instance. Default: '127.0.0.1'.
+#
+# [*statsd_port*]
+#   Write stats to this StatsD instance. Default: 8125.
+#
+class webperf::asset_check(
+    statsd_host = '127.0.0.1',
+    statsd_port = 8125,
+) {
+    include ::webperf
+
     package { 'phantomjs':
         ensure => present,
     }
diff --git a/modules/webperf/manifests/navtiming.pp 
b/modules/webperf/manifests/navtiming.pp
index 6a4cbc1..178902d 100644
--- a/modules/webperf/manifests/navtiming.pp
+++ b/modules/webperf/manifests/navtiming.pp
@@ -4,22 +4,31 @@
 # See https://meta.wikimedia.org/wiki/Schema:NavigationTiming &
 # http://www.mediawiki.org/wiki/Extension:NavigationTiming
 #
+# === Parameters
+#
+# [*endpoint*]
+#   URI of EventLogging event publisher to subscribe to.
+#   Example: 'tcp://eventlogging.corp.org:8600'.
+#
+# [*statsd_host*]
+#   Write stats to this StatsD instance. Default: '127.0.0.1'.
+#
+# [*statsd_port*]
+#   Write stats to this StatsD instance. Default: 8125.
+#
 class webperf::navtiming(
-    $endpoint    = 'tcp://vanadium.eqiad.wmnet:8600',
+    $endpoint,
     $statsd_host = '127.0.0.1',
     $statsd_port = 8125,
 ) {
+    include ::webperf
+
     file { '/srv/webperf/navtiming.py':
         source => 'puppet:///modules/webperf/navtiming.py',
         owner  => 'www-data',
         group  => 'www-data',
         mode   => '0755',
         notify => Service['navtiming'],
-    }
-
-    file { '/usr/local/share/statsd/mediansOnlyFilter.js':
-        content => 'exports.filter = function ( m ) { return /median$/.test( 
m.name ) && m; };',
-        before  => Service['statsd'],
     }
 
     file { '/etc/init/navtiming.conf':
@@ -30,26 +39,5 @@
     service { 'navtiming':
         ensure   => running,
         provider => upstart,
-    }
-
-    class { '::statsd':
-        settings => {
-            flushInterval    => 5 * 60 * 1000,  # 5 min.
-            backends         => [ 'ganglia' ],
-            gangliaFilters   => [ 
'/usr/local/share/statsd/mediansOnlyFilter.js' ],
-            address          => $statsd_host,
-            percentThreshold => [ 95 ],
-            # Show frequency distribution of client-side latency times.
-            # See <http://tinyurl.com/statsd-histograms>.
-            histogram        => [
-                {
-                    metric => 'browser',
-                    bins   => [ 100, 500, 1000, 2000, 5000, 'inf' ],
-                },
-            ],
-            gangliaHost      => $::ganglia::mcast_address,
-            gangliaMulticast => true,
-            gangliaSpoofHost => 'client-side',
-        },
     }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/108816
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3bc7e1a998a8eedeb77bfdad7aaf24f34f412054
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <jenkins-...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to