From a4f8d4a972fc28420e6236f7027ef919dd6f927b Mon Sep 17 00:00:00 2001
From: Bjoern Teipel <bjoern.teipel@rackspace.com>
Date: Tue, 18 Apr 2017 08:49:10 -0500
Subject: [PATCH] Fixing counter based graphs inside the Swift dashboard

All counter based graphs inside the the Swift dashboard are fixed
and now correctly showing the timings per second rather than total
values per telegraf flush interval.
Additionally the High Response Time graphs are now using the timing_upper
metrics.

Minor issues inside the playbook-influx-telegraf.yml and telegraf.conf.j2
are fixed to support deployments without optional componentns like ironic,
cinder etc.

Change-Id: I0ac0d2004416cae7a6d137d98ab685b7abc22d3f
---
 .../openstack-swift-proxy-metrics.json        | 132 +++++++++---------
 cluster_metrics/playbook-influx-telegraf.yml  |   8 +-
 cluster_metrics/templates/telegraf.conf.j2    |   7 +-
 3 files changed, 76 insertions(+), 71 deletions(-)

diff --git a/cluster_metrics/grafana-dashboards/openstack-swift-proxy-metrics.json b/cluster_metrics/grafana-dashboards/openstack-swift-proxy-metrics.json
index 13e36dd1..20e5ac3a 100644
--- a/cluster_metrics/grafana-dashboards/openstack-swift-proxy-metrics.json
+++ b/cluster_metrics/grafana-dashboards/openstack-swift-proxy-metrics.json
@@ -94,7 +94,7 @@
               "hide": false,
               "measurement": "swift.proxy-server.account",
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.account\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND \"returncode\" = '200' AND $timeFilter GROUP BY host, time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.account\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND \"returncode\" = '200' AND $timeFilter GROUP BY host, time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -140,7 +140,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -218,7 +218,7 @@
               ],
               "measurement": "swift.proxy-server.account",
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.account\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'HEAD' AND \"returncode\" = '204' AND $timeFilter GROUP BY host, time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.account\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'HEAD' AND \"returncode\" = '204' AND $timeFilter GROUP BY host, time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -258,7 +258,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -320,7 +320,7 @@
           "lines": true,
           "linewidth": 2,
           "links": [],
-          "nullPointMode": "null as zero",
+          "nullPointMode": "connected",
           "percentage": false,
           "pointradius": 5,
           "points": false,
@@ -349,7 +349,7 @@
               "hide": false,
               "measurement": "swift.proxy-server.container",
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.container\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND \"returncode\" = '200' AND $timeFilter GROUP BY host, time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.container\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND \"returncode\" = '200' AND $timeFilter GROUP BY host, time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -395,7 +395,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -436,6 +436,8 @@
           "legend": {
             "avg": false,
             "current": false,
+            "hideEmpty": false,
+            "hideZero": false,
             "max": false,
             "min": false,
             "show": false,
@@ -445,7 +447,7 @@
           "lines": true,
           "linewidth": 2,
           "links": [],
-          "nullPointMode": "null as zero",
+          "nullPointMode": "connected",
           "percentage": false,
           "pointradius": 5,
           "points": false,
@@ -472,7 +474,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.container\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'HEAD' AND \"returncode\" = '204' AND $timeFilter GROUP BY host, time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.container\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'HEAD' AND \"returncode\" = '204' AND $timeFilter GROUP BY host, time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -500,7 +502,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -562,7 +564,7 @@
           "lines": true,
           "linewidth": 2,
           "links": [],
-          "nullPointMode": "null as zero",
+          "nullPointMode": "connected",
           "percentage": false,
           "pointradius": 5,
           "points": false,
@@ -589,7 +591,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'PUT' AND \"returncode\" = '201' AND $timeFilter GROUP BY host, time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'PUT' AND \"returncode\" = '201' AND $timeFilter GROUP BY host, time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -617,7 +619,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -667,7 +669,7 @@
           "lines": true,
           "linewidth": 2,
           "links": [],
-          "nullPointMode": "null as zero",
+          "nullPointMode": "connected",
           "percentage": false,
           "pointradius": 5,
           "points": false,
@@ -693,8 +695,9 @@
                   "type": "fill"
                 }
               ],
+              "hide": false,
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'DELETE' AND \"returncode\" = '204' AND $timeFilter GROUP BY host,time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s)  FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'DELETE' AND \"returncode\" = '204' AND $timeFilter GROUP BY host, time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -722,8 +725,8 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
-            "value_type": "cumulative"
+            "sort": 2,
+            "value_type": "individual"
           },
           "type": "graph",
           "xaxis": {
@@ -772,7 +775,7 @@
           "lines": true,
           "linewidth": 2,
           "links": [],
-          "nullPointMode": "null as zero",
+          "nullPointMode": "connected",
           "percentage": false,
           "pointradius": 5,
           "points": false,
@@ -799,7 +802,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND \"returncode\" = '200' AND $timeFilter GROUP BY host,time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND \"returncode\" = '200' AND $timeFilter GROUP BY host, time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -827,7 +830,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -877,7 +880,7 @@
           "lines": true,
           "linewidth": 2,
           "links": [],
-          "nullPointMode": "null as zero",
+          "nullPointMode": "connected",
           "percentage": false,
           "pointradius": 5,
           "points": false,
@@ -904,7 +907,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'HEAD' AND \"returncode\" = '200' AND $timeFilter GROUP BY host,time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s)  FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'HEAD' AND \"returncode\" = '200' AND $timeFilter GROUP BY host,time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -932,7 +935,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -1022,7 +1025,7 @@
               ],
               "hide": false,
               "policy": "default",
-              "query": "SELECT mean(\"timing_lower\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND \"returncode\" = '200' AND $timeFilter GROUP BY host,time($interval) fill(null)",
+              "query": "SELECT mean(\"timing_mean\")  FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND \"returncode\" = '200' AND $timeFilter GROUP BY host,time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -1050,7 +1053,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -1127,7 +1130,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_mean\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND \"returncode\" = '200' AND $timeFilter GROUP BY host,time($interval) fill(null)",
+              "query": "SELECT mean(\"timing_lower\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND \"returncode\" = '200' AND $timeFilter GROUP BY host,time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -1151,11 +1154,11 @@
           "thresholds": [],
           "timeFrom": null,
           "timeShift": null,
-          "title": "Proxy GETs (200) - 50%ile Response Time",
+          "title": "Proxy GETs (200) - Low Response Time",
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -1256,11 +1259,11 @@
           "thresholds": [],
           "timeFrom": null,
           "timeShift": null,
-          "title": "Proxy GETs (200) - 90%ile Response Time",
+          "title": "Proxy GETs (200) - High Response Time",
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -1337,7 +1340,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_lower\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'PUT' AND \"returncode\" = '201' AND $timeFilter GROUP BY host,time($interval) fill(null)",
+              "query": "SELECT mean(\"timing_mean\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'PUT' AND \"returncode\" = '201' AND $timeFilter GROUP BY host,time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -1365,7 +1368,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -1442,7 +1445,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_mean\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'PUT' AND \"returncode\" = '201' AND $timeFilter GROUP BY host,time($interval) fill(null)",
+              "query": "SELECT mean(\"timing_lower\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'PUT' AND \"returncode\" = '201' AND $timeFilter GROUP BY host,time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -1466,11 +1469,11 @@
           "thresholds": [],
           "timeFrom": null,
           "timeShift": null,
-          "title": "Proxy PUTs (201) - 50%ile Response Time",
+          "title": "Proxy PUTs (201) - Low Response Time",
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -1571,11 +1574,11 @@
           "thresholds": [],
           "timeFrom": null,
           "timeShift": null,
-          "title": "Proxy PUTs (201) - 90%ile Response Time",
+          "title": "Proxy PUTs (201) - High Response Time",
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -1671,7 +1674,7 @@
               ],
               "hide": false,
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND (\"method\" = 'GET' OR \"method\" = 'HEAD') AND $timeFilter GROUP BY time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s)  FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND (\"method\" = 'GET' OR \"method\" = 'HEAD') AND $timeFilter GROUP BY time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -1700,7 +1703,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -1754,7 +1757,7 @@
           "lines": false,
           "linewidth": 2,
           "links": [],
-          "nullPointMode": "connected",
+          "nullPointMode": "null as zero",
           "percentage": false,
           "pointradius": 5,
           "points": false,
@@ -1783,7 +1786,7 @@
               ],
               "hide": false,
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND $timeFilter GROUP BY time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND $timeFilter GROUP BY time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -1822,7 +1825,7 @@
               ],
               "hide": false,
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'HEAD' AND $timeFilter GROUP BY time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s)  FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'HEAD' AND $timeFilter GROUP BY time($interval) fill(null)",
               "rawQuery": true,
               "refId": "B",
               "resultFormat": "time_series",
@@ -1850,8 +1853,8 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
-            "value_type": "individual"
+            "sort": 2,
+            "value_type": "cumulative"
           },
           "type": "graph",
           "xaxis": {
@@ -1907,6 +1910,7 @@
             "max": true,
             "min": false,
             "show": true,
+            "sortDesc": true,
             "total": false,
             "values": true
           },
@@ -1941,7 +1945,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND (\"method\" = 'PUT' OR \"method\" = 'DELETE') AND $timeFilter GROUP BY time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND (\"method\" = 'PUT' OR \"method\" = 'DELETE') AND $timeFilter GROUP BY time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -1969,7 +1973,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -2021,7 +2025,7 @@
           "lines": false,
           "linewidth": 2,
           "links": [],
-          "nullPointMode": "connected",
+          "nullPointMode": "null as zero",
           "percentage": false,
           "pointradius": 5,
           "points": false,
@@ -2049,7 +2053,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'PUT' AND $timeFilter GROUP BY time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'PUT' AND $timeFilter GROUP BY time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -2087,7 +2091,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'DELETE' AND $timeFilter GROUP BY time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'DELETE' AND $timeFilter GROUP BY time($interval) fill(null)",
               "rawQuery": true,
               "refId": "B",
               "resultFormat": "time_series",
@@ -2115,8 +2119,8 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
-            "value_type": "individual"
+            "sort": 2,
+            "value_type": "cumulative"
           },
           "type": "graph",
           "xaxis": {
@@ -2204,7 +2208,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'DELETE' AND \"returncode\" = '404' AND $timeFilter GROUP BY host,time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s)  FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'DELETE' AND \"returncode\" = '404' AND $timeFilter GROUP BY host,time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -2232,7 +2236,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -2282,7 +2286,7 @@
           "lines": true,
           "linewidth": 2,
           "links": [],
-          "nullPointMode": "null as zero",
+          "nullPointMode": "connected",
           "percentage": false,
           "pointradius": 5,
           "points": false,
@@ -2310,7 +2314,7 @@
               ],
               "hide": false,
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.container\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND (\"returncode\" = '404' OR \"returncode\" = '499') AND $timeFilter GROUP BY time($interval) fill(0)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s)  FROM \"swift.proxy-server.container\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'GET' AND (\"returncode\" = '404' OR \"returncode\" = '499') AND $timeFilter GROUP BY time($interval) fill(0)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -2338,7 +2342,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -2415,7 +2419,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'HEAD' AND \"returncode\" = '404' AND $timeFilter GROUP BY host,time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'HEAD' AND \"returncode\" = '404' AND $timeFilter GROUP BY host,time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -2443,7 +2447,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -2520,7 +2524,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'PUT' AND \"returncode\" = '503' AND $timeFilter GROUP BY host,time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'PUT' AND \"returncode\" = '503' AND $timeFilter GROUP BY host,time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -2548,7 +2552,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -2625,7 +2629,7 @@
                 }
               ],
               "policy": "default",
-              "query": "SELECT mean(\"timing_count\") FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'DELETE' AND \"returncode\" = '503' AND $timeFilter GROUP BY host,time($interval) fill(null)",
+              "query": "SELECT non_negative_derivative(mean(\"timing_count\"),1s) FROM \"swift.proxy-server.object\" WHERE \"metric_type\" = 'timing' AND \"method\" = 'DELETE' AND \"returncode\" = '503' AND $timeFilter GROUP BY host,time($interval) fill(null)",
               "rawQuery": true,
               "refId": "A",
               "resultFormat": "time_series",
@@ -2653,7 +2657,7 @@
           "tooltip": {
             "msResolution": false,
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "cumulative"
           },
           "type": "graph",
@@ -2728,5 +2732,5 @@
   },
   "timezone": "browser",
   "title": "OpenStack Swift Proxy Server Metrics",
-  "version": 22
-}
+  "version": 4
+}
\ No newline at end of file
diff --git a/cluster_metrics/playbook-influx-telegraf.yml b/cluster_metrics/playbook-influx-telegraf.yml
index 8393ed7f..a90ddfc4 100644
--- a/cluster_metrics/playbook-influx-telegraf.yml
+++ b/cluster_metrics/playbook-influx-telegraf.yml
@@ -85,24 +85,24 @@
         command:
           - "python /opt/telegraf/ironic_nodes.py"
         group: "{{ groups['utility_all'][0] }}"
-        when_group: "{{ (groups['ironic_api'] | length) > 0 }}"
+        when_group: "{{ (groups['ironic_api'] | default([]) | length) > 0 }}"
       vm_quota:
         plugin_name: "vm_quota.py"
         command:
           - "python /opt/telegraf/vm_quota.py"
         group: "{{ groups['utility_all'][0] }}"
-        when_group: "{{ (groups['nova_compute'] | length) > 0 }}"
+        when_group: "{{ (groups['nova_compute'] | default([]) | length) > 0 }}"
       kvm:
         plugin_name: "kvm_virsh.py"
         command:
           - "python /opt/telegraf/kvm_virsh.py"
         group: "{{ groups['nova_compute'] }}"
-        when_group: "{{ (groups['nova_compute'] | length) > 0 and (nova_virt_type | default('qemu') in ['kvm', 'qemu']) }}"
+        when_group: "{{ (groups['nova_compute'] | default([]) | length) > 0 and (nova_virt_type | default('qemu') in ['kvm', 'qemu']) }}"
       cinder_pools_usage:
         plugin_name: "cinder_pools_usage.py"
         command:
           - "python /opt/telegraf/cinder_pools_usage.py"
         group: "{{ groups['utility_all'][0] }}"
-        when_group: "{{ (groups['cinder_volumes'] | length) > 0 }}"
+        when_group: "{{ (groups['cinder_volumes'] | default([]) | length) > 0 }}"
     influx_telegraf_targets:
       - "{{ influxdb_host|default(internal_lb_vip_address) }}:{{ influxdb_port }}"
diff --git a/cluster_metrics/templates/telegraf.conf.j2 b/cluster_metrics/templates/telegraf.conf.j2
index f73a9f31..b27fc808 100644
--- a/cluster_metrics/templates/telegraf.conf.j2
+++ b/cluster_metrics/templates/telegraf.conf.j2
@@ -65,9 +65,6 @@
             "nf_conntrack_count","nf_conntrack_max"]
   dirs = ["/proc/sys/net/ipv4/netfilter","/proc/sys/net/netfilter"]
 
-{% if inventory_hostname in groups['all_containers'] %}
-[[inputs.net]]
-
 {% if inventory_hostname in groups['swift-proxy_containers'] %}
 [[inputs.statsd]]
   service_address = ":8125"
@@ -76,6 +73,10 @@
     "*.swift.proxy-server.*.*.*.* host.measurement.measurement.measurement.method.returncode.field*",
     "*.swift.proxy-server.*.policy.*.*.*.* host.measurement.measurement.measurement.measurement.measurement.method.returncode.field*",
   ]
+{% endif %}
+
+{% if inventory_hostname in groups['all_containers'] %}
+[[inputs.net]]
 
 {% elif inventory_hostname in groups['hosts'] %}
 [[inputs.cpu]]