Thiemo Mättig (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396065 )

Change subject: Record metrics for Wikidata task priorities (via color)
......................................................................

Record metrics for Wikidata task priorities (via color)

I tested this code snippet separately.

Change-Id: Iffd15f063f9a35cfeab36c6b1dd6805c3873443a
---
M .gitignore
M src/wikidata/phabricatorTasks.php
2 files changed, 18 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/wmde/scripts 
refs/changes/65/396065/1

diff --git a/.gitignore b/.gitignore
index 6f360e0..ac72672 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
+.idea/
 config
-*.txt
\ No newline at end of file
+*.txt
diff --git a/src/wikidata/phabricatorTasks.php 
b/src/wikidata/phabricatorTasks.php
index fd5e6fe..1a20cef 100755
--- a/src/wikidata/phabricatorTasks.php
+++ b/src/wikidata/phabricatorTasks.php
@@ -49,6 +49,22 @@
                        $metricName = 
'daily.wikidata.phabricator.board.columns.' . $name;
                        WikimediaGraphite::sendNow( $metricName, $value );
                }
+
+               $this->countPriorities( $page );
+       }
+
+       /**
+        * @param string $page HTML
+        */
+       private function countPriorities( $page ) {
+               preg_match_all( '/bar-color-([a-z]+)\b/', $page, $matches );
+               $counts = array_count_values( $matches[1] );
+               asort( $counts );
+
+               foreach ( $counts as $color => $count ) {
+                       $metricName = 
'daily.wikidata.phabricator.board.priorities.' . $color;
+                       WikimediaGraphite::sendNow( $metricName, $count );
+               }
        }
 
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iffd15f063f9a35cfeab36c6b1dd6805c3873443a
Gerrit-PatchSet: 1
Gerrit-Project: analytics/wmde/scripts
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.kr...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to