Add prometheus support (#950)

Fixes #888
This commit is contained in:
Sergey Kuznetsov
2023-11-02 17:26:03 +00:00
committed by GitHub
parent 320ebaa5d2
commit a16b680a7a
50 changed files with 4322 additions and 178 deletions

View File

@@ -21,13 +21,35 @@
namespace rpc {
WorkQueue::WorkQueue(std::uint32_t numWorkers, uint32_t maxSize) : ioc_{numWorkers}
WorkQueue::WorkQueue(std::uint32_t numWorkers, uint32_t maxSize)
: queued_{PrometheusService::counterInt(
"work_queue_queued_total_number",
util::prometheus::Labels(),
"The total number of tasks queued for processing"
)}
, durationUs_{PrometheusService::counterInt(
"work_queue_cumulitive_tasks_duration_us",
util::prometheus::Labels(),
"The total number of microseconds tasks were waiting to be executed"
)}
, curSize_{PrometheusService::gaugeInt(
"work_queue_current_size",
util::prometheus::Labels(),
"The current number of tasks in the queue"
)}
, ioc_{numWorkers}
{
if (maxSize != 0)
maxSize_ = maxSize;
}
WorkQueue::~WorkQueue()
{
join();
}
void
WorkQueue::join()
{
ioc_.join();
}