verl icon indicating copy to clipboard operation
verl copied to clipboard

Fix SGLang HTTP Server Startup Issues for Prometheus Integration

Open jsfanfanfan opened this issue 1 year ago • 0 comments

What does this PR do?

Resolve the issue that Prometheus and Grafana cannot monitor relevant metrics during rollout using SGLang.

Problems

When using SGLang as the rollout engine, the HTTP server fails to start properly. As a result, Prometheus cannot scrape metrics and Grafana is unable to display them.

Details

Set the warmup_thread_args property: Configure app.warmup_thread_args before starting the server to satisfy SGLang’s lifespan requirements.

Skip server warmup: Enable skip_server_warmup=True to avoid connection issues caused by the warmup thread. Since the model is already loaded in _launch_subprocesses, no additional warmup is required.

Add Prometheus middleware early: Manually call add_prometheus_middleware before invoking run_unvicorn to ensure that the /metrics endpoint is available immediately when the server starts.

Checklist Before Starting

  • [ ] Search for similar PRs. Paste at least one query link here: https://github.com/volcengine/verl/pull/4088
  • [ ] Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data
    • If this PR involves multiple modules, separate them with , like [megatron, fsdp, doc]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][fsdp, megatron] feat: dynamic batching

Test

For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc. 截屏2025-12-04 下午3 00 59 截屏2025-12-04 下午3 01 05

API and Usage Example

Demonstrate how the API changes if any, and provide usage example(s) if possible.

# Add code snippet or script demonstrating how to use this

Design & Code Changes

Demonstrate the high-level design if this PR is complex, and list the specific changes.

Checklist Before Submitting

[!IMPORTANT] Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.

jsfanfanfan avatar Dec 04 '25 07:12 jsfanfanfan