Skip to content

Commit

Permalink
[status_manager] Fix listener statistics update
Browse files Browse the repository at this point in the history
Octavia offers a dedicated ListenerStatistics class now, which is also
the model_class of self.listener_stats_repo

Also: Remove docstring for v1, v1 is not used.
  • Loading branch information
BenjaminLudwigSAP committed Aug 9, 2022
1 parent be68224 commit 4569345
Showing 1 changed file with 7 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<amphora_id>",
"seq": 67,
"listeners": {
Expand Down Expand Up @@ -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)

0 comments on commit 4569345

Please sign in to comment.