Ottomata has uploaded a new change for review.

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


Change subject: Fixing up Kafka object queries.  Many MBeans had to include 
escaped double quotes.
......................................................................

Fixing up Kafka object queries.  Many MBeans had to include escaped double 
quotes.

Change-Id: I9154271abbb5373d3edccf5b257f330209508eb6
---
M manifests/server/jmxtrans.pp
1 file changed, 108 insertions(+), 85 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet/kafka 
refs/changes/06/93806/1

diff --git a/manifests/server/jmxtrans.pp b/manifests/server/jmxtrans.pp
index caead6c..0c0f488 100644
--- a/manifests/server/jmxtrans.pp
+++ b/manifests/server/jmxtrans.pp
@@ -8,9 +8,12 @@
 # $ganglia       - Ganglia host:port
 # $graphite      - Graphite host:port
 # $outfile       - outfile to which Kafka stats will be written.
+# $objects       - objects parameter to pass to jmxtrans::metrics.  Only use
+#                  this if you need to override the default ones that this
+#                  class provides.
 #
 # == Usage
-# class { 'kafka::server::jmxtrans':
+# class { 'kafka::server::jmxtrans': 
 #     ganglia => 'ganglia.example.org:8649'
 # }
 #
@@ -19,6 +22,7 @@
     $ganglia     = undef,
     $graphite    = undef,
     $outfile     = undef,
+    $objects     = undef,
 ) inherits kafka::defaults
 {
     $jmx = "${::fqdn}:${jmx_port}"
@@ -30,6 +34,108 @@
         graphite             => $graphite,
     }
 
+
+    $kafka_objects = $objects ? {
+        undef   => [
+            {
+                'name'          => 
'\"kafka.log\":type=\"LogFlushStats\",name=\"LogFlushRateAndTimeMs\"',
+                "resultAlias"   => 
'kafka.log.LogFlushStats.LogFlushRateAndTimeMs',
+                'attrs'         => {
+                    'Count' => { 'units' => 'flushes',   'slope' => 'both' },
+                },
+            },
+            {
+                'name'          => 
'\"kafka.server\":type=\"BrokerTopicMetrics\",name=*',
+                "resultAlias"   => 'kafka.server.BrokerTopicMetrics',
+                'typeNames'     => ['name'],
+                'attrs'         => {
+                    'Count' => { 'slope' => 'both' },
+                },
+            },
+            {
+                  'name'        => 
'\"kafka.server\":type=\"ReplicaManager\",name=\"UnderReplicatedPartitions\"',
+                  "resultAlias" => 
'kafka.server.ReplicaManager.UnderReplicatedPartitions',
+                  'attrs'       => {
+                      'Value' => { 'units' => 'partitions', 'slope' => 'both' 
},
+                  },
+            },
+            {
+                  'name'         => 
'\"kafka.server\":type=\"ReplicaManager\",name=\"PartitionCount\"',
+                  "resultAlias"   => 
'kafka.server.ReplicaManager.PartitionCount',
+                  'attrs'        => {
+                      'Value' => { 'units' => 'partitions', 'slope' => 'both' 
},
+                  },
+            },
+            {
+                  'name'        => 
'\"kafka.server\":type=\"ReplicaManager\",name=\"LeaderCount\"',
+                  "resultAlias"   => 'kafka.server.ReplicaManager.LeaderCount',
+                  'attrs'       => {
+                      'Value' => { 'units' => 'leaders', 'slope' => 'both' },
+                  },
+            },
+            {
+                  'name'        => 
'\"kafka.server\":type=\"ReplicaManager\",name=\"ISRShrinksPerSec\"',
+                  "resultAlias"   => 
'kafka.server.ReplicaManager.ISRShrinksPerSec',
+                  'attrs'       => {
+                      'Count' => { 'units' => 'shrinks', 'slope' => 'both' },
+                  },
+            },
+            {
+                  'name'        => 
'\"kafka.server\":type=\"ReplicaManager\",name=\"IsrExpandsPerSec\"',
+                  "resultAlias"   => 
'kafka.server.ReplicaManager.IsrExpandsPerSec',
+                  'attrs'       => {
+                      'Count' => { 'units' => 'expands', 'slope' => 'both' },
+                  },
+            },
+            {
+                'name'          => 
'\"kafka.server\":type=\"ReplicaFetcherManager\",name=\"Replica-MaxLag\"',
+                "resultAlias"   => 
'kafka.server.ReplicaFetcherManager.Replica-MaxLag',
+                'attrs'         => {
+                    'Value' => { 'units' => 'messages',   'slope' => 'both' },
+                },
+            },
+            {
+                'name'          => 
'\"kafka.server\":type=\"ProducerRequestPurgatory\",name=\"PurgatorySize\"',
+                "resultAlias"   => 
'kafka.server.ProducerRequestPurgatory.PurgatorySize',
+                'attrs'         => {
+                    'Value' => { 'units' => 'messages', 'slope' => 'both' },
+                },
+            },
+            {
+                'name'          => 
'\"kafka.server\":type=\"FetchRequestPurgatory\",name=\"PurgatorySize\"',
+                "resultAlias"   => 
'kafka.server.FetchRequestPurgatory.PurgatorySize',
+                'attrs'         => {
+                    'Value' => { 'units' => 'messages', 'slope' => 'both' },
+                },
+            },
+            {
+                'name'          => 
'\"kafka.network\":type=\"RequestMetrics\",name=*',
+                "resultAlias"   => 'kafka.network.RequestMetrics',
+                'typeNames'     => ['name'],
+                'attrs'         => {
+                    'Count' => { 'slope' => 'both' },
+                },
+            },
+            {
+                'name'          => 
'\"kafka.controller\":type=\"KafkaController\",name=*',
+                "resultAlias"   => 'kafka.controller.KafkaController',
+                'typeNames'     => ['name'],
+                'attrs'         => {
+                    'Value' => { 'slope' => 'both' },
+                },
+            },
+            {
+                'name'          => 
'\"kafka.controller\":type=\"ControllerStats\",name=*',
+                "resultAlias"   => 'kafka.controller.ControllerStats',
+                'typeNames'     => ['name'],
+                'attrs'         => {
+                    'Count' => { 'slope' => 'both' },
+                },
+            },
+        ],
+        default => $query_objects,
+    }
+
     # query kafka for jmx metrics
     jmxtrans::metrics { "kafka-${::hostname}-${jmx_port}":
         jmx                  => $jmx,
@@ -38,89 +144,6 @@
         ganglia_group_name   => 'kafka',
         graphite             => $graphite,
         graphite_root_prefix => 'kafka',
-        objects              => [
-            {
-                'name'          => 
'kafka.log:type=LogFlushStats,name=LogFlushRateAndTimeMs',
-                'attrs'         => {
-                    'Count' => { 'units' => 'flushes',   'slope' => 'both' },
-                },
-            },
-            {
-                'name'          => 
'kafka.server:type=kafka.BrokerTopicMetrics,name=*',
-                'typeNames'     => ['name'],
-                'attrs'         => {
-                    'Count' => { 'slope' => 'both' },
-                },
-            },
-            {
-                  'name'        => 
'kafka.server:type=ReplicaManager,name=UnderReplicatedPartitions',
-                  'attrs'       => {
-                      'Value' => { 'units' => 'partitions', 'slope' => 'both' 
},
-                  },
-            },
-            {
-                  'name'         => 
'kafka.server:type=ReplicaManager,name=PartitionCount',
-                  'attrs'        => {
-                      'Value' => { 'units' => 'partitions', 'slope' => 'both' 
},
-                  },
-            },
-            {
-                  'name'        => 
'kafka.server:type=ReplicaManager,name=LeaderCount',
-                  'attrs'       => {
-                      'Value' => { 'units' => 'leaders', 'slope' => 'both' },
-                  },
-            },
-            {
-                  'name'        => 
'kafka.server:type=ReplicaManager,name=ISRShrinksPerSec',
-                  'attrs'       => {
-                      'Count' => { 'units' => 'shrinks', 'slope' => 'both' },
-                  },
-            },
-            {
-                  'name'        => 
'kafka.server:type=ReplicaManager,name=IsrExpandsPerSec',
-                  'attrs'       => {
-                      'Count' => { 'units' => 'expands', 'slope' => 'both' },
-                  },
-            },
-            {
-                'name'          => 
'kafka.server:type=ReplicaFetcherManager,name=Replica-MaxLag',
-                'attrs'         => {
-                    'Value' => { 'units' => 'messages',   'slope' => 'both' },
-                },
-            },
-            {
-                'name'          => 
'kafka.server:type=ProducerRequestPurgatory,name=PurgatorySize',
-                'attrs'         => {
-                    'Value' => { 'units' => 'messages', 'slope' => 'both' },
-                },
-            },
-            {
-                'name'          => 
'kafka.server:type=FetchRequestPurgatory,name=PurgatorySize',
-                'attrs'         => {
-                    'Value' => { 'units' => 'messages', 'slope' => 'both' },
-                },
-            },
-            {
-                'name'          => 'kafka.network:type=RequestMetrics,name=*',
-                'typeNames'     => ['name'],
-                'attrs'         => {
-                    'Count' => { 'slope' => 'both' },
-                },
-            },
-            {
-                'name'          => 
'kafka.controller:type=KafkaController,name=*',
-                'typeNames'     => ['name'],
-                'attrs'         => {
-                    'Value' => { 'slope' => 'both' },
-                },
-            },
-            {
-                'name'          => 
'kafka.controller:type=ControllerStats,name=*',
-                'typeNames'     => ['name'],
-                'attrs'         => {
-                    'Count' => { 'slope' => 'both' },
-                },
-            },
-        ]
+        objects              => $kafka_objects,
     }
 }
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9154271abbb5373d3edccf5b257f330209508eb6
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet/kafka
Gerrit-Branch: master
Gerrit-Owner: Ottomata <[email protected]>

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

Reply via email to