Repository navigation
fix: report pod log collection as the logs capability and explain empty logs - #1230
Conversation
|
Enclave skipped this draft pull request. It will run automatically when you mark the PR as Ready for review. |
End-to-end proof (Helm chart on kind, real Operator and CLI)Setup:
1. Collector offBefore (parent Operator and CLI): After (this branch): 2.
|
|
@greptileai review |
[Medium impact] The PR appears safe to merge; no actionable issues remain. SummaryThe PR reports Pod API log collection through the
Reviews (4) · Last reviewed commit: "fix: skip the log collector hint for --s..." · Reviewed by Greptile |
|
@greptileai review |
|
Coordinator review (holding merge): one change needed. Released Operators since podApi mode shipped already send a Suggested fix: have the new Operator send a detail when logs are unavailable (e.g. "No log collector configured") and show the hint only when |
…ty logs The Operator reported the logs capability as granted only when a node collector token was configured, so podApi installs said logs were not collected while they flowed. It now reports granted for either source. alien logs printed "(no logs)" for every empty result. When a Kubernetes deployment's Operator reports logs as unavailable, it now says the installation doesn't send logs and shows the Helm values that turn the log collector on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Operator refuses to start in podApi mode when deployment telemetry is off, so following the hint on such a release would stop it. The chart reads telemetry from stackSettings when set, otherwise from management.telemetry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Released Operators report the logs capability with no detail and mark it unavailable whenever no collector token is mounted, which includes podApi mode where logs do flow. Treating that as "collector off" made `alien logs` print the Helm hint for quiet services on most installs. The Operator now sends a detail in every logs state, including "No log collector configured" when neither collector is set up. The CLI shows the hint only for an unavailable report that carries a detail, so older Operators fall back to "(no logs)". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
03bbc4d to
552f70b
Compare
|
@greptileai review |
Source queries read gateway request diagnostics without the deployment filter, so the deployment's Pod log collector can't explain an empty result there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@greptileai review |
Follow-up to #1230. ## Problem The `logs` capability says whether the Kubernetes log collector sends Pod logs. Only the Kubernetes chart has a log collector: it mounts the collector token in nodeAgent mode (`COLLECTOR_TOKEN_FILE`) or sets `OPERATOR_POD_LOG_LABEL_KEY` in podApi mode. Operators on AWS, GCP, Azure and local get neither, so they always reported `logs` as `unavailable`. Before #1230 the report had no detail; since #1230 it says `No log collector configured`. Those deployments do send logs, just not through a collector. The manager gives pull deployments a monitoring config (`default_monitoring` in `alien-manager/src/routes/sync.rs`), workers export logs over OTLP to that endpoint (`inject_monitoring_environment_variables` in `alien-deployment/src/helpers.rs`), and on the clouds the hosted container runtime ships container logs. A client that reads `unavailable` as "this deployment sends no logs" gets the wrong answer for every cloud or local Operator. ## Before and after | Operator | Before #1230 | #1230 | This PR | | --- | --- | --- | --- | | Kubernetes, podApi | unavailable, no detail | granted, `Pod logs read through the Kubernetes API` | same as #1230 | | Kubernetes, nodeAgent | granted, no detail | granted, `Pod logs sent by the node log collector` | same as #1230 | | Kubernetes, collector off | unavailable, no detail | unavailable, `No log collector configured` | same as #1230 | | AWS / GCP / Azure / local | unavailable, no detail | unavailable, `No log collector configured` | not reported | Machines deployments have no Operator (the Operator CLI rejects `--platform machines`, and the deployment loop refuses Machines), so nothing reports `logs` for them before or after. ## Changes - `logs_capability` returns `None` off Kubernetes, and `report_operator_capabilities` leaves the capability out there. Kubernetes reports are unchanged. - `alien logs` already shows its log-collector hint only on Kubernetes deployments. Earlier cloud and local Operators still report `unavailable`, so that platform check stays; its doc comment now says so. Capabilities are sent as a whole set on each sync, so after an upgrade the old `unavailable` report goes away. ## Tests `reports_logs_only_for_the_kubernetes_log_collector` builds an `OperatorState` per platform and reads the `logs` entry from `report_operator_capabilities`: - Kubernetes: collector off, nodeAgent and podApi give the same state and detail as before. - AWS, GCP, Azure and local report no `logs` entry. On main this part fails, because they report `unavailable` with `No log collector configured`. It replaces the earlier `logs_capability` unit test, which now runs through the full capability report. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Problem
logscapability asgrantedonly when a node collector token was configured. InlogCollector.mode=podApithe Operator streams Pod logs itself and mounts no token, so it reportedunavailablewhile logs were flowing. Anything that reads the capability said logs weren't collected.alien logsprinted(no logs)for every empty result. When the log collector is off, the user got no hint about why or how to fix it.Changes
Operator (
crates/alien-operator/src/loops/sync.rs,lib.rs)OperatorStategetspod_log_collection: bool, set from the Pod log collection config the chart passes inOPERATOR_POD_LOG_LABEL_KEYandOPERATOR_POD_LOG_LABEL_VALUE(the same config that starts the Pod log loop).logs_capability()reportsgrantedwhen either a collector token (nodeAgent) or Pod log collection (podApi) is configured, andunavailablewhen neither is.detailis always set: it names the active source, or saysNo log collector configured.CLI (
crates/alien-cli/src/commands/logs.rs)alien logs --deployment ...already fetches the deployment detail, which carries the Operator'scapabilities. When the result is empty, the deployment is on Kubernetes, and the Operator reportslogsasunavailablewith a detail, the CLI prints:(no logs): the capability is missing,granted, orunavailablewithout a detail, the platform isn't Kubernetes, or the target is a manager rather than a deployment.--jsonand--followoutput are unchanged.Older Operators
Released Operators (every version that reports
logs) send it withdetail: nulland mark itunavailablewhenever no collector token is mounted. That includes podApi mode, where logs do flow, and podApi is the default for charts the manager serves. Sounavailablewith no detail can't mean "collector off", and the CLI ignores it. Operators that predate thelogscapability send nothing. Only Operators with this change send a detail, so only they get the hint.Tests
reports_logs_when_a_node_collector_or_the_pod_log_stream_is_configured: collector off → unavailable withNo log collector configured, nodeAgent (token) → granted, podApi (Pod log stream, no token) → granted.empty_result_explains_a_log_collector_the_operator_reported_off: deserializes capability reports in the API wire format and checks the message for unavailable with a detail, granted, unavailable withdetail: nullor nodetailfield (released Operators), missing capability, missing report, and a non-Kubernetes platform.End-to-end check
Run on two kind clusters against a hosted manager. The before/after output is in the PR comments.
Steps
logCollector.enabled=falseand let it register and sync.alien logs --deployment <group>/<name>. Expect the message above. The deployment's capabilities in the API should showlogs: unavailable.helm upgrade <release> <chart> --reuse-values --set logCollector.enabled=true --set-string logCollector.mode=podApi. Wait for the next sync. The capability should change tologs: grantedwith detailPod logs read through the Kubernetes API, and the Operator Pod should haveOPERATOR_POD_LOG_LABEL_KEYset.alien logs --deployment <group>/<name>again. Expect log lines, not the message.logCollector.mode=nodeAgentand confirm the capability staysgrantedwith detailPod logs sent by the node log collector.🤖 Generated with Claude Code