Repository: risingwavelabs/risingwave
File: grafana/dashboard/dev/streaming_fragments.py (Python)

Code before:
                ),
                panels.subheader("Memory Usage by Fragment"),
                panels.timeseries_bytes(
                    "Total Memory Usage",
                    "Sum of executor cache memory and shared buffer imm size",
                    [
                        panels.target(
                            total_memory_usage_expr,
                            "fragment {{fragment_id}}",
                        ),
                    ],
                ),
                panels.timeseries_bytes(
                    "Executor Cache Memory Usage",
                    "",
                    [
                        panels.target(
                            executor_cache_usage_expr,
                            "fragment {{fragment_id}}",
                        ),
                    ],
                ),
                panels.timeseries_bytes(
                    "Shared Buffer Memory Usage",
                    "",
                    [
                        panels.target(
                            shared_buffer_usage_expr,
                            "fragment {{fragment_id}}",
                        ),
                    ],
                ),
                panels.subheader("Backpressure by Fragment"),
                panels.timeseries_percentage(
                    "Actor Output Blocking Rate (Downstream Backpressure)",
                    "The rate that an actor is blocked by its downstream.",
                    [
                        # The metrics might be pre-aggregated locally on each compute node when `actor_id` is masked due to metrics level settings.
                        # Thus to calculate the average, we need to manually divide the actor count.
                        #
                        # Note: actor_count is equal to the number of dispatchers for a given downstream fragment,
                        # this holds true as long as we don't support multiple edges between two fragments.
                        panels.target(
                            f"sum(rate({metric('stream_actor_output_buffer_blocking_duration_ns')}[$__rate_interval])) by (fragment_id, downstream_fragment_id) \
                                / ignoring (downstream_fragment_id) group_left sum({metric('stream_actor_count')}) by (fragment_id) \
                                / 1000000000",
                            "fragment {{fragment_id}}->{{downstream_fragment_id}}",
                        ),
                    ],
                ),
                panels.timeseries_percentage(

Review comment (performance):
The description for 'Executor Cache Memory Usage' panel is empty. Add a meaningful description similar to other panels (e.g., 'Executor cache memory usage aggregated by fragment').
```suggestion
                    "Executor cache memory usage aggregated by fragment",
```

Code after:
                    "",
                    [
                        panels.target(
                            f"sum(rate({metric('stream_actor_out_record_cnt')}[$__rate_interval])) by (fragment_id)",
                            "fragment total {{fragment_id}}",
                        ),
                        panels.target_hidden(
                            f"rate({metric('stream_actor_out_record_cnt', actor_level_filter)}[$__rate_interval])",
                            "actor {{actor_id}}",
                        ),
                    ],
                ),
                panels.subheader("Memory Usage by Fragment"),
                panels.timeseries_bytes(
                    "Total Memory Usage",
                    "Sum of executor cache memory and shared buffer imm size",
                    [
                        panels.target(
                            total_memory_usage_expr,
                            "fragment {{fragment_id}}",
                        ),
                    ],
                ),
                panels.timeseries_bytes(
                    "Executor Cache Memory Usage",
                    "",
                    [
                        panels.target(
                            executor_cache_usage_expr,
                            "fragment {{fragment_id}}",
                        ),
                    ],
                ),
                panels.timeseries_bytes(
                    "Shared Buffer Memory Usage",
                    "",
                    [
                        panels.target(
                            shared_buffer_usage_expr,
                            "fragment {{fragment_id}}",
                        ),
                    ],
                ),
                panels.subheader("Backpressure by Fragment"),
                panels.timeseries_percentage(
                    "Actor Output Blocking Rate (Downstream Backpressure)",
                    "The rate that an actor is blocked by its downstream.",
                    [
                        # The metrics might be pre-aggregated locally on each compute node when `actor_id` is masked due to metrics level settings.
                        # Thus to calculate the average, we need to manually divide the actor count.
                        #