Skip to content

Commit

Permalink
c/types: made cluster health overview printable
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Maślanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Apr 10, 2024
1 parent a1e9811 commit acca9ec
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/v/cluster/health_monitor_types.cc
Original file line number Diff line number Diff line change
@@ -263,4 +263,24 @@ std::ostream& operator<<(std::ostream& o, const get_cluster_health_reply& r) {
return o;
}

std::ostream& operator<<(std::ostream& o, const cluster_health_overview& ho) {
fmt::print(
o,
"{{controller_id: {}, nodes: {}, unhealthy_reasons: {}, nodes_down: {}, "
"nodes_in_recovery_mode: {}, bytes_in_cloud_storage: {}, "
"leaderless_count: {}, under_replicated_count: {}, "
"leaderless_partitions: {}, under_replicated_partitions: {}}}",
ho.controller_id,
ho.all_nodes,
ho.unhealthy_reasons,
ho.nodes_down,
ho.nodes_in_recovery_mode,
ho.bytes_in_cloud_storage,
ho.leaderless_count,
ho.under_replicated_count,
ho.leaderless_partitions,
ho.under_replicated_partitions);
return o;
}

} // namespace cluster
3 changes: 3 additions & 0 deletions src/v/cluster/health_monitor_types.h
Original file line number Diff line number Diff line change
@@ -276,6 +276,9 @@ struct cluster_health_overview {
std::vector<model::ntp> under_replicated_partitions;
size_t under_replicated_count{};
std::optional<size_t> bytes_in_cloud_storage;

friend std::ostream&
operator<<(std::ostream&, const cluster_health_overview&);
};

using include_partitions_info = ss::bool_class<struct include_partitions_tag>;

0 comments on commit acca9ec

Please sign in to comment.