From d2cd70233d1785627c751ab68a77f7d29b9caa9d Mon Sep 17 00:00:00 2001 From: Derek Xu Date: Tue, 6 Jan 2026 00:14:27 -0800 Subject: [PATCH 1/2] support arbitrary logs --- eval_protocol/adapters/fireworks_tracing.py | 3 ++- .../log_utils/fireworks_tracing_http_handler.py | 12 +++++++----- typescript/logging/fireworks-transport.ts | 8 ++++++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/eval_protocol/adapters/fireworks_tracing.py b/eval_protocol/adapters/fireworks_tracing.py index 218f9d1d..8e5c7d15 100644 --- a/eval_protocol/adapters/fireworks_tracing.py +++ b/eval_protocol/adapters/fireworks_tracing.py @@ -268,7 +268,7 @@ def __init__( def search_logs(self, tags: List[str], limit: int = 100, hours_back: int = 24) -> List[Dict[str, Any]]: """Fetch logs from Fireworks tracing gateway /logs endpoint. - Returns entries with keys: timestamp, message, severity, tags. + Returns entries with keys: timestamp, message, severity, tags, status, extras. """ if not tags: raise ValueError("At least one tag is required to fetch logs") @@ -315,6 +315,7 @@ def search_logs(self, tags: List[str], limit: int = 100, hours_back: int = 24) - "severity": e.get("severity", "INFO"), "tags": e.get("tags", []), "status": e.get("status"), + "extras": e.get("extras"), } ) return results diff --git a/eval_protocol/log_utils/fireworks_tracing_http_handler.py b/eval_protocol/log_utils/fireworks_tracing_http_handler.py index 2031d13a..da7b8286 100644 --- a/eval_protocol/log_utils/fireworks_tracing_http_handler.py +++ b/eval_protocol/log_utils/fireworks_tracing_http_handler.py @@ -125,14 +125,16 @@ def _build_payload(self, record: logging.LogRecord, rollout_id: str) -> Dict[str pass program = cast(Optional[str], getattr(record, "program", None)) or "eval_protocol" + extras_input = getattr(record, "extras", None) + extras: Dict[str, Any] = extras_input if isinstance(extras_input, dict) else {} + extras["logger_name"] = record.name + extras["level"] = record.levelname + extras["timestamp"] = timestamp + return { "program": program, "status": self._get_status_info(record), "message": message, "tags": tags, - "extras": { - "logger_name": record.name, - "level": record.levelname, - "timestamp": timestamp, - }, + "extras": extras, } diff --git a/typescript/logging/fireworks-transport.ts b/typescript/logging/fireworks-transport.ts index 450cd01f..5cda76e2 100644 --- a/typescript/logging/fireworks-transport.ts +++ b/typescript/logging/fireworks-transport.ts @@ -14,6 +14,7 @@ interface FireworksLogInfo extends TransformableInfo { status?: any; program?: string; logger_name?: string; + extras?: Record; [key: string]: any; } @@ -32,6 +33,7 @@ interface FireworksPayload { logger_name: string; level: string; timestamp: string; + [key: string]: any; }; } @@ -208,12 +210,18 @@ export class FireworksTransport extends Transport { const program = (typeof info.program === 'string' ? info.program : null) || 'eval_protocol'; + const extraInput = + info.extras && typeof info.extras === 'object' && !Array.isArray(info.extras) + ? info.extras + : {}; + return { program, status: this.getStatusInfo(info), message, tags, extras: { + ...extraInput, logger_name: info.logger_name || 'winston', level: level.toUpperCase(), timestamp, From 02b05ea8caf87ab7c9766b910395011ddabe0eb0 Mon Sep 17 00:00:00 2001 From: Derek Xu Date: Tue, 6 Jan 2026 00:21:31 -0800 Subject: [PATCH 2/2] cursor coment --- eval_protocol/log_utils/fireworks_tracing_http_handler.py | 2 +- typescript/package.json | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/eval_protocol/log_utils/fireworks_tracing_http_handler.py b/eval_protocol/log_utils/fireworks_tracing_http_handler.py index da7b8286..3ed52570 100644 --- a/eval_protocol/log_utils/fireworks_tracing_http_handler.py +++ b/eval_protocol/log_utils/fireworks_tracing_http_handler.py @@ -126,7 +126,7 @@ def _build_payload(self, record: logging.LogRecord, rollout_id: str) -> Dict[str program = cast(Optional[str], getattr(record, "program", None)) or "eval_protocol" extras_input = getattr(record, "extras", None) - extras: Dict[str, Any] = extras_input if isinstance(extras_input, dict) else {} + extras: Dict[str, Any] = dict(extras_input) if isinstance(extras_input, dict) else {} extras["logger_name"] = record.name extras["level"] = record.levelname extras["timestamp"] = timestamp diff --git a/typescript/package.json b/typescript/package.json index 90a62edb..670ff7c0 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -9,8 +9,10 @@ "types": "./dist/index.d.ts" } }, - "files": ["dist"], - "version": "0.1.10", + "files": [ + "dist" + ], + "version": "0.1.11", "peerDependencies": { "typescript": "^5", "@vercel/functions": "^1.4.0",