Yuvipanda has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/142228

Change subject: diamond: Prefix metrics with project name
......................................................................

diamond: Prefix metrics with project name

Change-Id: I275aa5d9a54191a1a52d3c44b81580265746acfb
---
M manifests/role/diamond.pp
M modules/diamond/manifests/init.pp
M modules/diamond/templates/diamond.conf.erb
3 files changed, 17 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/28/142228/1

diff --git a/manifests/role/diamond.pp b/manifests/role/diamond.pp
index d2f8d99..6779ac7 100644
--- a/manifests/role/diamond.pp
+++ b/manifests/role/diamond.pp
@@ -14,11 +14,18 @@
         default: { $host = '10.64.0.18' }
     }
 
+    # Prefix labs metrics with project name
+    case $::realm {
+        'labs': { $path_prefix = $::instanceproject }
+        default: { $path_prefix = 'system' }
+    }
+
     class { '::diamond':
-        settings => {
-            enabled => 'true',
-            host    => $host,
-            port    => '8125',
+        settings        => {
+            enabled     => 'true',
+            host        => $host,
+            port        => '8125',
+            path_prefix => $path_prefix,
         },
     }
 
diff --git a/modules/diamond/manifests/init.pp 
b/modules/diamond/manifests/init.pp
index 415af04..30731c0 100644
--- a/modules/diamond/manifests/init.pp
+++ b/modules/diamond/manifests/init.pp
@@ -25,6 +25,10 @@
 #   See <https://github.com/BrightcoveOS/Diamond/wiki/Handlers>
 #   for a listing of configuration options.
 #
+# [*path_prefix*]
+#   The prefix to be used for metrics, used to namespace where
+#   the metric came from.
+#
 # === Examples
 #
 # A Graphite configuration for Diamond:
@@ -43,6 +47,7 @@
     $settings = { host => 'localhost',
                   port => '8125',
     },
+    $path_prefix = 'system',
 ) {
     package { [ 'python-diamond', 'python-configobj' ]:
         ensure => present,
diff --git a/modules/diamond/templates/diamond.conf.erb 
b/modules/diamond/templates/diamond.conf.erb
index 6f077cc..a85fe83 100644
--- a/modules/diamond/templates/diamond.conf.erb
+++ b/modules/diamond/templates/diamond.conf.erb
@@ -24,7 +24,7 @@
 [collectors]
 [[default]]
 ### Defaults options for all Collectors
-path_prefix = servers
+path_prefix = <%= @path_prefix %>
 interval = <%= @interval %>
 
 [loggers]

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I275aa5d9a54191a1a52d3c44b81580265746acfb
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to