INNER CODE UNIT · Python
report_event_to_master
ChrispyBacon-dev/DockFlare · dockflare-agent/app/main.py:450
def report_event_to_master(event_type, container_data=None):
"""
Sends a JSON payload to the master's reporting endpoint.
"""
if not AGENT_ID or decommission_tombstone:
logging.debug("report_event_to_master called but AGENT_ID is missing; skipping.")
return
try:
payload = {
"type": event_type,
"timestamp": datetime.now(timezone.utc).isoformat()
}
if container_data:
safe_container = dict(container_data)
safe_container["labels"] = filter_reportable_labels(safe_container.get("labels", {}))
payload["container"] = safe_container
with _event_send_lock:
if PROTOCOL_VERSION == 2: