Repository navigation
feat(worker): Expose occupancy for Prometheus scraping - #735
Open
enochtangg wants to merge 1 commit into
Open
enochtangg wants to merge 1 commit into
enochtangg wants to merge 1 commit into
Conversation
Read LAUNCHPAD_WORKER_PROMETHEUS_PORT and pass it to PushTaskWorker so the worker serves taskworker_worker_occupancy for KEDA autoscaling. Unset by default, so nothing changes until ops sets it. Pull mode ignores the port, since the client only publishes occupancy from push workers. Refs STREAM-2108 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Size Analysis2 components analyzed iOS Builds
Android Builds
|
Contributor
📲 Install BuildsiOS
Android
|
jamieQ
approved these changes
Nov 13, 2026
jamieQ
left a comment
Member
There was a problem hiding this comment.
Couple minor comments, but generally lgtm. Thanks!
| f"LAUNCHPAD_WORKER_PUSH_TIMEOUT_SEC must be a valid integer, got: {os.getenv('LAUNCHPAD_WORKER_PUSH_TIMEOUT_SEC', '5')}" | ||
| ) | ||
|
|
||
| prometheus_port_str = os.getenv("LAUNCHPAD_WORKER_PROMETHEUS_PORT", "").strip() |
Member
There was a problem hiding this comment.
is there a particular reason we're strip()'ing this?
Author
There was a problem hiding this comment.
No significant reason other than ops would render this as a quoted number
| assert config.rpc_hosts, "LAUNCHPAD_WORKER_RPC_HOST environment variable is required when push mode is disabled" | ||
| if config.prometheus_port is not None: | ||
| # taskbroker-client only publishes occupancy from PushTaskWorker. | ||
| logger.warning(f"prometheus_port={config.prometheus_port} is ignored in pull mode") |
Member
There was a problem hiding this comment.
Maybe not a big issue, but idk how visible this misconfiguration would be in practice if it's just a warning. Also sort of a meta-question, but should this be an invariant enforced by the library or something rather than here?
Author
There was a problem hiding this comment.
We're pretty close to finishing the move off pull workers, once that's done this goes away
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.
Lets the launchpad worker serve the
taskworker_worker_occupancymetric on a Prometheus port, so KEDA can autoscale launchpad-push on worker occupancy instead of Kafka lag. getsentry taskworkers already do this.LAUNCHPAD_WORKER_PROMETHEUS_PORTinget_worker_config()and passes it toPushTaskWorker.This PR is a no-op until we enable it in config. The port is unset by default, so the worker runs exactly as it does today until the ops change sets the env var.
Refs STREAM-2108