mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
More metrics
This commit is contained in:
parent
0f8ea9b8f6
commit
c059d0a0ee
@ -1159,7 +1159,7 @@ int Server::main(const std::vector<std::string> & /*args*/)
|
||||
{
|
||||
/// This object will periodically calculate some metrics.
|
||||
AsynchronousMetrics async_metrics(
|
||||
global_context, config().getUInt("asynchronous_metrics_update_period_s", 60), servers_to_start_before_tables, servers);
|
||||
global_context, config().getUInt("asynchronous_metrics_update_period_s", 1), servers_to_start_before_tables, servers);
|
||||
attachSystemTablesAsync(*DatabaseCatalog::instance().getSystemDatabase(), async_metrics);
|
||||
|
||||
for (const auto & listen_host : listen_hosts)
|
||||
|
@ -583,7 +583,7 @@
|
||||
<port>9019</port>
|
||||
</jdbc_bridge>
|
||||
-->
|
||||
|
||||
|
||||
<!-- Configuration of clusters that could be used in Distributed tables.
|
||||
https://clickhouse.tech/docs/en/operations/table_engines/distributed/
|
||||
-->
|
||||
@ -917,7 +917,7 @@
|
||||
Asynchronous metrics are updated once a minute, so there is
|
||||
no need to flush more often.
|
||||
-->
|
||||
<flush_interval_milliseconds>60000</flush_interval_milliseconds>
|
||||
<flush_interval_milliseconds>7000</flush_interval_milliseconds>
|
||||
</asynchronous_metric_log>
|
||||
|
||||
<!--
|
||||
|
@ -750,6 +750,7 @@ void AsynchronousMetrics::update(std::chrono::system_clock::time_point update_ti
|
||||
/// Check if database can contain MergeTree tables
|
||||
if (!db.second->canContainMergeTreeTables())
|
||||
continue;
|
||||
|
||||
for (auto iterator = db.second->getTablesIterator(getContext()); iterator->isValid(); iterator->next())
|
||||
{
|
||||
++total_number_of_tables;
|
||||
@ -757,10 +758,17 @@ void AsynchronousMetrics::update(std::chrono::system_clock::time_point update_ti
|
||||
if (!table)
|
||||
continue;
|
||||
|
||||
StorageMergeTree * table_merge_tree = dynamic_cast<StorageMergeTree *>(table.get());
|
||||
StorageReplicatedMergeTree * table_replicated_merge_tree = dynamic_cast<StorageReplicatedMergeTree *>(table.get());
|
||||
if (MergeTreeData * table_merge_tree = dynamic_cast<MergeTreeData *>(table.get()))
|
||||
{
|
||||
const auto & settings = getContext()->getSettingsRef();
|
||||
|
||||
if (table_replicated_merge_tree)
|
||||
calculateMax(max_part_count_for_partition, table_merge_tree->getMaxPartsCountForPartition());
|
||||
total_number_of_bytes += table_merge_tree->totalBytes(settings).value();
|
||||
total_number_of_rows += table_merge_tree->totalRows(settings).value();
|
||||
total_number_of_parts += table_merge_tree->getPartsCount();
|
||||
}
|
||||
|
||||
if (StorageReplicatedMergeTree * table_replicated_merge_tree = dynamic_cast<StorageReplicatedMergeTree *>(table.get()))
|
||||
{
|
||||
StorageReplicatedMergeTree::Status status;
|
||||
table_replicated_merge_tree->getStatus(status, false);
|
||||
@ -786,24 +794,6 @@ void AsynchronousMetrics::update(std::chrono::system_clock::time_point update_ti
|
||||
"Cannot get replica delay for table: " + backQuoteIfNeed(db.first) + "." + backQuoteIfNeed(iterator->name()));
|
||||
}
|
||||
}
|
||||
|
||||
calculateMax(max_part_count_for_partition, table_replicated_merge_tree->getMaxPartsCountForPartition());
|
||||
}
|
||||
|
||||
if (table_merge_tree)
|
||||
{
|
||||
calculateMax(max_part_count_for_partition, table_merge_tree->getMaxPartsCountForPartition());
|
||||
const auto & settings = getContext()->getSettingsRef();
|
||||
total_number_of_bytes += table_merge_tree->totalBytes(settings).value();
|
||||
total_number_of_rows += table_merge_tree->totalRows(settings).value();
|
||||
total_number_of_parts += table_merge_tree->getPartsCount();
|
||||
}
|
||||
if (table_replicated_merge_tree)
|
||||
{
|
||||
const auto & settings = getContext()->getSettingsRef();
|
||||
total_number_of_bytes += table_replicated_merge_tree->totalBytes(settings).value();
|
||||
total_number_of_rows += table_replicated_merge_tree->totalRows(settings).value();
|
||||
total_number_of_parts += table_replicated_merge_tree->getPartsCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -830,7 +820,8 @@ void AsynchronousMetrics::update(std::chrono::system_clock::time_point update_ti
|
||||
|
||||
auto get_metric_name = [](const String & name) -> const char *
|
||||
{
|
||||
static std::map<String, const char *> metric_map = {
|
||||
static std::map<String, const char *> metric_map =
|
||||
{
|
||||
{"tcp_port", "TCPThreads"},
|
||||
{"tcp_port_secure", "TCPSecureThreads"},
|
||||
{"http_port", "HTTPThreads"},
|
||||
|
Loading…
Reference in New Issue
Block a user