[Refactor] Deduplicate trace header handling in BaseServing (#60828)
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user