Observability: /metrics + live log follow (FEAT-2, FEAT-4) - #37
Merged
Conversation
…-2, FEAT-4)
FEAT-4: a Prometheus `/metrics` endpoint on serve (spero_up, spero_frozen,
spero_target_healthy, spero_target_failures) built from the supervisor's latest
per-target state. Token-guarded like the other data endpoints.
FEAT-2: live log follow. core.inspect.stream_logs runs `kubectl logs -f` as an
async subprocess and yields lines (killed/reaped on cancel); Supervisor.stream_logs
validates eagerly (404/422 before the stream opens). A new
`GET /logs/{name}/stream` returns an SSE StreamingResponse. The Textual UI gains a
FollowScreen on `L` -- local via stream_logs, remote via the SSE endpoint -- that
appends lines into a RichLog and tears the stream down on close.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/metricsonserve:spero_up,spero_frozen,spero_target_healthy{target},spero_target_failures{target}from the supervisor's latest state (label values escaped). Token-guarded.core.inspect.stream_logsrunskubectl logs -fas an async subprocess (killed/reaped on cancel);Supervisor.stream_logsvalidates eagerly (404/422 before streaming). NewGET /logs/{name}/streamreturns an SSEStreamingResponse. Textual gains aFollowScreenonL— local viastream_logs, remote via the SSE endpoint — appending into aRichLogand tearing down on close.Tests:
/metrics(503 + rendered text),/logs/{name}/stream(SSE lines + 503),_stream_argv(k8s argv + LookupError), TUI follow screen opens. 236 passed; ruff/mypy clean. Tasks #20, #22.