octavia.amphorae.drivers.health package

Submodules

octavia.amphorae.drivers.health.heartbeat_base module

class BaseStatusGetter[source]

Bases: object

This class defines methods that will gather heartbeats

This base class implements the check of received heartbeat messages. Derived classes for UDP and TCP are expected to bind to a port and implement the dorecv method.

check()[source]
class UpdateHealthDb[source]

Bases: object

update_health(health, srcaddr)[source]
update_stats(health_message)[source]

Parses the health message then passes it to the stats driver(s)

Parameters:

health_message (dict) – The health message containing the listener stats

Example V1 message:

health = {
    "id": "<amphora_id>",
    "listeners": {
        "<listener_id>": {
            "status": "OPEN",
            "stats": {
                "ereq": 0,
                "conns": 0,
                "totconns": 0,
                "rx": 0,
                "tx": 0,
            },
            "pools": {
                "<pool_id>": {
                    "status": "UP",
                    "members": {"<member_id>": "ONLINE"}
                }
            }
        }
    }
}

Example V2 message:

{"id": "<amphora_id>",
 "seq": 67,
 "listeners": {
   "<listener_id>": {
     "status": "OPEN",
     "stats": {
       "tx": 0,
       "rx": 0,
       "conns": 0,
       "totconns": 0,
       "ereq": 0
     }
   }
 },
 "pools": {
     "<pool_id>:<listener_id>": {
       "status": "UP",
       "members": {
         "<member_id>": "no check"
       }
     }
 },
 "ver": 2
 "recv_time": time.time()
}

Example V3 message:

Same as V2 message, except values are deltas rather than absolutes.

octavia.amphorae.drivers.health.heartbeat_tcp module

class TCPStatusGetter[source]

Bases: BaseStatusGetter

This class defines methods that will gather heartbeats

Heartbeats may be transmitted via TCP and this class will bind to a port, accept TCP connections and absorb the messages.

dorecv(*args, **kw)[source]

Waits for a TCP heart beat to be sent.

Returns:

Returns the unwrapped payload and addr that sent the heartbeat.

read_header(sock)[source]
read_n(sock, n)[source]
update(key, ip, port)[source]

Update the running config for the TCP socket server

Parameters:
  • key – The hmac key used to verify the TCP messages. String

  • ip – The ip address the TCP server will listen on

  • port – The port the TCP server will listen on

Returns:

None

octavia.amphorae.drivers.health.heartbeat_udp module

class UDPStatusGetter[source]

Bases: BaseStatusGetter

This class defines methods that will gather heartbeats

The heartbeats are transmitted via UDP and this class will bind to a port and absorb them

dorecv(*args, **kw)[source]

Waits for a UDP heart beat to be sent.

Returns:

Returns the unwrapped payload and addr that sent the heartbeat.

update(key, ip, port)[source]

Update the running config for the udp socket server

Parameters:
  • key – The hmac key used to verify the UDP packets. String

  • ip – The ip address the UDP server will read from

  • port – The port the UDP server will read from

Returns:

None

Module contents