Ottomata has submitted this change and it was merged.

Change subject: Adding support for typeNames setting on output writers.
......................................................................


Adding support for typeNames setting on output writers.

Change-Id: Id2137ec3701aa8a235273f44e25d02731cd6bc9a
---
M README.md
M manifests/metrics.pp
M templates/jmxtrans.json.erb
3 files changed, 14 insertions(+), 2 deletions(-)

Approvals:
  Ottomata: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README.md b/README.md
index acf0bef..b8b5958 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,7 @@
     {
         'name'        => 'JMX.object.name',
         'resultAlias' => 'pretty alias for JMX name', # optional
+        'typeNames'   => ['name'], # optional
         # attrs is a hash of JMX attributes under this JMX object
         # with settings specific to this attribute.
         # Most settings will only be relevant to specific output writers.
diff --git a/manifests/metrics.pp b/manifests/metrics.pp
index 9c57019..2477a63 100644
--- a/manifests/metrics.pp
+++ b/manifests/metrics.pp
@@ -13,6 +13,7 @@
 #       {
 #           "name"        => "JMX object name",
 #           "resultAlias" => "pretty alias for JMX name",
+#           "typeNames"   => ["name"], # this is optional
 #           "attrs"       => {
 #               "attribute name" => {
 #                   "units" => "unit name",
diff --git a/templates/jmxtrans.json.erb b/templates/jmxtrans.json.erb
index 9265899..08e3b63 100644
--- a/templates/jmxtrans.json.erb
+++ b/templates/jmxtrans.json.erb
@@ -32,7 +32,11 @@
 <%     if @outfile -%>
             { "@class": "com.googlecode.jmxtrans.model.output.KeyOutWriter"
             , "settings":
-              { "outputFile": "<%= @outfile %>" }
+              { "outputFile": "<%= @outfile %>"
+<%       if object.has_key? 'typeNames' -%>
+              , "typeNames": <%= object['typeNames'].inspect %>
+<%       end -%>
+              }
             }
 <%     end -%>
 <%     if @ganglia -%>
@@ -41,10 +45,13 @@
             , "settings":
               { "host": "<%= ganglia_host %>"
               , "port": <%= ganglia_port %>
+<%       if object.has_key? 'typeNames' -%>
+              , "typeNames": <%= object['typeNames'].inspect %>
+<%       end -%>
 <%       object['attrs'][attr_name].keys.select { |key| 
valid_ganglia_settings.include? key }.sort.each do |key| -%>
 <%         value = object['attrs'][attr_name][key] -%>
 <%         value.upcase! if key == 'slope'         -%>
-           <% # render each key: value pair.  If value is an integer, then 
render it without enclosing quotes. -%>
+<%  # render each key: value pair.  If value is an integer, then render it 
without enclosing quotes. -%>
               , "<%= key %>": <%= (value.to_i.to_s == value) ? value : 
"\"#{value}\"" %>
 <%       end # each key -%>
 <%       if @ganglia_group_name -%>
@@ -59,6 +66,9 @@
             , "settings":
               { "host": "<%= graphite_host %>"
               , "port": <%= graphite_port %>"
+<%       if object.has_key? 'typeNames' -%>
+              , "typeNames": <%= object['typeNames'].inspect %>
+<%       end -%>
 <%       if @graphite_root_prefix -%>
               , "rootPrefix": "<%= @graphite_root_prefix %>"
 <%       end -%>

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id2137ec3701aa8a235273f44e25d02731cd6bc9a
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet/jmxtrans
Gerrit-Branch: master
Gerrit-Owner: Ottomata <[email protected]>
Gerrit-Reviewer: Ottomata <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to