def build_metric_data_queries()

in CWMetricsToOpenSearch/handler.py [0:0]


def build_metric_data_queries(domain_name, region, metric_descriptions):
    ret = []
    for md in metric_descriptions:
        metric_name = md.metric_name
        for stat in ['Minimum', 'Maximum', 'Average']: # What flexibility does this need?
            label = '{} {} {} {}'.format(domain_name, region, metric_name, stat)
            _id = 'a' + str(uuid.uuid1()).lower().replace('-', '_')
            ret.append(
                    {
                        'Id': _id,
                        'Label': label,
                        'MetricStat': {
                            'Metric': {
                                'Namespace': 'AWS/ES',
                                'MetricName': metric_name,
                                'Dimensions': md.dims
                            },
                            'Period': LAMBDA_INTERVAL, # ? any need to do more granular than 1 minute?
                            'Stat': stat,
                        }
                    }
            )
    return ret