Skip to content

Commit d2cd702

Browse files
committed
support arbitrary logs
1 parent f6c3454 commit d2cd702

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

eval_protocol/adapters/fireworks_tracing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def __init__(
268268
def search_logs(self, tags: List[str], limit: int = 100, hours_back: int = 24) -> List[Dict[str, Any]]:
269269
"""Fetch logs from Fireworks tracing gateway /logs endpoint.
270270
271-
Returns entries with keys: timestamp, message, severity, tags.
271+
Returns entries with keys: timestamp, message, severity, tags, status, extras.
272272
"""
273273
if not tags:
274274
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) -
315315
"severity": e.get("severity", "INFO"),
316316
"tags": e.get("tags", []),
317317
"status": e.get("status"),
318+
"extras": e.get("extras"),
318319
}
319320
)
320321
return results

eval_protocol/log_utils/fireworks_tracing_http_handler.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,16 @@ def _build_payload(self, record: logging.LogRecord, rollout_id: str) -> Dict[str
125125
pass
126126
program = cast(Optional[str], getattr(record, "program", None)) or "eval_protocol"
127127

128+
extras_input = getattr(record, "extras", None)
129+
extras: Dict[str, Any] = extras_input if isinstance(extras_input, dict) else {}
130+
extras["logger_name"] = record.name
131+
extras["level"] = record.levelname
132+
extras["timestamp"] = timestamp
133+
128134
return {
129135
"program": program,
130136
"status": self._get_status_info(record),
131137
"message": message,
132138
"tags": tags,
133-
"extras": {
134-
"logger_name": record.name,
135-
"level": record.levelname,
136-
"timestamp": timestamp,
137-
},
139+
"extras": extras,
138140
}

typescript/logging/fireworks-transport.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface FireworksLogInfo extends TransformableInfo {
1414
status?: any;
1515
program?: string;
1616
logger_name?: string;
17+
extras?: Record<string, any>;
1718
[key: string]: any;
1819
}
1920

@@ -32,6 +33,7 @@ interface FireworksPayload {
3233
logger_name: string;
3334
level: string;
3435
timestamp: string;
36+
[key: string]: any;
3537
};
3638
}
3739

@@ -208,12 +210,18 @@ export class FireworksTransport extends Transport {
208210

209211
const program = (typeof info.program === 'string' ? info.program : null) || 'eval_protocol';
210212

213+
const extraInput =
214+
info.extras && typeof info.extras === 'object' && !Array.isArray(info.extras)
215+
? info.extras
216+
: {};
217+
211218
return {
212219
program,
213220
status: this.getStatusInfo(info),
214221
message,
215222
tags,
216223
extras: {
224+
...extraInput,
217225
logger_name: info.logger_name || 'winston',
218226
level: level.toUpperCase(),
219227
timestamp,

0 commit comments

Comments
 (0)