From f41cf281e4a29e9d703bde1e29c74a7433f1a208 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 25 Oct 2021 21:14:16 +0300 Subject: [PATCH] Add QueryProfilerRuns profile event This will help to investigate query latency spikes. --- src/Common/ProfileEvents.cpp | 3 ++- src/Common/QueryProfiler.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Common/ProfileEvents.cpp b/src/Common/ProfileEvents.cpp index 941a3ab0896..44adbccc089 100644 --- a/src/Common/ProfileEvents.cpp +++ b/src/Common/ProfileEvents.cpp @@ -227,7 +227,8 @@ M(CreatedHTTPConnections, "Total amount of created HTTP connections (counter increase every time connection is created).") \ \ M(CannotWriteToWriteBufferDiscard, "Number of stack traces dropped by query profiler or signal handler because pipe is full or cannot write to pipe.") \ - M(QueryProfilerSignalOverruns, "Number of times we drop processing of a signal due to overrun plus the number of signals that OS has not delivered due to overrun.") \ + M(QueryProfilerSignalOverruns, "Number of times we drop processing of a query profiler signal due to overrun plus the number of signals that OS has not delivered due to overrun.") \ + M(QueryProfilerRuns, "Number of times QueryProfiler had been run.") \ \ M(CreatedLogEntryForMerge, "Successfully created log entry to merge parts in ReplicatedMergeTree.") \ M(NotCreatedLogEntryForMerge, "Log entry to merge parts in ReplicatedMergeTree is not created due to concurrent log update by another replica.") \ diff --git a/src/Common/QueryProfiler.cpp b/src/Common/QueryProfiler.cpp index aa40226093a..77b8d0dda5e 100644 --- a/src/Common/QueryProfiler.cpp +++ b/src/Common/QueryProfiler.cpp @@ -15,6 +15,7 @@ namespace ProfileEvents { extern const Event QueryProfilerSignalOverruns; + extern const Event QueryProfilerRuns; } namespace DB @@ -60,6 +61,7 @@ namespace const StackTrace stack_trace(signal_context); TraceCollector::collect(trace_type, stack_trace, 0); + ProfileEvents::increment(ProfileEvents::QueryProfilerRuns); errno = saved_errno; }