2018-06-06 20:57:07 +00:00
|
|
|
#pragma once
|
2018-06-18 16:30:26 +00:00
|
|
|
#include <Common/ConcurrentBoundedQueue.h>
|
2022-05-17 18:07:52 +00:00
|
|
|
#include <Common/OvercommitTracker.h>
|
2018-06-18 16:30:26 +00:00
|
|
|
#include <Core/Block.h>
|
2022-07-13 08:15:37 +00:00
|
|
|
#include <re2/re2.h>
|
2018-06-06 20:57:07 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2018-06-15 17:32:35 +00:00
|
|
|
class InternalTextLogsQueue : public ConcurrentBoundedQueue<MutableColumns>
|
2018-06-06 20:57:07 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// You should not push logs in the queue if their priority greater max_priority
|
|
|
|
int max_priority;
|
|
|
|
|
2018-06-15 17:32:35 +00:00
|
|
|
InternalTextLogsQueue();
|
2018-06-06 20:57:07 +00:00
|
|
|
|
2022-07-13 08:15:37 +00:00
|
|
|
bool isNeeded(int priority, const String & source) const;
|
|
|
|
|
2018-06-06 20:57:07 +00:00
|
|
|
static Block getSampleBlock();
|
|
|
|
static MutableColumns getSampleColumns();
|
|
|
|
|
2018-06-18 16:30:26 +00:00
|
|
|
/// Is used to pass block from remote server to the client
|
|
|
|
void pushBlock(Block && log_block);
|
|
|
|
|
2018-06-06 20:57:07 +00:00
|
|
|
/// Converts priority from Poco::Message::Priority to a string
|
2023-01-16 14:20:47 +00:00
|
|
|
static std::string_view getPriorityName(int priority);
|
2022-07-13 08:15:37 +00:00
|
|
|
|
|
|
|
void setSourceRegexp(const String & regexp);
|
|
|
|
private:
|
|
|
|
/// If not null, you should only push logs which are matched with this regexp
|
|
|
|
std::unique_ptr<re2::RE2> source_regexp;
|
2018-06-06 20:57:07 +00:00
|
|
|
};
|
|
|
|
|
2018-06-15 17:32:35 +00:00
|
|
|
using InternalTextLogsQueuePtr = std::shared_ptr<InternalTextLogsQueue>;
|
2018-06-06 20:57:07 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|