Addressed review comments and updated name to ServerStartupMilliseconds - Record server startup time in ProfileEvents

This commit is contained in:
Smita Kulkarni 2023-01-13 14:38:54 +01:00
parent cf5cb0da97
commit a0fe26f506
4 changed files with 7 additions and 8 deletions

View File

@ -140,7 +140,7 @@ namespace CurrentMetrics
namespace ProfileEvents
{
extern const Event MainConfigLoads;
extern const Event ServerStartupTime;
extern const Event ServerStartupMilliseconds;
}
namespace fs = std::filesystem;
@ -653,7 +653,7 @@ static void sanityChecks(Server & server)
int Server::main(const std::vector<std::string> & /*args*/)
try
{
std::chrono::system_clock::time_point startup_start_time = std::chrono::system_clock::now();
Stopwatch startup_watch;
Poco::Logger * log = &logger();
@ -1430,9 +1430,6 @@ try
}
std::chrono::milliseconds startup_duration = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - startup_start_time);
ProfileEvents::increment(ProfileEvents::ServerStartupTime, startup_duration.count());
for (auto & server : servers_to_start_before_tables)
{
server.start();
@ -1816,6 +1813,8 @@ try
&CurrentMetrics::MaxDDLEntryID, &CurrentMetrics::MaxPushedDDLEntryID));
}
ProfileEvents::increment(ProfileEvents::ServerStartupMilliseconds, startup_watch.elapsedMilliseconds());
{
std::lock_guard lock(servers_lock);
for (auto & server : servers)

View File

@ -450,7 +450,7 @@ The server successfully detected this situation and will download merged part fr
M(OverflowThrow, "Number of times, data processing was cancelled by query complexity limitation with setting '*_overflow_mode' = 'throw' and exception was thrown.") \
M(OverflowAny, "Number of times approximate GROUP BY was in effect: when aggregation was performed only on top of first 'max_rows_to_group_by' unique keys and other keys were ignored due to 'group_by_overflow_mode' = 'any'.") \
\
M(ServerStartupTime, "Time elapsed from starting server to listening to sockets")\
M(ServerStartupMilliseconds, "Time elapsed from starting server to listening to sockets in milliseconds")\
namespace ProfileEvents
{

View File

@ -1 +1 @@
ServerStartupTime
ServerStartupMilliseconds

View File

@ -1 +1 @@
SELECT event FROM system.events WHERE event = 'ServerStartupTime'
SELECT event FROM system.events WHERE event = 'ServerStartupMilliseconds'