lablink_client_service.monitoring.pusher¶
lablink_client_service.monitoring.pusher
¶
Push the session-metrics summary to the allocator.
The pusher swallows network exceptions — the integrity story is the allocator noticing we stop pushing, not any single POST. A 409 means the row was sealed (e.g. destroy already ran); the caller may choose to stop the agent.
A 200 response echoes the allocator's authoritative session-start timestamp (the DB's SessionStartedAt, null when the seat is free); the pusher writes it to the on-disk session anchor. That heals a lost anchor — e.g. the container was recreated mid-session and /tmp went with it — within one push interval: the monitoring loop re-anchors from the file on its next tick. Rewriting an unchanged value is a no-op for the loop, so this never causes reset oscillation.
Attributes¶
POST_TIMEOUT_SECONDS = 5
module-attribute
¶
logger = logging.getLogger(__name__)
module-attribute
¶
Classes¶
Functions:¶
push_summary(allocator_url, hostname, client_secret, counters)
¶
POST one summary. Returns the HTTP status code or None on network error.