Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion eval_protocol/adapters/fireworks_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions eval_protocol/log_utils/fireworks_tracing_http_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = dict(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,
}
8 changes: 8 additions & 0 deletions typescript/logging/fireworks-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface FireworksLogInfo extends TransformableInfo {
status?: any;
program?: string;
logger_name?: string;
extras?: Record<string, any>;
[key: string]: any;
}

Expand All @@ -32,6 +33,7 @@ interface FireworksPayload {
logger_name: string;
level: string;
timestamp: string;
[key: string]: any;
};
}

Expand Down Expand Up @@ -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
: {};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unhandled JSON serialization error in debug logging path

The new extraInput spread at lines 213-216 allows arbitrary user-provided values into the payload. If these contain non-serializable values (BigInt, circular references, functions), the JSON.stringify(payload).length call at line 101 will throw outside the try-catch block. This only happens when EP_DEBUG is true, but unlike the Python implementation which wraps debug logging in try-except, the TypeScript version lacks this protection. The error propagates as an event rather than being silently handled as intended.

Additional Locations (1)

Fix in Cursor Fix in Web


return {
program,
status: this.getStatusInfo(info),
message,
tags,
extras: {
...extraInput,
logger_name: info.logger_name || 'winston',
level: level.toUpperCase(),
timestamp,
Expand Down
6 changes: 4 additions & 2 deletions typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading