[BugFix] fix grpc failure when tracing init before workers forked (#6732)

* [fix] fix grpc failure when tracing init before workers forked

* [fix] change default exporter to http

* [fix] fix test_trace
This commit is contained in:
Yonghua Li
2026-03-10 21:24:10 +08:00
committed by GitHub
parent 812657beee
commit 6520ae807c
3 changed files with 11 additions and 2 deletions
+8 -1
View File
@@ -84,7 +84,7 @@ from fastdeploy.utils import (
retrive_model_from_server,
)
tracing.process_tracing_init()
_tracing_inited = False
parser = make_arg_parser(FlexibleArgumentParser())
args = parser.parse_args()
@@ -171,8 +171,15 @@ async def lifespan(app: FastAPI):
async context manager for FastAPI lifespan
"""
global engine_args
global _tracing_inited
import logging
# Initialize tracing in worker lifecycle instead of module import time.
# This avoids creating grpc/cygrpc state before gunicorn forks workers.
if not _tracing_inited:
tracing.process_tracing_init()
_tracing_inited = True
uvicorn_access = logging.getLogger("uvicorn.access")
uvicorn_access.handlers.clear()