Skip to content

Commit

Permalink
🐛 fix typo in logger
Browse files Browse the repository at this point in the history
  • Loading branch information
FR-SON committed Jan 25, 2024
1 parent c21b8b4 commit 4e73d3f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tracex/extraction/logic/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,16 @@ def calculate_tokens_sum(log_file_path):
header=None,
names=["timestamp", "message"],
)

df["message"] = df["message"].apply(ast.literal_eval)

df["calling_function_name"] = df["message"].apply(lambda x: x.get("function_name"))
df["parent_calling_file"] = df["message"].apply(lambda x: x.get("calling_file"))
df["calling_function_name"] = df["message"].apply(
lambda x: x.get("calling_function_name")
)
df["calling_file"] = df["message"].apply(lambda x: x.get("calling_file"))
df["tokens_used"] = df["message"].apply(lambda x: x.get("tokens_used", 0))

result_df = (
df.groupby(["calling_function_name", "parent_calling_file"])["tokens_used"]
df.groupby(["calling_function_name", "calling_file"])["tokens_used"]
.sum()
.reset_index()
)
Expand Down

0 comments on commit 4e73d3f

Please sign in to comment.