Skip to content

Commit 01e4ec7

Browse files
author
Dylan Huang
committed
properly create timestmap in log emission
1 parent 5b2b7b4 commit 01e4ec7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

eval_protocol/log_utils/elasticsearch_direct_http_handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
from concurrent.futures import ThreadPoolExecutor
44
from typing import Optional, Any, Dict
5-
from datetime import datetime
5+
from datetime import datetime, timezone
66

77
from eval_protocol.types.remote_rollout_processor import ElasticsearchConfig
88
from .elasticsearch_client import ElasticsearchClient
@@ -36,8 +36,8 @@ def configure(self, elasticsearch_config: ElasticsearchConfig) -> None:
3636
def emit(self, record: logging.LogRecord) -> None:
3737
"""Emit a log record by scheduling it for async transmission."""
3838
try:
39-
# Create proper ISO 8601 timestamp
40-
timestamp = datetime.fromtimestamp(record.created).strftime("%Y-%m-%dT%H:%M:%S.%fZ")
39+
# Create proper ISO 8601 timestamp in UTC
40+
timestamp = datetime.fromtimestamp(record.created, tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%S.%fZ")
4141

4242
rollout_id = self._get_rollout_id(record)
4343
logger.debug(f"Emitting log record: {record.getMessage()} with rollout_id: {rollout_id}")

0 commit comments

Comments
 (0)