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 conn shutdown error log. Improve other error log messages #33
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ def self.included(base) | |
end | ||
|
||
def setup_rabbitmq_connection_config | ||
# RabbitMQ server address(es) | ||
# RabbitMQ server address(es) | ||
# host can either be a single host, or a list of hosts | ||
# i.e. | ||
# host => "localhost" | ||
|
@@ -201,16 +201,33 @@ def connect | |
|
||
connection = MarchHare.connect(rabbitmq_settings) | ||
|
||
|
||
connection.on_blocked { @logger.warn("RabbitMQ output blocked! Check your RabbitMQ instance!") } | ||
connection.on_unblocked { @logger.warn("RabbitMQ output unblocked!") } | ||
connection.on_shutdown do |conn, cause| | ||
@logger.warn("RabbitMQ connection was closed!", | ||
:url => connection_url(conn), | ||
:automatic_recovery => @automatic_recovery, | ||
:cause => cause) | ||
end | ||
connection.on_blocked do | ||
@logger.warn("RabbitMQ connection blocked! Check your RabbitMQ instance!", | ||
:url => connection_url(connection)) | ||
end | ||
connection.on_unblocked do | ||
@logger.warn("RabbitMQ connection unblocked!", :url => connection_url(connection)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we make this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has been warn for a long time. I think it is something that is warning level, normally queues should not be blocked unless there's a problem. |
||
end | ||
|
||
channel = connection.create_channel | ||
@logger.info("Connected to RabbitMQ at #{rabbitmq_settings[:host]}") | ||
|
||
HareInfo.new(connection, channel) | ||
end | ||
|
||
# Mostly used for printing debug logs | ||
def connection_url(connection) | ||
user_pass = connection.user ? "#{connection.user}:XXXXXX@" : "" | ||
protocol = params["ssl"] ? "amqps" : "amqp" | ||
"#{protocol}://#{user_pass}#{connection.host}:#{connection.port}#{connection.vhost}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see this here. Ignore my comment above |
||
end | ||
|
||
def sleep_for_retry | ||
Stud.stoppable_sleep(@connect_retry_interval) { @rabbitmq_connection_stopping } | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we sure this (
connection
) does not log any auth information?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see masking is done below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/logstash-plugins/logstash-mixin-rabbitmq_connection/pull/33/files#diff-5a4e6da9864c64f906837378a6f551e6R226
I never print the password.