Skip to content

Commit

Permalink
fix: convert container utilization metrics to percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
peterxcli committed Jan 25, 2024
1 parent cb6bbeb commit 235bf5e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions monitor/service/cloudrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,16 @@ class Config:
metric_df: pd.DataFrame = pd.DataFrame(data)
metric_df = metric_df.groupby("Time").first().reset_index()
metric_df = metric_df.sort_values(by="Time", ascending=True)

# convert to percentage
metric_df["Container CPU Utilization (%)"] = (
metric_df["Container CPU Utilization (%)"] * 100
)
metric_df["Container Memory Utilization (%)"] = (
metric_df["Container Memory Utilization (%)"] * 100
)

# fill missing columns with time interpolation
metric_df.set_index("Time", inplace=True)
metric_df = metric_df.interpolate(method="time")

Expand Down

0 comments on commit 235bf5e

Please sign in to comment.