Skip to content

Commit 63a0c65

Browse files
committed
fix logs
1 parent 1757548 commit 63a0c65

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

eval_protocol/proxy/proxy_core/langfuse.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -441,23 +441,25 @@ async def pointwise_fetch_langfuse_trace(
441441
to_ts = datetime.now()
442442
from_ts = to_ts - timedelta(hours=hours_back)
443443

444-
# Get expected insertion_ids from Redis for completeness checking
444+
# Get insertion_ids from Redis to find the latest one
445445
expected_ids: Set[str] = set()
446446
if rollout_id:
447447
expected_ids = get_insertion_ids(redis_client, rollout_id)
448-
logger.info(f"Pointwise fetch for rollout_id '{rollout_id}', expecting {len(expected_ids)} insertion_ids")
448+
logger.info(
449+
f"Pointwise fetch for rollout_id '{rollout_id}', found {len(expected_ids)} insertion_ids in Redis"
450+
)
449451
if not expected_ids:
450452
logger.warning(
451-
f"No expected insertion_ids found in Redis for rollout '{rollout_id}'. Returning empty trace."
453+
f"No insertion_ids found in Redis for rollout '{rollout_id}'. Cannot determine latest trace."
452454
)
453455
raise HTTPException(
454456
status_code=500,
455-
detail=f"No expected insertion_ids found in Redis for rollout '{rollout_id}'. Returning empty trace.",
457+
detail=f"No insertion_ids found in Redis for rollout '{rollout_id}'. Cannot determine latest trace.",
456458
)
457459

458460
# Get the latest (last) insertion_id since UUID v7 is time-ordered
459461
latest_insertion_id = max(expected_ids) # UUID v7 max = newest
460-
logger.info(f"Targeting latest insertion_id (last5): {latest_insertion_id[-5:]} for rollout '{rollout_id}'")
462+
logger.info(f"Targeting latest insertion_id: {latest_insertion_id} for rollout '{rollout_id}'")
461463

462464
for retry in range(max_retries):
463465
# Fetch trace list targeting the latest insertion_id
@@ -481,7 +483,7 @@ async def pointwise_fetch_langfuse_trace(
481483
if traces and traces.data:
482484
# Get the trace info
483485
trace_info = traces.data[0]
484-
logger.debug(f"Found trace {trace_info.id} for latest insertion_id {latest_insertion_id[-5:]}")
486+
logger.debug(f"Found trace {trace_info.id} for latest insertion_id {latest_insertion_id}")
485487

486488
# Fetch full trace details
487489
trace_full = await _fetch_trace_detail_with_retry(
@@ -493,7 +495,7 @@ async def pointwise_fetch_langfuse_trace(
493495
if trace_full:
494496
trace_dict = _serialize_trace_to_dict(trace_full)
495497
logger.info(
496-
f"Successfully fetched latest trace for rollout '{rollout_id}', insertion_id (last5): {latest_insertion_id[-5:]}"
498+
f"Successfully fetched latest trace for rollout '{rollout_id}', insertion_id: {latest_insertion_id}"
497499
)
498500
return LangfuseTracesResponse(
499501
project_id=project_id,
@@ -505,13 +507,13 @@ async def pointwise_fetch_langfuse_trace(
505507
if retry < max_retries - 1:
506508
wait_time = 2**retry
507509
logger.info(
508-
f"Pointwise fetch attempt {retry + 1}/{max_retries} failed for rollout '{rollout_id}', insertion_id (last5): {latest_insertion_id[-5:]}. Retrying in {wait_time}s..."
510+
f"Pointwise fetch attempt {retry + 1}/{max_retries} failed for rollout '{rollout_id}', insertion_id: {latest_insertion_id}. Retrying in {wait_time}s..."
509511
)
510512
await asyncio.sleep(wait_time)
511513

512514
# After all retries failed
513515
logger.error(
514-
f"Failed to fetch latest trace for rollout '{rollout_id}', insertion_id (last5): {latest_insertion_id[-5:]} after {max_retries} retries"
516+
f"Failed to fetch latest trace for rollout '{rollout_id}', insertion_id: {latest_insertion_id} after {max_retries} retries"
515517
)
516518
raise HTTPException(
517519
status_code=404,

0 commit comments

Comments
 (0)