1 ## What does this API do ?
2 This api as of now provides a function which takes in a lits of 'LABELS' of prometheus
3 and returns the corresponding result_sets in a list.
9 LABELS = ['irate(collectd_cpufreq{exported_instance="otconap7",cpufreq="1"}[2m])']
15 [{'metric': {'cpufreq': '1',
16 'endpoint': 'collectd-prometheus',
17 'exported_instance': 'otconap7',
18 'instance': '172.25.103.1:9103',
21 'pod': 'plundering-liger-collectd-wz7xg',
22 'service': 'collectd'},
23 'value': [1559177169.415, '119727200']}]
26 ## How to use this API ?
29 1. Copy the directory 'promql_api' to your working directory.
33 2. Import the API function: query_m3db
34 from promql_api.prom_ql_api import query_m3db
38 3. have a global or local variable as 'LABELS'
39 LABELS = ['irate(collectd_cpufreq{exported_instance="otconap7",cpufreq="1"}[2m])']
43 4. Store the result set in a list:
44 list_of_result_sets = query_m3db(LABELS)
47 ## How to troubleshoot ?
49 * Check the sample file - sample_promql_query.py in the repo.
50 * Make sure the file __init__.py is present in promql_api directory after you copy the directory.