Skip to content
Draft
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
51 changes: 38 additions & 13 deletions grafana/dashboard/dev/streaming_actors_tokio.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
from ..common import *
from . import section

# def _sum_actors_by_mv() -> str:
# return (
# f" sum(sum({metric('stream_actor_count')}) by (fragment_id)"
# f" * on(fragment_id) group_left(materialized_view_id) table_info)"
# f" by (materialized_view_id)"
# )

def _sum_fragment_metric_by_mv(expr: str) -> str:
return (
f"sum(({expr})"
f" * on(fragment_id) group_left(materialized_view_id)"
f" max by (fragment_id, materialized_view_id) ({metric('table_info')}))"
f" by (materialized_view_id)"
)

@section
def _(outer_panels: Panels):
Expand All @@ -14,10 +28,11 @@ def _(outer_panels: Panels):
"This can be used to estimate the CPU usage of an actor",
[
panels.target(
f"sum(rate({metric('stream_actor_poll_duration')}[$__rate_interval])) by (fragment_id)"
f"/ on(fragment_id) sum({metric('stream_actor_count')}) by (fragment_id)"
f"{_sum_fragment_metric_by_mv(f'sum(rate({metric('stream_actor_poll_duration')}[$__rate_interval])) by (fragment_id)')}"
f" / "
f" {_sum_fragment_metric_by_mv(f'sum({metric('stream_actor_count')}) by (fragment_id)')}"
f" / 1000000000",
"fragment {{fragment_id}}",
"job {{materialized_view_id}}",
),
],
),
Expand All @@ -26,31 +41,41 @@ def _(outer_panels: Panels):
"",
[
panels.target(
f"rate({metric('stream_actor_poll_cnt')}[$__rate_interval]) > 0",
"fragment {{fragment_id}}",
),
_sum_fragment_metric_by_mv(f'rate({metric('stream_actor_poll_cnt')}[$__rate_interval]) > 0'),
"job {{materialized_view_id}}",
)
],
),
panels.timeseries_percentage(
"Tokio: Actor Poll Avg Rate Per Poll",
"",
[
panels.target(
f"rate({metric('stream_actor_poll_duration')}[$__rate_interval]) / (rate({metric('stream_actor_poll_cnt')}[$__rate_interval]) > 0) / 1000000000",
"fragment {{fragment_id}}",
),
f"{_sum_fragment_metric_by_mv(f'rate({metric('stream_actor_poll_duration')}[$__rate_interval])')}"
f" / "
f"{_sum_fragment_metric_by_mv(f'(rate({metric('stream_actor_poll_cnt')}[$__rate_interval]) > 0')}"
f" / 1000000000",
"job {{materialized_view_id}}",
)
],
),
panels.timeseries_percentage(
"Tokio: Actor Idle Rate Per Actor",
"Idle time could be due to no data to process, or waiting for async operations like IO",
[
# panels.target(
# f"sum(rate({metric('stream_actor_idle_duration')}[$__rate_interval])) by (fragment_id)"
# f"/ on(fragment_id) sum({metric('stream_actor_count')}) by (fragment_id)"
# f" / 1000000000",
# "fragment {{fragment_id}}",
# ),
panels.target(
f"sum(rate({metric('stream_actor_idle_duration')}[$__rate_interval])) by (fragment_id)"
f"/ on(fragment_id) sum({metric('stream_actor_count')}) by (fragment_id)"
f"{_sum_fragment_metric_by_mv(f'sum(rate({metric('stream_actor_idle_duration')}[$__rate_interval])) by (fragment_id)')}"
f" / "
f"{_sum_fragment_metric_by_mv(f'sum({metric('stream_actor_count')}) by (fragment_id)')}"
f" / 1000000000",
"fragment {{fragment_id}}",
),
"job {{materialized_view_id}}",
)
],
),
panels.timeseries_actor_ops_small(
Expand Down
Loading