Skip to content

Commit ce11d45

Browse files
committed
Add prometheus data collection
1 parent 2a61115 commit ce11d45

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

f5_cccl/service/manager.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020

2121
import logging
22+
import json
2223
from time import time
2324

2425
import f5_cccl.exceptions as exc
@@ -676,6 +677,17 @@ def apply_ltm_config(self, service_config, user_agent):
676677
LOGGER.debug(
677678
"apply_ltm_config took %.5f seconds.", (time() - start_time))
678679

680+
prom_data = {}
681+
for i in service_config.get('iapps', []):
682+
prom_data[i['name']] = {
683+
'timecost': int((time() - start_time)*1000),
684+
'members': []
685+
}
686+
for m in i['poolMemberTable']['members']:
687+
prom_data[i['name']]['members'].append(m['address'])
688+
689+
LOGGER.info("prometheus.data.ltm="+json.dumps(prom_data))
690+
679691
return retval
680692

681693
def apply_net_config(self, service_config):
@@ -711,4 +723,10 @@ def apply_net_config(self, service_config):
711723
LOGGER.debug(
712724
"apply_net_config took %.5f seconds.", (time() - start_time))
713725

726+
prom_data = {}
727+
for i in service_config.get('arps', []):
728+
prom_data[i['ipAddress']] = int((time() - start_time)*1000)
729+
730+
LOGGER.info("prometheus.data.net="+json.dumps(prom_data))
731+
714732
return retval

0 commit comments

Comments
 (0)