Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ruff happy #263

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions powa/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ class QueryOverviewMetricGroup(MetricGroupDef):
local_blks_read = MetricDef(
label="Local read",
type="sizerate",
desc="Amount of local buffers found from OS"
" cache or read from disk",
desc="Amount of local buffers found from OS cache or read from disk",
)
local_blks_hit = MetricDef(
label="Local hit",
Expand Down Expand Up @@ -432,16 +431,13 @@ def query(self):
)
)
disk_hit_ratio = (
"sum(sub.reads) * 100 / "
"({total_blocks} * block_size)".format(
"sum(sub.reads) * 100 / ({total_blocks} * block_size)".format(
total_blocks=total_blocks
)
)
total_time = "greatest(sum(runtime), 1)"
other_time = (
"sum(runtime) - (("
"(sum(user_time) + sum(system_time))"
") * 1000)"
"sum(runtime) - (((sum(user_time) + sum(system_time))) * 1000)"
)

# Rusage can return values > real time due to sampling bias
Expand Down
13 changes: 5 additions & 8 deletions powa/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,9 @@ def query(self):
kcache_query = kcache_getstatdata_sample("db")

total_sys_hit = (
"{total_read} - sum(sub.reads)"
"/ {ts}"
" AS total_sys_hit"
"".format(total_read=total_read("sub", True), ts=get_ts())
"{total_read} - sum(sub.reads)/ {ts} AS total_sys_hit".format(
total_read=total_read("sub", True), ts=get_ts()
)
)
total_disk_read = (
"sum(sub.reads) / " + get_ts() + " AS total_disk_read"
Expand Down Expand Up @@ -1068,8 +1067,7 @@ class GlobalSubMetricGroup(MetricGroupDef):
apply_error_count = MetricDef(
label="# apply error",
type="number",
desc="Total number of times an error"
" occurred while applying changes",
desc="Total number of times an error occurred while applying changes",
)
sync_error_count = MetricDef(
label="# sync error",
Expand Down Expand Up @@ -1239,8 +1237,7 @@ class GlobalWalReceiverMetricGroup(MetricGroupDef):
flush_delta = MetricDef(
label="Flush delta",
type="size",
desc="Total amount of data received and written"
" but not flushed yet",
desc="Total amount of data received and written but not flushed yet",
)
last_msg_lag = MetricDef(
label="Last message latency",
Expand Down