-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add threads metrics * add threads metrics Signed-off-by: bestwoody <[email protected]> * format Signed-off-by: bestwoody <[email protected]> * update threadpool into thread_pool Signed-off-by: bestwoody <[email protected]> * UPDATE_CUR_AND_MAX_METRIC Signed-off-by: bestwoody <[email protected]> * refine include Signed-off-by: bestwoody <[email protected]>
- Loading branch information
Showing
9 changed files
with
488 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <Common/Stopwatch.h> | ||
#include <Common/ThreadMetricUtil.h> | ||
#include <Common/TiFlashMetrics.h> | ||
#include <common/types.h> | ||
|
||
std::atomic<UInt64> last_max_thds_metric_reset_ts{0}; | ||
const UInt64 max_thds_metric_reset_interval = 60; //60s | ||
|
||
namespace DB | ||
{ | ||
bool tryToResetMaxThreadsMetrics() | ||
{ | ||
UInt64 now_ts = StopWatchDetail::seconds(CLOCK_MONOTONIC); | ||
if (now_ts > last_max_thds_metric_reset_ts + max_thds_metric_reset_interval) | ||
{ | ||
last_max_thds_metric_reset_ts = now_ts; | ||
GET_METRIC(tiflash_thread_count, type_max_threads_of_dispatch_mpp).Set(GET_METRIC(tiflash_thread_count, type_active_threads_of_dispatch_mpp).Value()); | ||
GET_METRIC(tiflash_thread_count, type_max_threads_of_establish_mpp).Set(GET_METRIC(tiflash_thread_count, type_active_threads_of_establish_mpp).Value()); | ||
GET_METRIC(tiflash_thread_count, type_max_threads_of_raw).Set(GET_METRIC(tiflash_thread_count, type_total_threads_of_raw).Value()); | ||
GET_METRIC(tiflash_thread_count, type_max_active_threads_of_thdpool).Set(GET_METRIC(tiflash_thread_count, type_active_threads_of_thdpool).Value()); | ||
GET_METRIC(tiflash_thread_count, type_max_threads_of_thdpool).Set(GET_METRIC(tiflash_thread_count, type_total_threads_of_thdpool).Value()); | ||
return true; | ||
} | ||
return false; | ||
} | ||
} // namespace DB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
|
||
namespace DB | ||
{ | ||
bool tryToResetMaxThreadsMetrics(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.