def create_custom_metric(client, project_id, custom_metric_type, metric_kind):
 metrics_descriptor = {'type': custom_metric_type, 'labels': [{'key': 'environment', 'valueType': 'STRING', 'description': 'An arbitrary measurement'}], 'metricKind': metric_kind, 'valueType': 'INT64', 'unit': 'items', 'description': 'An arbitrary measurement.', 'displayName': 'Custom Metric'}
 client.projects().metricDescriptors().create(name=project_id, body=metrics_descriptor).execute()

def create_custom_metric ( client , project_id , custom_metric_type , metric_kind ) : metrics_descriptor = { 'type' : custom_metric_type , 'labels' : [ { 'key' : 'environment' , 'valueType' : 'STRING' , 'description' : 'An arbitrary measurement' } ] , 'metricKind' : metric_kind , 'valueType' : 'INT64' , 'unit' : 'items' , 'description' : 'An arbitrary measurement.' , 'displayName' : 'Custom Metric' } client . projects ( ) . metricDescriptors ( ) . create ( name = project_id , body = metrics_descriptor ) . execute ( )
create custom metric descriptor .