diff options
author | itraviv <itraviv@cisco.com> | 2016-11-27 12:07:12 +0200 |
---|---|---|
committer | itraviv <itraviv@cisco.com> | 2016-11-27 12:07:25 +0200 |
commit | bbb25c85dd3df041929debab15eb97618dc60f2d (patch) | |
tree | 2516f3e7da5a77840782a6d26d140d9c32eb35f9 /doc | |
parent | 4c8363eaa42497fe51ce927f06a46b1a60a2169e (diff) |
fixed quering quota issue, now fetching up to 10k queries from GA, asciidoc now shows more setups
Signed-off-by: itraviv <itraviv@cisco.com>
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/AnalyticsConnect.py | 16 | ||||
-rwxr-xr-x | doc/trex_analytics.asciidoc | 4 |
2 files changed, 9 insertions, 11 deletions
diff --git a/doc/AnalyticsConnect.py b/doc/AnalyticsConnect.py index 1725ee6a..e1210772 100755 --- a/doc/AnalyticsConnect.py +++ b/doc/AnalyticsConnect.py @@ -38,7 +38,7 @@ def initialize_analyticsreporting(): return analytics -def get_report(analytics,start_date='2016-11-06',end_date='2016-11-13'): +def get_report(analytics,start_date='2016-11-06',end_date='2016-11-27'): # Use the Analytics Service Object to query the Analytics Reporting API V4. return analytics.reports().batchGet( body={ @@ -50,10 +50,11 @@ def get_report(analytics,start_date='2016-11-06',end_date='2016-11-13'): {'expression': 'ga:metric2','formattingType':'CURRENCY'}, {'expression': 'ga:metric3','formattingType':'CURRENCY'}, {'expression': 'ga:totalEvents'}], - 'dimensions': [{"name":"ga:eventAction"},{"name": "ga:dimension1"},{"name": "ga:dimension2"},{"name": "ga:dimension3"},{"name": "ga:dimension4"}] + 'dimensions': [{"name":"ga:eventAction"},{"name": "ga:dimension1"},{"name": "ga:dimension2"},{"name": "ga:dimension3"},{"name": "ga:dimension4"}], + 'pageSize': 10000 } ] - } + } ).execute() @@ -103,6 +104,7 @@ def export_to_dict(response): def export_to_tuples(response): + counter = 0 setups = set() df = {} for report in response.get('reports', []): @@ -123,6 +125,7 @@ def export_to_tuples(response): data.append(value) data.append(golden_min) data.append(golden_max) + counter+=1 if dimensions[3] in setups: if dimensions[1] in df[dimensions[3]]: df[dimensions[3]][dimensions[1]].append(tuple(data)) @@ -132,16 +135,15 @@ def export_to_tuples(response): df[dimensions[3]] = {} df[dimensions[3]][dimensions[1]] = [tuple(data)] setups.add(dimensions[3]) + print 'counter is: %d' % counter return df, setups def main(): analytics = initialize_analyticsreporting() response = get_report(analytics) - print_response(response) - g_dict = export_to_dict(response) - print g_dict - pprint(g_dict) + df, setups = export_to_tuples(response) + #pprint(response) if __name__ == '__main__': diff --git a/doc/trex_analytics.asciidoc b/doc/trex_analytics.asciidoc index 195babbc..72d4876e 100755 --- a/doc/trex_analytics.asciidoc +++ b/doc/trex_analytics.asciidoc @@ -22,7 +22,6 @@ endif::backend-xhtml11[] = Analytics -///////////////////////////////////////////////////////////////////////////////// == Setup: TRex07 .Setup Details [options='header',halign='center',cols="1,5"] @@ -49,8 +48,6 @@ image:images/trex07trend_graph.png[title="trex07trend_graph",align="left",width= |=== include::build/images/trex07_trend_stats.csv[] |=== -//////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////// == Setup: TRex08 .Setup Details [options='header',halign='center',cols="1,5"] @@ -77,7 +74,6 @@ image:images/trex08trend_graph.png[title="trex08trend_graph",align="left",width= |=== include::build/images/trex08_trend_stats.csv[] |=== -////////////////////////////////////////////////////////////////////// == Setup: TRex09 .Setup Details |