https://blueprints.launchpad.net/octavia/+spec/stats-support
Currently, Octavia does not support the gathering of loadbalancer statistics. This causes inconsistencies between the Octavia and Neutron-LBaaS APIs. Another point is that the statistics data we get from the Octavia API for the listener only reflects the first record for the listener in the Octavia database, since we’re supporting more topologies than SINGLE, this needs to be to fixed too.
Add one more data ‘request_errors’ to indicate the number of request errors for each listener, we can get this data from the stats of haproxy ‘ereq’.
Add a new module ‘stats’ to octavia.common with a class ‘StatsMixin’ to do the actual statistics calculation for both listener and loadbalancer. Make the mixin class as a new base class for octavia.api.v1.controllers.listener_statistics.ListenerStatisticsController, to make sure we get correct stats from Octavia API.
Add a new module ‘loadbalancer_statistics’ to octavia.api.v1.controllers with a class LoadbalancerStatisticsController to provide a new REST API for gathering statistics at the loadbalancer level.
Use evenstream to serialize the statistics messages from the octavia to neutron-lbaas via oslo_messaging, to keep consistent with neutron-lbaas API.
Update the ‘stats’ method in neutron-lbaas for octavia driver, allow the neutron-lbaas to get stats from octavia through REST API request, to keep consistent with neutron-lbaas API.
One new column for table listener_statistics will be introduced to represent request errors:
Field Type Null Key Default Extra request_errors bigint(20) NO NULL
Example List listener statistics: JSON response
{
"listener": {
"bytes_in": 0,
"bytes_out": 0,
"active_connections": 0,
"total_connections": 0,
"request_errors": 0
}
}
Lists loadbalancer statistics.
Request Type GET Endpoint URL/v1/loadbalancers/{lb_id}/stats Response Codes Success 200 Error 401, 404, 500
Example List loadbalancer statistics: JSON response
{
"loadbalancer": {
"bytes_in": 0,
"bytes_out": 0,
"active_connections": 0,
"total_connections": 0,
"request_errors": 0,
"listeners": [{
"id": "uuid"
"bytes_in": 0,
"bytes_out": 0,
"active_connections": 0,
"total_connections": 0,
"request_errors": 0,
}]
}
}
None
None
None
None
None
None
li, chen <shchenli@cn.ibm.com>
None
Function tests with tox.
Changes shall be introduced to the octavia APIs: see [1]