← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ilasc/turnip:gauge-name-to-operation into turnip:master

 

Ioana Lasc has proposed merging ~ilasc/turnip:gauge-name-to-operation into turnip:master.

Commit message:
Set the gauge name to operation

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ilasc/turnip/+git/turnip/+merge/392382

1st approach in this MP
This will give us:
   turnip_qastaging_git_receive_pack
   turnip_qastaging_git_upload_pack
   turnip_prod_git_receive_pack
   turnip_prod_git_upload_pack

this gives the option to filter / group by repository, metric, host/unit.

2nd approach:

We could alternatively implement:
   gauge_name = ("git_operation,operation={},repo={},metric=system_time"..
which would give us one generic expression:
   turnip_qastaging_git
with the ability to filter by operation, repo, metric, host/unit. 

-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilasc/turnip:gauge-name-to-operation into turnip:master.
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..5754214
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,13 @@
+{
+    "python.pythonPath": "env/bin/python",
+    "python.testing.unittestArgs": [
+        "-v",
+        "-s",
+        ".",
+        "-p",
+        "test*.py"
+    ],
+    "python.testing.pytestEnabled": false,
+    "python.testing.nosetestsEnabled": false,
+    "python.testing.unittestEnabled": true
+}
\ No newline at end of file
diff --git a/turnip/pack/git.py b/turnip/pack/git.py
index f35732a..bdedac4 100644
--- a/turnip/pack/git.py
+++ b/turnip/pack/git.py
@@ -327,24 +327,24 @@ class GitProcessProtocol(protocol.ProcessProtocol, object):
                 # can't be used in statsd
                 repository = re.sub('[^0-9a-zA-Z]+', '-',
                                     self.peer.raw_pathname)
-                gauge_name = ("repo={},operation={},metric=max_rss"
+                gauge_name = ("operation={},repo={},metric=max_rss"
                               .format(
-                                  repository,
-                                  self.peer.command))
+                                  self.peer.command,
+                                  repository))
 
                 self.statsd_client.gauge(gauge_name, resource_usage['max_rss'])
 
-                gauge_name = ("repo={},operation={},metric=system_time"
+                gauge_name = ("operation={},repo={},metric=system_time"
                               .format(
-                                  repository,
-                                  self.peer.command))
+                                  self.peer.command,
+                                  repository))
                 self.statsd_client.gauge(gauge_name,
                                          resource_usage['system_time'])
 
-                gauge_name = ("repo={},operation={},metric=user_time"
+                gauge_name = ("operation={},repo={},metric=user_time"
                               .format(
-                                  repository,
-                                  self.peer.command))
+                                  self.peer.command,
+                                  repository))
                 self.statsd_client.gauge(gauge_name,
                                          resource_usage['user_time'])
 
diff --git a/turnip/pack/tests/test_functional.py b/turnip/pack/tests/test_functional.py
index 1e9b2d1..a9cc9f9 100644
--- a/turnip/pack/tests/test_functional.py
+++ b/turnip/pack/tests/test_functional.py
@@ -189,8 +189,8 @@ class FunctionalTestMixin(WithScenarios):
         metrics = ['max_rss', 'system_time', 'user_time']
         repository = re.sub('[^0-9a-zA-Z]+', '-', repo)
         self.assertThat(self.statsd_client.vals, MatchesDict({
-            u'repo={},operation={},metric={}'.format(
-                repository, command, metric): Not(Is(None))
+            u'operation={},repo={},metric={}'.format(
+                command, repository, metric): Not(Is(None))
             for metric in metrics}))
 
     @defer.inlineCallbacks