Skip to content

Runtime feature toggles via admin server#1620

Open
libotony wants to merge 5 commits into
masterfrom
tony/improve-admin-server
Open

Runtime feature toggles via admin server#1620
libotony wants to merge 5 commits into
masterfrom
tony/improve-admin-server

Conversation

@libotony
Copy link
Copy Markdown
Member

Description

Adds a runtime feature-gate framework on the admin server, with three operational toggles (apilogs, txpool-api, pprof) flippable without restart.

Motivation: a recent incident required enabling pprof on a live prd node to investigate a sustained allocation spike — currently impossible without restart.

What's new

  • GET/POST /admin/features/{name} — unified toggle with optional ttlSeconds (≤3600) auto-disable.
  • apilogs, txpool-api, pprof registered; /admin/apilogs kept as deprecated alias.
  • pprof handlers (/debug/pprof/*) move from the business API server to the admin server, default off.
  • New metrics: admin_toggle_count{feature,to} and txpool_all_tx_count.

Breaking changes

  • /node/txpool* returns 503 instead of 404 when disabled.
  • --pprof alone no longer exposes pprof; needs --enable-admin. Startup warns otherwise.
  • APIConfig.PprofOn removed; api/admin/apilogs Go package removed (HTTP alias preserved).

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • New and existing E2E tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have not added any vulnerable dependencies to my code

@libotony libotony requested a review from a team as a code owner May 25, 2026 09:09
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.37688% with 49 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/thor/main.go 0.00% 26 Missing ⚠️
api/admin/featuregate/featuregate.go 84.00% 11 Missing and 9 partials ⚠️
cmd/thor/utils.go 0.00% 2 Missing ⚠️
cmd/thor/httpserver/admin_server.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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