-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Right now we just have a lot of assumptions of 1 translator to 1 django instance. with the heartbeat im trying to send for the health information we could add a hostname to the payload. and then we'd just have to alter the consumers to accept the hostname in the payfield and store that somewhere (redis?)
async def heartbeat(websocket, g):
"""Periodically send health status/route counts to Django."""
logger.info("Heartbeat task started for %s", settings.translator_hostname)
while True:
try:
v4_count = g.get_route_count(gobgp_pb2.Family.AFI_IP)
v6_count = g.get_route_count(gobgp_pb2.Family.AFI_IP6)
logger.info("Sending heartbeat: v4=%s, v6=%s", v4_count, v6_count)
await websocket.send(
json.dumps({
"type": "translator_heartbeat",
"message": {
"hostname": settings.translator_hostname,
"v4_count": v4_count,
"v6_count": v6_count,
},
})
)
except Exception:
logger.exception("Heartbeat failed")
await asyncio.sleep(30)async def receive_json(self, content):
if content["type"] == "translator_check_resp":
channel = content.pop("channel")
content["type"] = "wui_check_resp"
await self.channel_layer.send(channel, content)
elif content["type"] == "translator_heartbeat":
msg = content["message"]
hostname = msg["hostname"]Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested