Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more logging to RabbitMQ (to help debug tests) #46283

Merged
merged 1 commit into from
Feb 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Storages/MessageQueueSink.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <Storages/MessageQueueSink.h>
#include <Formats/FormatFactory.h>
#include <Processors/Formats/IRowOutputFormat.h>
#include <Common/logger_useful.h>

namespace DB
{
Expand All @@ -18,6 +19,10 @@ MessageQueueSink::MessageQueueSink(

void MessageQueueSink::onStart()
{
LOG_TEST(
&Poco::Logger::get("MessageQueueSink"),
"Executing startup for MessageQueueSink");

initialize();
producer->start(context);

Expand Down
7 changes: 5 additions & 2 deletions src/Storages/RabbitMQ/RabbitMQProducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ RabbitMQProducer::RabbitMQProducer(

void RabbitMQProducer::initialize()
{
LOG_TRACE(log, "Initializing producer");

if (connection.connect())
setupChannel();
else
Expand Down Expand Up @@ -74,8 +76,6 @@ void RabbitMQProducer::finishImpl()

void RabbitMQProducer::produce(const String & message, size_t, const Columns &, size_t)
{
LOG_DEBUG(&Poco::Logger::get("RabbitMQProducer"), "push {}", message);

Payload payload;
payload.message = message;
payload.id = ++payload_counter;
Expand All @@ -86,6 +86,7 @@ void RabbitMQProducer::produce(const String & message, size_t, const Columns &,
void RabbitMQProducer::setupChannel()
{
producer_channel = connection.createChannel();
LOG_TRACE(log, "Created a producer channel");

producer_channel->onError([&](const char * message)
{
Expand Down Expand Up @@ -226,6 +227,8 @@ void RabbitMQProducer::publish(Payloads & messages, bool republishing)

void RabbitMQProducer::startProducingTaskLoop()
{
LOG_TRACE(log, "Starting producer loop");

while ((!payloads.isFinishedAndEmpty() || !returned.empty() || !delivery_record.empty()) && !shutdown_called.load())
{
/// If onReady callback is not received, producer->usable() will anyway return true,
Expand Down