{
  "title": "Cluster Overview",
  "description": "Generated from AutoMQ opsbox Grafana dashboard cluster-overview.json. Complex PromQL expressions are tracked in dashboard-mapping.json.\n\nRendered as Datadog ordered/fixed sections. The matching free-layout backup is kept as cluster-overview-free-bak.json.",
  "notify_list": null,
  "layout_type": "ordered",
  "template_variables": [
    {
      "name": "automq_env_id",
      "prefix": "env_id",
      "default": "*"
    },
    {
      "name": "automq_instance_id",
      "prefix": "instance_id",
      "default": "*"
    },
    {
      "name": "cluster_id",
      "prefix": "service",
      "default": "*"
    }
  ],
  "reflow_type": "fixed",
  "widgets": [
    {
      "definition": {
        "type": "group",
        "title": "Cluster Metadata",
        "layout_type": "ordered",
        "show_title": true,
        "widgets": [
          {
            "definition": {
              "type": "note",
              "content": "**InstanceId**\n\n​$automq_instance_id.value",
              "background_color": "white",
              "font_size": "16",
              "has_padding": true,
              "show_tick": false,
              "text_align": "left",
              "vertical_align": "center"
            },
            "layout": {
              "x": 0,
              "y": 0,
              "width": 2,
              "height": 3
            }
          },
          {
            "definition": {
              "type": "note",
              "content": "**EnvId**\n\n​$automq_env_id.value",
              "background_color": "white",
              "font_size": "16",
              "has_padding": true,
              "show_tick": false,
              "text_align": "left",
              "vertical_align": "center"
            },
            "layout": {
              "x": 2,
              "y": 0,
              "width": 2,
              "height": 3
            }
          },
          {
            "definition": {
              "type": "note",
              "content": "**AutoMQ Version**\n\n​N/A",
              "background_color": "white",
              "font_size": "16",
              "has_padding": true,
              "show_tick": false,
              "text_align": "left",
              "vertical_align": "center"
            },
            "layout": {
              "x": 4,
              "y": 0,
              "width": 2,
              "height": 3
            }
          },
          {
            "definition": {
              "type": "query_value",
              "title": "Cluster Total CPU Usage",
              "requests": [
                {
                  "response_format": "scalar",
                  "queries": [
                    {
                      "data_source": "metrics",
                      "name": "query1",
                      "query": "sum:jvm_cpu_count{$automq_env_id,$automq_instance_id,$cluster_id}",
                      "aggregator": "last"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1",
                      "alias": "Cluster Total CPU Usage"
                    }
                  ]
                }
              ],
              "autoscale": true,
              "precision": 0
            },
            "layout": {
              "x": 6,
              "y": 0,
              "width": 3,
              "height": 3
            }
          },
          {
            "definition": {
              "type": "note",
              "content": "**ClusterId**\n\n​$cluster_id.value",
              "background_color": "white",
              "font_size": "16",
              "has_padding": true,
              "show_tick": false,
              "text_align": "left",
              "vertical_align": "center"
            },
            "layout": {
              "x": 9,
              "y": 0,
              "width": 3,
              "height": 3
            }
          }
        ]
      }
    },
    {
      "definition": {
        "type": "group",
        "title": "Cluster Summary",
        "layout_type": "ordered",
        "show_title": true,
        "widgets": [
          {
            "definition": {
              "type": "query_value",
              "title": "Topics",
              "requests": [
                {
                  "response_format": "scalar",
                  "queries": [
                    {
                      "data_source": "metrics",
                      "name": "query1",
                      "query": "avg:kafka_topic_count{$automq_env_id,$automq_instance_id,$cluster_id}",
                      "aggregator": "last"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1",
                      "alias": "Topics"
                    }
                  ]
                }
              ],
              "autoscale": true,
              "precision": 0
            },
            "layout": {
              "x": 0,
              "y": 0,
              "width": 2,
              "height": 3
            }
          },
          {
            "definition": {
              "type": "query_value",
              "title": "Partitions",
              "requests": [
                {
                  "response_format": "scalar",
                  "queries": [
                    {
                      "data_source": "metrics",
                      "name": "query1",
                      "query": "avg:kafka_partition_total_count{$automq_env_id,$automq_instance_id,$cluster_id}",
                      "aggregator": "last"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1",
                      "alias": "Partitions"
                    }
                  ]
                }
              ],
              "autoscale": true,
              "precision": 0
            },
            "layout": {
              "x": 2,
              "y": 0,
              "width": 2,
              "height": 3
            }
          },
          {
            "definition": {
              "type": "query_value",
              "title": "Error Ratio",
              "requests": [
                {
                  "response_format": "scalar",
                  "queries": [
                    {
                      "data_source": "metrics",
                      "name": "query1",
                      "query": "sum:automq_request_error_count_total{$automq_env_id,$automq_instance_id,$cluster_id,!error:none}.as_rate()",
                      "aggregator": "last"
                    },
                    {
                      "data_source": "metrics",
                      "name": "query2",
                      "query": "sum:automq_request_error_count_total{$automq_env_id,$automq_instance_id,$cluster_id}.as_rate()",
                      "aggregator": "last"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1 / query2 * 100",
                      "alias": "Error Ratio",
                      "number_format": {
                        "unit": {
                          "type": "canonical_unit",
                          "unit_name": "percent"
                        }
                      }
                    }
                  ]
                }
              ],
              "autoscale": true,
              "precision": 2
            },
            "layout": {
              "x": 4,
              "y": 0,
              "width": 2,
              "height": 3
            }
          },
          {
            "definition": {
              "type": "query_value",
              "title": "Groups",
              "requests": [
                {
                  "response_format": "scalar",
                  "queries": [
                    {
                      "data_source": "metrics",
                      "name": "query1",
                      "query": "sum:automq_group_count{$automq_env_id,$automq_instance_id,$cluster_id}",
                      "aggregator": "last"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1",
                      "alias": "Groups"
                    }
                  ]
                }
              ],
              "autoscale": true,
              "precision": 0
            },
            "layout": {
              "x": 6,
              "y": 0,
              "width": 2,
              "height": 3
            }
          },
          {
            "definition": {
              "type": "timeseries",
              "title": "Broker Count",
              "requests": [
                {
                  "response_format": "timeseries",
                  "queries": [
                    {
                      "data_source": "metrics",
                      "name": "query1",
                      "query": "max:kafka_broker_active_count{$automq_env_id,$automq_instance_id,$cluster_id} by {service}"
                    },
                    {
                      "data_source": "metrics",
                      "name": "query2",
                      "query": "avg:kafka_broker_fenced_count{$automq_env_id,$automq_instance_id,$cluster_id}"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1",
                      "alias": "Active"
                    },
                    {
                      "formula": "query2",
                      "alias": "Fenced"
                    }
                  ]
                }
              ],
              "show_legend": true,
              "legend_layout": "horizontal",
              "legend_size": "auto",
              "legend_columns": [
                "min",
                "max",
                "avg"
              ]
            },
            "layout": {
              "x": 8,
              "y": 0,
              "width": 4,
              "height": 4
            }
          }
        ]
      }
    },
    {
      "definition": {
        "type": "group",
        "title": "Traffic and Resource Trends",
        "layout_type": "ordered",
        "show_title": true,
        "widgets": [
          {
            "definition": {
              "type": "timeseries",
              "title": "Bytes In (+) / Out (-)",
              "requests": [
                {
                  "response_format": "timeseries",
                  "queries": [
                    {
                      "data_source": "metrics",
                      "name": "query1",
                      "query": "sum:automq_cluster_broker_network_io_bytes_total{$automq_env_id,$automq_instance_id,$cluster_id,direction:in}.as_rate()"
                    },
                    {
                      "data_source": "metrics",
                      "name": "query2",
                      "query": "sum:automq_cluster_broker_network_io_bytes_total{$automq_env_id,$automq_instance_id,$cluster_id,direction:out}.as_rate()"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1",
                      "alias": "In",
                      "number_format": {
                        "unit": {
                          "type": "canonical_unit",
                          "unit_name": "byte",
                          "per_unit_name": "second"
                        }
                      }
                    },
                    {
                      "formula": "query2 * -1",
                      "alias": "Out",
                      "number_format": {
                        "unit": {
                          "type": "canonical_unit",
                          "unit_name": "byte",
                          "per_unit_name": "second"
                        }
                      }
                    }
                  ]
                }
              ],
              "show_legend": true,
              "legend_layout": "horizontal",
              "legend_size": "auto",
              "legend_columns": [
                "min",
                "max",
                "avg"
              ]
            },
            "layout": {
              "x": 0,
              "y": 0,
              "width": 6,
              "height": 4
            }
          },
          {
            "definition": {
              "type": "timeseries",
              "title": "QPS In (+) / Out (-)",
              "requests": [
                {
                  "response_format": "timeseries",
                  "queries": [
                    {
                      "data_source": "metrics",
                      "name": "query1",
                      "query": "sum:automq_topic_request_count_total{$automq_env_id,$automq_instance_id,$cluster_id,type:produce}.as_rate()"
                    },
                    {
                      "data_source": "metrics",
                      "name": "query2",
                      "query": "sum:automq_topic_request_count_total{$automq_env_id,$automq_instance_id,$cluster_id,type:fetch}.as_rate()"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1",
                      "alias": "In",
                      "number_format": {
                        "unit": {
                          "type": "custom_unit_label",
                          "label": "req/s"
                        }
                      }
                    },
                    {
                      "formula": "query2 * -1",
                      "alias": "Out",
                      "number_format": {
                        "unit": {
                          "type": "custom_unit_label",
                          "label": "req/s"
                        }
                      }
                    }
                  ]
                }
              ],
              "show_legend": true,
              "legend_layout": "horizontal",
              "legend_size": "auto",
              "legend_columns": [
                "min",
                "max",
                "avg"
              ]
            },
            "layout": {
              "x": 6,
              "y": 0,
              "width": 6,
              "height": 4
            }
          },
          {
            "definition": {
              "type": "timeseries",
              "title": "Size",
              "requests": [
                {
                  "response_format": "timeseries",
                  "queries": [
                    {
                      "data_source": "metrics",
                      "name": "query1",
                      "query": "sum:automq_topic_log_size{$automq_env_id,$automq_instance_id,$cluster_id}"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1",
                      "alias": "Size",
                      "number_format": {
                        "unit": {
                          "type": "canonical_unit",
                          "unit_name": "byte"
                        }
                      }
                    }
                  ]
                }
              ],
              "show_legend": true,
              "legend_layout": "horizontal",
              "legend_size": "auto",
              "legend_columns": [
                "min",
                "max",
                "avg",
                "value"
              ]
            },
            "layout": {
              "x": 0,
              "y": 4,
              "width": 6,
              "height": 4
            }
          },
          {
            "definition": {
              "type": "timeseries",
              "title": "Cluster Max CPU Utilization",
              "requests": [
                {
                  "response_format": "timeseries",
                  "queries": [
                    {
                      "data_source": "metrics",
                      "name": "query1",
                      "query": "max:jvm_cpu_time_seconds_total{$automq_env_id,$automq_instance_id,$cluster_id} by {service}.as_rate()"
                    },
                    {
                      "data_source": "metrics",
                      "name": "query2",
                      "query": "max:jvm_cpu_count{$automq_env_id,$automq_instance_id,$cluster_id} by {service}"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "(query1 / query2) * 100",
                      "alias": "Cluster Max CPU Utilization",
                      "number_format": {
                        "unit": {
                          "type": "canonical_unit",
                          "unit_name": "percent"
                        }
                      }
                    }
                  ]
                }
              ],
              "show_legend": true,
              "legend_layout": "horizontal",
              "legend_size": "auto",
              "legend_columns": [
                "min",
                "max",
                "avg"
              ]
            },
            "layout": {
              "x": 6,
              "y": 4,
              "width": 6,
              "height": 4
            }
          }
        ]
      }
    },
    {
      "definition": {
        "type": "group",
        "title": "Topic Statistics",
        "layout_type": "ordered",
        "show_title": true,
        "widgets": [
          {
            "definition": {
              "type": "query_table",
              "title": "Topic Statistics",
              "requests": [
                {
                  "response_format": "scalar",
                  "queries": [
                    {
                      "data_source": "metrics",
                      "name": "query1",
                      "query": "sum:automq_topic_network_io_bytes_total{$automq_env_id,$automq_instance_id,$cluster_id,direction:in} by {topic}.as_rate()"
                    },
                    {
                      "data_source": "metrics",
                      "name": "query2",
                      "query": "sum:automq_topic_network_io_bytes_total{$automq_env_id,$automq_instance_id,$cluster_id,direction:out} by {topic}.as_rate()"
                    },
                    {
                      "data_source": "metrics",
                      "name": "query3",
                      "query": "sum:automq_topic_request_count_total{$automq_env_id,$automq_instance_id,$cluster_id,type:produce} by {topic}.as_rate()"
                    },
                    {
                      "data_source": "metrics",
                      "name": "query4",
                      "query": "sum:automq_topic_request_count_total{$automq_env_id,$automq_instance_id,$cluster_id,type:fetch} by {topic}.as_rate()"
                    },
                    {
                      "data_source": "metrics",
                      "name": "query5",
                      "query": "sum:automq_topic_message_count_total{$automq_env_id,$automq_instance_id,$cluster_id,direction:in} by {topic}.as_rate()"
                    },
                    {
                      "data_source": "metrics",
                      "name": "query6",
                      "query": "sum:automq_topic_log_size{$automq_env_id,$automq_instance_id,$cluster_id} by {topic}"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1",
                      "alias": "Bytes In",
                      "number_format": {
                        "unit": {
                          "type": "canonical_unit",
                          "unit_name": "byte",
                          "per_unit_name": "second"
                        }
                      }
                    },
                    {
                      "formula": "query2",
                      "alias": "Bytes Out",
                      "number_format": {
                        "unit": {
                          "type": "canonical_unit",
                          "unit_name": "byte",
                          "per_unit_name": "second"
                        }
                      }
                    },
                    {
                      "formula": "query3",
                      "alias": "Produce QPS",
                      "number_format": {
                        "unit": {
                          "type": "custom_unit_label",
                          "label": "req/s"
                        }
                      }
                    },
                    {
                      "formula": "query5",
                      "alias": "Messages In",
                      "number_format": {
                        "unit": {
                          "type": "custom_unit_label",
                          "label": "msg/s"
                        }
                      }
                    },
                    {
                      "formula": "query5 / query3",
                      "alias": "Msg / Batch"
                    },
                    {
                      "formula": "query4",
                      "alias": "Fetch QPS",
                      "number_format": {
                        "unit": {
                          "type": "custom_unit_label",
                          "label": "req/s"
                        }
                      }
                    },
                    {
                      "formula": "query6",
                      "alias": "Size",
                      "number_format": {
                        "unit": {
                          "type": "canonical_unit",
                          "unit_name": "byte"
                        }
                      }
                    }
                  ]
                }
              ]
            },
            "layout": {
              "x": 0,
              "y": 0,
              "width": 12,
              "height": 8
            }
          }
        ]
      }
    },
    {
      "definition": {
        "type": "group",
        "title": "Group Statistics",
        "layout_type": "ordered",
        "show_title": true,
        "widgets": [
          {
            "definition": {
              "type": "query_table",
              "title": "Group Statistics",
              "requests": [
                {
                  "response_format": "scalar",
                  "queries": [
                    {
                      "data_source": "metrics",
                      "name": "query1",
                      "query": "sum:automq_consumer_group_topic_commit_offset{$automq_env_id,$automq_instance_id,$cluster_id,consumer_group:*} by {consumer_group,topic}"
                    },
                    {
                      "data_source": "metrics",
                      "name": "query2",
                      "query": "sum:automq_group_topic_offset_lag{$automq_env_id,$automq_instance_id,$cluster_id,consumer_group:*} by {consumer_group,topic}"
                    },
                    {
                      "data_source": "metrics",
                      "name": "query3",
                      "query": "sum:automq_consumer_group_topic_commit_offset{$automq_env_id,$automq_instance_id,$cluster_id,consumer_group:*} by {consumer_group,topic}"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "per_second(query3)",
                      "alias": "Consume Throughput",
                      "number_format": {
                        "unit": {
                          "type": "custom_unit_label",
                          "label": "msg/s"
                        }
                      }
                    },
                    {
                      "formula": "query2",
                      "alias": "Consumer Lag"
                    }
                  ]
                }
              ]
            },
            "layout": {
              "x": 0,
              "y": 0,
              "width": 12,
              "height": 8
            }
          }
        ]
      }
    }
  ]
}
