[Refactor] Deduplicate trace header handling in BaseServing (#60828)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
This commit is contained in:
Chauncey
2026-10-10 05:27:58 +00:00
committed by GitHub
parent 7d0b4e57aa
commit fa5cfd48d5
7 changed files with 19 additions and 80 deletions
+9
View File
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from collections.abc import Mapping
from http import HTTPStatus
from fastapi import Request
@@ -23,6 +24,7 @@ from vllm.renderers.inputs.preprocess import (
extract_prompt_len,
)
from vllm.sampling_params import BeamSearchParams
from vllm.tracing import contains_trace_headers, extract_trace_headers
from vllm.utils import random_uuid
@@ -37,6 +39,13 @@ class BaseServing:
self.model_config = model_config
self.request_logger = request_logger
async def _get_trace_headers(
self, headers: Mapping[str, str]
) -> Mapping[str, str] | None:
if not contains_trace_headers(headers):
return None
return extract_trace_headers(headers)
async def _check_model(
self,
request: AnyRequest | AnyPoolingRequest,