diff --git a/octavia_f5/controller/statusmanager/legacy_healthmanager/health_drivers/update_db.py b/octavia_f5/controller/statusmanager/legacy_healthmanager/health_drivers/update_db.py index 3ddc2947..9b2597a9 100644 --- a/octavia_f5/controller/statusmanager/legacy_healthmanager/health_drivers/update_db.py +++ b/octavia_f5/controller/statusmanager/legacy_healthmanager/health_drivers/update_db.py @@ -484,38 +484,12 @@ def update_stats(self, health_message, srcaddr): '%s', health_message['id'], srcaddr) def _update_stats(self, health_message, srcaddr): - """This function is to update the db with listener stats + """Update listener statistics :param health_message: The health message containing the listener stats :type map: string :returns: null - Example V1 message:: - - health = { - "id": self.FAKE_UUID_1, - "listeners": { - "listener-id-1": { - "status": constants.OPEN, - "stats": { - "ereq":0, - "conns": 0, - "totconns": 0, - "rx": 0, - "tx": 0, - }, - "pools": { - "pool-id-1": { - "status": constants.UP, - "members": {"member-id-1": constants.ONLINE} - } - } - } - } - } - - Example V2 message:: - {"id": "", "seq": 67, "listeners": { @@ -553,8 +527,11 @@ def _update_stats(self, health_message, srcaddr): 'active_connections': stats['conns'], 'total_connections': stats['totconns'], 'request_errors': stats['ereq']} - LOG.debug("Updating listener stats in db and sending event.") + stats_obj = self.listener_stats_repo.model_class( + listener_id=listener_id, + amphora_id=amphora_id, + **stats + ) LOG.debug("Listener %s / Amphora %s stats: %s", listener_id, amphora_id, stats) - self.listener_stats_repo.replace( - session, listener_id, amphora_id, **stats) + self.listener_stats_repo.replace(session, stats_obj)