[go: nahoru, domu]

Skip to content

Commit

Permalink
fix: span json decoder for event lists (#3867)
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerHYang committed Jul 9, 2024
1 parent ccc8cf0 commit 066895b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/phoenix/trace/span_json_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def json_to_span(data: Dict[str, Any]) -> Any:
attributes=event.get("attributes") or {},
timestamp=datetime.fromisoformat(event["timestamp"]),
)
for event in data["events"]
for event in (
data["events"] if isinstance(data["events"], list) else json.loads(data["events"])
)
]
data["conversation"] = (
SpanConversationAttributes(**data["conversation"])
Expand Down
2 changes: 2 additions & 0 deletions src/phoenix/trace/trace_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from uuid import UUID, uuid4
from warnings import warn

import numpy as np
import pandas as pd
from openinference.semconv.trace import (
DocumentAttributes,
Expand Down Expand Up @@ -60,6 +61,7 @@ def normalize_dataframe(dataframe: DataFrame) -> "DataFrame":
# Convert the start and end times to datetime
dataframe["start_time"] = normalize_timestamps(dataframe["start_time"])
dataframe["end_time"] = normalize_timestamps(dataframe["end_time"])
dataframe = dataframe.replace({np.nan: None})
return dataframe


Expand Down

0 comments on commit 066895b

Please sign in to comment.