Skip to content

feat(worker): Expose occupancy for Prometheus scraping - #735

Open
enochtangg wants to merge 1 commit into
mainfrom
enochtang/stream-2108-enable-occupancy-autoscaling-for
Open

enochtangg wants to merge 1 commit into
mainfrom
enochtang/stream-2108-enable-occupancy-autoscaling-for

Conversation

@enochtangg

@enochtangg enochtangg commented Nov 13, 2026 •

Copy link
Copy Markdown

Lets the launchpad worker serve the taskworker_worker_occupancy metric on a Prometheus port, so KEDA can autoscale launchpad-push on worker occupancy instead of Kafka lag. getsentry taskworkers already do this.

  • Reads LAUNCHPAD_WORKER_PROMETHEUS_PORT in get_worker_config() and passes it to PushTaskWorker.
  • Pull mode ignores the port, since the client only publishes occupancy from push workers.

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

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>
@linear-code

linear-code Bot commented Nov 13, 2026

Copy link
Copy Markdown

STREAM-2108

@sentry

sentry Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Size Analysis

2 components analyzed

iOS Builds

Name Configuration Version Download Size Install Size
HackerNews (iOS)
com.emergetools.hackernews
Release 3.8 (1) 6.5 MB (0 B) 9.7 MB (0 B)

Android Builds

Name Configuration Version Download Size Uncompressed Size
Hacker News (Android)
com.emergetools.hackernews
Release 1.0.2 (13) 2.9 MB (+14 B) 6.6 MB (-4 B)

Configure launchpad-test-ios status check rules

@sentry

sentry Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

📲 Install Builds

iOS

🔗 App Name App ID Version Configuration
HackerNews com.emergetools.hackernews 3.8 (1) Release

Android

🔗 App Name App ID Version Configuration
Hacker News com.emergetools.hackernews 1.0.2 (13) Release

⚙️ launchpad-test-android Build Distribution Settings

@jamieQ jamieQ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a particular reason we're strip()'ing this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're pretty close to finishing the move off pull workers, once that's done this goes away

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants