Event streaming for faster entity collection#24288
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b39503199
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| def auth_headers(token: str | None) -> dict[str, str]: | ||
| """Bearer auth header for Argo CD API requests, or empty when no token is configured.""" | ||
| return {"Authorization": f"Bearer {token}"} if token else {} |
There was a problem hiding this comment.
Don't shadow inherited auth headers for genresources requests
When genresources_auth_token is omitted, the documented fallback is to inherit the instance's HTTP auth (for example headers, extra_headers, or the structured auth_token writer), but this helper returns {} and the new callers pass it as the per-request headers value. RequestsWrapper gives per-request options precedence over its configured default headers, so these genresources REST calls (and the stream listener, which uses the same helper) go out without the inherited Authorization/header config and fail for users relying on that fallback; only pass headers when a dedicated genresources token is set, or merge with the wrapper defaults.
Useful? React with 👍 / 👎.
Validation ReportAll 21 validations passed. Show details
|
What does this PR do?
Adds opt-in event streaming to the generic-resources collector: Applications are watched via
/api/v1/stream/applicationsfor near-real-time updates, with a periodic full scrape as a TTL-refresh and backfill safety net. Collection cadences are now per resource type (applications, clusters, repositories) and fully configurable, with a single 30-minute TTL.A new collect_openmetrics toggle lets an instance run generic-resource collection without scraping metrics. Also hardens the stream listener dedicated HTTP session, sticky stream.up gauge, non-blocking cancel(), and resilient reconnect/backoff. Streaming defaults on, gated behind collect_genresources.