def write_custom_metric(client, project_id, now_rfc3339, color, size, count):
 timeseries_descriptor = {'project': project_id, 'metric': CUSTOM_METRIC_NAME, 'labels': {'{}/color'.format(CUSTOM_METRIC_DOMAIN): color, '{}/size'.format(CUSTOM_METRIC_DOMAIN): size}}
 timeseries_data = {'timeseriesDesc': timeseries_descriptor, 'point': {'start': now_rfc3339, 'end': now_rfc3339, 'int64Value': count}}
 request = client.timeseries().write(project=project_id, body={'timeseries': [timeseries_data]})
 try:
  request.execute()
 except Exception as e:
  print 'Failed to write data to custom metric: exception={}'.format(e)
  raise

def write_custom_metric ( client , project_id , now_rfc3339 , color , size , count ) : timeseries_descriptor = { 'project' : project_id , 'metric' : CUSTOM_METRIC_NAME , 'labels' : { '{}/color' . format ( CUSTOM_METRIC_DOMAIN ) : color , '{}/size' . format ( CUSTOM_METRIC_DOMAIN ) : size } } timeseries_data = { 'timeseriesDesc' : timeseries_descriptor , 'point' : { 'start' : now_rfc3339 , 'end' : now_rfc3339 , 'int64Value' : count } } request = client . timeseries ( ) . write ( project = project_id , body = { 'timeseries' : [ timeseries_data ] } ) try : request . execute ( ) except Exception as e : print 'Failed to write data to custom metric: exception={}' . format ( e ) raise
write a data point to a single time series of the custom metric .