Last active
September 2, 2015 14:25
-
-
Save korczis/964aef1451696c88e3e4 to your computer and use it in GitHub Desktop.
Handcrafted piece of artwork for finding metrics containing specific word in their expression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/tomaskorcak/.rvm/rubies/jruby-1.7.22/bin/jruby --1.9 -X+O -J-Djruby.compile.mode=OFF -J-Djruby.debug.fullTrace=true -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/tomaskorcak/.rvm/gems/jruby-1.7.22/gems/ruby-debug-ide-0.4.32/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --rubymine-protocol-extensions --port 54255 --dispatcher-port 54256 -- /Users/tomaskorcak/dev/gooddata-ruby/.scripts/services/vlada_list_metrics.rb | |
Fast Debugger (ruby-debug-ide 0.4.32, ruby-debug-base 0.10.5.rc10) listens on 127.0.0.1:54255 | |
I, [2015-09-02T16:24:14.178000 #80312] INFO -- : Connected using username "tomas.korcak@gooddata.com" to server https://secure.gooddata.com | |
I, [2015-09-02T16:24:17.830000 #80312] INFO -- : Connection successful | |
I, [2015-09-02T16:24:18.712000 #80312] INFO -- : Connected to server with webdav path https://secure-di.gooddata.com/uploads/ | |
{ | |
"metric": { | |
"content": { | |
"folders": [ | |
"/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1513" | |
], | |
"format": "#,##0.0%", | |
"tree": { | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"value": "AVG", | |
"content": [ | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/2712", | |
"position": { | |
"column": 12, | |
"line": 2 | |
}, | |
"type": "fact object" | |
} | |
], | |
"position": { | |
"column": 8, | |
"line": 2 | |
}, | |
"type": "function" | |
} | |
], | |
"position": { | |
"column": 8, | |
"line": 2 | |
}, | |
"type": "expression" | |
} | |
], | |
"position": { | |
"column": 1, | |
"line": 2 | |
}, | |
"type": "metric" | |
}, | |
"expression": "SELECT AVG([/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/2712])" | |
}, | |
"meta": { | |
"author": "/gdc/account/profile/876ec68f5630b38de65852ed5d6236ff", | |
"uri": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1593", | |
"tags": "", | |
"created": "2013-03-07 19:05:05", | |
"identifier": "acfWntEMcom0", | |
"deprecated": "0", | |
"summary": "An estimate of confidence in closing an opportunity. Based on stage.", | |
"title": "Probability", | |
"category": "metric", | |
"updated": "2015-01-16 17:16:49", | |
"contributor": "/gdc/account/profile/876ec68f5630b38de65852ed5d6236ff" | |
} | |
} | |
} | |
{ | |
"metric": { | |
"content": { | |
"folders": [ | |
"/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1512" | |
], | |
"format": "#,##0.0%", | |
"tree": { | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"value": "AVG", | |
"content": [ | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1208", | |
"position": { | |
"column": 12, | |
"line": 2 | |
}, | |
"type": "fact object" | |
} | |
], | |
"position": { | |
"column": 8, | |
"line": 2 | |
}, | |
"type": "function" | |
} | |
], | |
"position": { | |
"column": 8, | |
"line": 2 | |
}, | |
"type": "expression" | |
}, | |
{ | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1211", | |
"position": { | |
"column": 71, | |
"line": 2 | |
}, | |
"type": "fact object" | |
}, | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1624", | |
"position": { | |
"column": 123, | |
"line": 2 | |
}, | |
"type": "metric object" | |
} | |
], | |
"position": { | |
"column": 122, | |
"line": 2 | |
}, | |
"type": "=" | |
} | |
], | |
"position": { | |
"column": 65, | |
"line": 2 | |
}, | |
"type": "where" | |
} | |
], | |
"position": { | |
"column": 1, | |
"line": 2 | |
}, | |
"type": "metric" | |
}, | |
"expression": "SELECT AVG([/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1208]) where [/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1211]=[/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1624]" | |
}, | |
"meta": { | |
"author": "/gdc/account/profile/876ec68f5630b38de65852ed5d6236ff", | |
"uri": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1635", | |
"tags": "", | |
"created": "2013-03-07 19:05:05", | |
"identifier": "apjWnFTTgjIi", | |
"deprecated": "0", | |
"summary": "", | |
"title": "Probability [BOP]", | |
"category": "metric", | |
"updated": "2015-01-16 17:16:49", | |
"contributor": "/gdc/account/profile/876ec68f5630b38de65852ed5d6236ff" | |
} | |
} | |
} | |
{ | |
"metric": { | |
"content": { | |
"folders": [ | |
"/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1494" | |
], | |
"format": "#,##0.00", | |
"tree": { | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"value": "AVG", | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1278", | |
"position": { | |
"column": 21, | |
"line": 2 | |
}, | |
"type": "fact object" | |
}, | |
{ | |
"value": 1, | |
"position": { | |
"column": 73, | |
"line": 2 | |
}, | |
"type": "number" | |
} | |
], | |
"position": { | |
"column": 72, | |
"line": 2 | |
}, | |
"type": "/" | |
} | |
], | |
"position": { | |
"column": 20, | |
"line": 2 | |
}, | |
"type": "()" | |
} | |
], | |
"position": { | |
"column": 20, | |
"line": 2 | |
}, | |
"type": "expression" | |
}, | |
{ | |
"content": [ | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/978", | |
"position": { | |
"column": 79, | |
"line": 2 | |
}, | |
"type": "attribute object" | |
} | |
], | |
"position": { | |
"column": 76, | |
"line": 2 | |
}, | |
"type": "by" | |
} | |
], | |
"position": { | |
"column": 13, | |
"line": 2 | |
}, | |
"type": "metric" | |
} | |
], | |
"position": { | |
"column": 8, | |
"line": 2 | |
}, | |
"type": "function" | |
} | |
], | |
"position": { | |
"column": 8, | |
"line": 2 | |
}, | |
"type": "expression" | |
}, | |
{ | |
"content": [ | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/978", | |
"position": { | |
"column": 135, | |
"line": 2 | |
}, | |
"type": "attribute object" | |
} | |
], | |
"position": { | |
"column": 132, | |
"line": 2 | |
}, | |
"type": "by" | |
}, | |
{ | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1160", | |
"position": { | |
"column": 191, | |
"line": 2 | |
}, | |
"type": "attribute object" | |
}, | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1160/elements?id=2", | |
"position": { | |
"column": 243, | |
"line": 2 | |
}, | |
"type": "attributeElement object" | |
} | |
], | |
"position": { | |
"column": 242, | |
"line": 2 | |
}, | |
"type": "=" | |
} | |
], | |
"position": { | |
"column": 185, | |
"line": 2 | |
}, | |
"type": "where" | |
} | |
], | |
"position": { | |
"column": 1, | |
"line": 2 | |
}, | |
"type": "metric" | |
}, | |
"expression": "SELECT AVG((SELECT ([/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1278]/1) BY [/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/978])) BY [/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/978]where [/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1160]=[/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1160/elements?id=2]" | |
}, | |
"meta": { | |
"author": "/gdc/account/profile/876ec68f5630b38de65852ed5d6236ff", | |
"uri": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1698", | |
"tags": "", | |
"created": "2013-03-07 19:05:06", | |
"identifier": "ae8zDprJiBLY", | |
"deprecated": "0", | |
"summary": "The number of days an opportunity remains in a stage", | |
"title": "Stage Duration", | |
"category": "metric", | |
"updated": "2015-01-16 17:16:49", | |
"contributor": "/gdc/account/profile/876ec68f5630b38de65852ed5d6236ff" | |
} | |
} | |
} | |
{ | |
"metric": { | |
"content": { | |
"folders": [ | |
"/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1494" | |
], | |
"format": "#,##0.00", | |
"tree": { | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"value": "AVG", | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1277", | |
"position": { | |
"column": 21, | |
"line": 2 | |
}, | |
"type": "fact object" | |
}, | |
{ | |
"value": 1, | |
"position": { | |
"column": 73, | |
"line": 2 | |
}, | |
"type": "number" | |
} | |
], | |
"position": { | |
"column": 72, | |
"line": 2 | |
}, | |
"type": "/" | |
} | |
], | |
"position": { | |
"column": 20, | |
"line": 2 | |
}, | |
"type": "()" | |
} | |
], | |
"position": { | |
"column": 20, | |
"line": 2 | |
}, | |
"type": "expression" | |
}, | |
{ | |
"content": [ | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/978", | |
"position": { | |
"column": 79, | |
"line": 2 | |
}, | |
"type": "attribute object" | |
} | |
], | |
"position": { | |
"column": 76, | |
"line": 2 | |
}, | |
"type": "by" | |
} | |
], | |
"position": { | |
"column": 13, | |
"line": 2 | |
}, | |
"type": "metric" | |
} | |
], | |
"position": { | |
"column": 8, | |
"line": 2 | |
}, | |
"type": "function" | |
} | |
], | |
"position": { | |
"column": 8, | |
"line": 2 | |
}, | |
"type": "expression" | |
}, | |
{ | |
"content": [ | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/978", | |
"position": { | |
"column": 135, | |
"line": 2 | |
}, | |
"type": "attribute object" | |
} | |
], | |
"position": { | |
"column": 132, | |
"line": 2 | |
}, | |
"type": "by" | |
}, | |
{ | |
"content": [ | |
{ | |
"content": [ | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1160", | |
"position": { | |
"column": 192, | |
"line": 2 | |
}, | |
"type": "attribute object" | |
}, | |
{ | |
"value": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1160/elements?id=2", | |
"position": { | |
"column": 244, | |
"line": 2 | |
}, | |
"type": "attributeElement object" | |
} | |
], | |
"position": { | |
"column": 243, | |
"line": 2 | |
}, | |
"type": "=" | |
} | |
], | |
"position": { | |
"column": 186, | |
"line": 2 | |
}, | |
"type": "where" | |
} | |
], | |
"position": { | |
"column": 1, | |
"line": 2 | |
}, | |
"type": "metric" | |
}, | |
"expression": "SELECT AVG((SELECT ([/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1277]/1) BY [/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/978])) BY [/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/978] where [/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1160]=[/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1160/elements?id=2]" | |
}, | |
"meta": { | |
"author": "/gdc/account/profile/876ec68f5630b38de65852ed5d6236ff", | |
"uri": "/gdc/md/la84vcyhrq8jwbu4wpipw66q2sqeb923/obj/1700", | |
"tags": "", | |
"created": "2013-03-07 19:05:06", | |
"identifier": "amlzCOoUe2Q0", | |
"deprecated": "0", | |
"summary": "The number of days an opportunity takes to reach a stage", | |
"title": "Stage Velocity", | |
"category": "metric", | |
"updated": "2015-01-16 17:16:49", | |
"contributor": "/gdc/account/profile/876ec68f5630b38de65852ed5d6236ff" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
require 'gooddata' | |
require 'pmap' | |
require 'pp' | |
require 'json' | |
client = GoodData.connect | |
client.projects.each do |project| | |
project.metrics.each do |metric| | |
if metric.expression =~ /AVG/ | |
puts JSON.pretty_generate(metric.json) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment