Exclude internal databases from async metric "NumberOfDatabases"

This commit is contained in:
Robert Schulze 2023-02-15 12:58:00 +00:00
parent 539cb6f3c1
commit 44815240f5
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
2 changed files with 6 additions and 2 deletions

View File

@ -218,7 +218,11 @@ void ServerAsynchronousMetrics::updateImpl(AsynchronousMetricValues & new_values
size_t max_part_count_for_partition = 0;
size_t number_of_databases = databases.size();
size_t number_of_databases = 0;
for (auto [db_name, _] : databases)
if (db_name != DatabaseCatalog::TEMPORARY_DATABASE)
++number_of_databases; /// filter out the internal database for temporary tables, system table "system.databases" behaves the same way
size_t total_number_of_tables = 0;
size_t total_number_of_bytes = 0;

View File

@ -80,7 +80,7 @@ void StorageSystemDatabases::fillData(MutableColumns & res_columns, ContextPtr c
continue;
if (database_name == DatabaseCatalog::TEMPORARY_DATABASE)
continue; /// We don't want to show the internal database for temporary tables in system.databases
continue; /// filter out the internal database for temporary tables in system.databases, asynchronous metric "NumberOfDatabases" behaves the same way
res_columns[0]->insert(database_name);
res_columns[1]->insert(database->getEngineName());