diff --git a/src/interpreter/clickhouse.rs b/src/interpreter/clickhouse.rs index 47cc13c..040d708 100644 --- a/src/interpreter/clickhouse.rs +++ b/src/interpreter/clickhouse.rs @@ -103,6 +103,9 @@ pub struct ClickHouseServerStorages { pub struct ClickHouseServerSummary { pub processes: u64, pub merges: u64, + pub replication_queue: u64, + pub replication_queue_tries: u64, + pub fetches: u64, pub servers: u64, pub storages: ClickHouseServerStorages, pub uptime: ClickHouseServerUptime, @@ -362,7 +365,10 @@ impl ClickHouse { (SELECT sum(bytes_allocated) FROM {dictionaries}) AS memory_dictionaries_, (SELECT sum(primary_key_bytes_in_memory_allocated) FROM {parts}) AS memory_primary_keys_, (SELECT count() FROM {one}) AS servers_, - (SELECT count() FROM {merges}) AS merges_ + (SELECT count() FROM {merges}) AS merges_, + (SELECT count() FROM {replication_queue}) AS replication_queue_, + (SELECT sum(num_tries) FROM {replication_queue}) AS replication_queue_tries_, + (SELECT count() FROM {fetches}) AS fetches_ SELECT assumeNotNull(servers_) AS servers, assumeNotNull(memory_tracked_) AS memory_tracked, @@ -372,6 +378,9 @@ impl ClickHouse { assumeNotNull(processes_) AS processes, assumeNotNull(memory_merges_) AS memory_merges, assumeNotNull(merges_) AS merges, + assumeNotNull(replication_queue_) AS replication_queue, + assumeNotNull(replication_queue_tries_) AS replication_queue_tries, + assumeNotNull(fetches_) AS fetches, assumeNotNull(memory_dictionaries_) AS memory_dictionaries, assumeNotNull(memory_primary_keys_) AS memory_primary_keys, @@ -451,6 +460,8 @@ impl ClickHouse { tables=self.get_table_name("system.tables"), processes=self.get_table_name("system.processes"), merges=self.get_table_name("system.merges"), + replication_queue=self.get_table_name("system.replication_queue"), + fetches=self.get_table_name("system.replicated_fetches"), dictionaries=self.get_table_name("system.dictionaries"), parts=self.get_table_name("system.parts"), asynchronous_metrics=self.get_table_name("system.asynchronous_metrics"), @@ -464,6 +475,9 @@ impl ClickHouse { return Ok(ClickHouseServerSummary { processes: get("processes"), merges: get("merges"), + replication_queue: get("replication_queue"), + replication_queue_tries: get("replication_queue_tries"), + fetches: get("fetches"), servers: get("servers"), uptime: ClickHouseServerUptime { diff --git a/src/view/summary_view.rs b/src/view/summary_view.rs index 4c9c79d..3bc619c 100644 --- a/src/view/summary_view.rs +++ b/src/view/summary_view.rs @@ -85,6 +85,20 @@ impl SummaryView { .child(views::DummyView.fixed_width(1)) .child(views::TextView::new("").with_name("merges")) .child(views::DummyView.fixed_width(1)) + .child(views::TextView::new(StyledString::styled( + "Fetches:", + BaseColor::Cyan.dark(), + ))) + .child(views::DummyView.fixed_width(1)) + .child(views::TextView::new("").with_name("fetches")) + .child(views::DummyView.fixed_width(1)) + .child(views::TextView::new(StyledString::styled( + "RepQueue:", + BaseColor::Cyan.dark(), + ))) + .child(views::DummyView.fixed_width(1)) + .child(views::TextView::new("").with_name("replication_queue")) + .child(views::DummyView.fixed_width(1)) .child(views::TextView::new(StyledString::styled( "Buffers:", BaseColor::Cyan.dark(), @@ -308,6 +322,33 @@ impl SummaryView { self.set_view_content("merges", content); } + { + let mut content = StyledString::plain(""); + content.append_styled( + summary.replication_queue.to_string(), + get_color_for_ratio(summary.replication_queue, summary.servers * 20), + ); + content.append(" ("); + content.append_styled( + summary.replication_queue_tries.to_string(), + get_color_for_ratio( + summary.replication_queue_tries, + summary.replication_queue * 2, + ), + ); + content.append(")"); + self.set_view_content("replication_queue", content); + } + + { + let mut content = StyledString::plain(""); + content.append_styled( + summary.fetches.to_string(), + get_color_for_ratio(summary.fetches, summary.servers * 20), + ); + self.set_view_content("fetches", content); + } + { let mut content = StyledString::plain(""); content.append_styled(