def read_custom_metric(client, project_id, now_rfc3339, color, size):
 labels = ['{}/color=={}'.format(CUSTOM_METRIC_DOMAIN, color), '{}/size=={}'.format(CUSTOM_METRIC_DOMAIN, size)]
 request = client.timeseries().list(project=project_id, metric=CUSTOM_METRIC_NAME, youngest=now_rfc3339, labels=labels)
 start = time.time()
 while True:
  try:
   response = request.execute()
   for point in response['timeseries'][0]['points']:
    print '{}: {}'.format(point['end'], point['int64Value'])
   break
  except Exception as e:
   if (time.time() < (start + 20)):
    print 'Failed to read custom metric data, retrying...'
    time.sleep(3)
   else:
    print 'Failed to read custom metric data, aborting: exception={}'.format(e)
    raise

def read_custom_metric ( client , project_id , now_rfc3339 , color , size ) : labels = [ '{}/color=={}' . format ( CUSTOM_METRIC_DOMAIN , color ) , '{}/size=={}' . format ( CUSTOM_METRIC_DOMAIN , size ) ] request = client . timeseries ( ) . list ( project = project_id , metric = CUSTOM_METRIC_NAME , youngest = now_rfc3339 , labels = labels ) start = time . time ( ) while True : try : response = request . execute ( ) for point in response [ 'timeseries' ] [ 0 ] [ 'points' ] : print '{}: {}' . format ( point [ 'end' ] , point [ 'int64Value' ] ) break except Exception as e : if ( time . time ( ) < ( start + 20 ) ) : print 'Failed to read custom metric data, retrying...' time . sleep ( 3 ) else : print 'Failed to read custom metric data, aborting: exception={}' . format ( e ) raise
read all the timeseries data points for a given set of label values .