2019-07-10 20:47:39 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Common/ThreadPool.h>
|
2022-01-11 19:30:55 +00:00
|
|
|
#include <Common/TraceSender.h>
|
2019-07-10 20:47:39 +00:00
|
|
|
|
2020-01-16 12:37:29 +00:00
|
|
|
class StackTrace;
|
|
|
|
|
2019-07-10 20:47:39 +00:00
|
|
|
namespace Poco
|
|
|
|
{
|
|
|
|
class Logger;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class TraceLog;
|
|
|
|
|
|
|
|
class TraceCollector
|
|
|
|
{
|
2020-01-16 12:37:29 +00:00
|
|
|
public:
|
2022-03-13 11:59:20 +00:00
|
|
|
explicit TraceCollector(std::shared_ptr<TraceLog> trace_log_);
|
2020-01-16 12:37:29 +00:00
|
|
|
~TraceCollector();
|
|
|
|
|
2022-01-11 19:30:55 +00:00
|
|
|
static inline void collect(TraceType trace_type, const StackTrace & stack_trace, Int64 size)
|
|
|
|
{
|
|
|
|
return TraceSender::send(trace_type, stack_trace, size);
|
|
|
|
}
|
2020-01-16 12:37:29 +00:00
|
|
|
|
2019-07-10 20:47:39 +00:00
|
|
|
private:
|
|
|
|
std::shared_ptr<TraceLog> trace_log;
|
|
|
|
ThreadFromGlobalPool thread;
|
|
|
|
|
|
|
|
void run();
|
2020-02-11 15:16:53 +00:00
|
|
|
void stop();
|
2019-07-10 20:47:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|