[Auto Sync] Update request_metrics_exporter.py (20251230) (#16183)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Scott Lee <scottjlee@users.noreply.github.com>
This commit is contained in:
co-authored by
github-actions[bot]
Scott Lee
parent
4bc2f2e0bc
commit
00e607111a
@@ -12,6 +12,10 @@ from sglang.srt.server_args import ServerArgs
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# Fields that should always be excluded from request parameters
|
||||||
|
# because they contain non-JSON-serializable objects (e.g., ImageData, tensors)
|
||||||
|
ALWAYS_EXCLUDE_FIELDS = {"image_data", "video_data", "audio_data", "input_embeds"}
|
||||||
|
|
||||||
|
|
||||||
class RequestMetricsExporter(ABC):
|
class RequestMetricsExporter(ABC):
|
||||||
"""Abstract base class for exporting request-level performance metrics to a data destination."""
|
"""Abstract base class for exporting request-level performance metrics to a data destination."""
|
||||||
@@ -35,7 +39,11 @@ class RequestMetricsExporter(ABC):
|
|||||||
request_params = {}
|
request_params = {}
|
||||||
for field in dataclasses.fields(obj):
|
for field in dataclasses.fields(obj):
|
||||||
field_name = field.name
|
field_name = field.name
|
||||||
if field_name not in self.obj_skip_names:
|
# Skip fields in obj_skip_names or fields that are always excluded (not JSON serializable)
|
||||||
|
if (
|
||||||
|
field_name not in self.obj_skip_names
|
||||||
|
and field_name not in ALWAYS_EXCLUDE_FIELDS
|
||||||
|
):
|
||||||
value = getattr(obj, field_name)
|
value = getattr(obj, field_name)
|
||||||
# Convert to serializable format
|
# Convert to serializable format
|
||||||
if value is not None:
|
if value is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user