feat(trace): support SGLANG_TRACE_LEVEL env var for startup trace level#24716
Merged
ishandhanani merged 1 commit intoMay 11, 2026
Merged
Conversation
global_trace_level defaults to 3, which includes high-volume scheduler spans (decode_loop, chunked_prefill) emitted every iteration. Allow operators to set a lower level at startup via SGLANG_TRACE_LEVEL without requiring a server restart or HTTP call after launch. The runtime /set_trace_level endpoint remains available for dynamic adjustment after startup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
sufeng-buaa
approved these changes
May 9, 2026
Collaborator
|
/tag-and-rerun-ci |
Collaborator
|
ci 'stage-a-test-cpu' is ok |
LucQueen
pushed a commit
to LucQueen/sglang
that referenced
this pull request
May 12, 2026
…el (sgl-project#24716) Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
xjpang
pushed a commit
to xjpang/sglang
that referenced
this pull request
May 13, 2026
…el (sgl-project#24716) Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
5 tasks
zijiexia
added a commit
to zijiexia/sglang
that referenced
this pull request
Jun 4, 2026
…evel Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Motivation
global_trace_leveldefaults to 3, which includes high-volume scheduler spans (decode_loop,chunked_prefill) emitted every iteration. There is currently no way to set a lower level at startup — operators must either call the/set_trace_levelHTTP endpoint after launch or accept the default verbosity.Modifications
python/sglang/srt/observability/trace.py: initializeglobal_trace_levelfromSGLANG_TRACE_LEVELenv var (default3) using the existingget_int_env_varhelpertest/registered/unit/observability/test_trace.py: add unit test verifying the env var is read at module initdocs/references/production_request_trace.md: document the startup env var option alongside the existing runtime HTTP endpointAccuracy Tests
No model output changes — this only affects which spans are emitted.
Speed Tests and Profiling
Lower trace levels reduce span generation overhead. No benchmark required for this change.
Checklist
🤖 Generated with Claude Code