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

Updates to handle automatic logging to a rabbitmq exchange log. The c… #54

Merged
merged 6 commits into from
Feb 13, 2024

Conversation

paulhamer-noaa
Copy link
Contributor

Update to logging to automatically set up the sending of messages to a rabbitmq exchange "log". Currently the level is set to ERROR for the exchange so only log.error, log.critical and log.exception messages will be published to the exchange.

Linear Issue

IDSSE-578

Changes

Update to Exch to set durable to True by default, update logging to create a rabbitmq exchange to automatically send log messages with "error" and above to that exchange.

…onsumer from

this exchange, when developed, should define the queue with a x-message-ttl value
so the queue does not get too large. Currently the level is set to ERROR for the
exchange so only log.error, log.critical and log.exception messages will be published
to the exchange.
Copy link
Contributor

@Geary-Layne Geary-Layne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like adding an additional handler to the logging setup that all services are using, it's a clean way to get logs sent to a rabbitmq exchange.

Need to fix the failing test

python/idsse_common/setup.py Outdated Show resolved Hide resolved
Comment on lines +142 to +143
'host': 'localhost',
'port': 5672,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will these values work when running on AWS in k8s?

'port': 5672,
'formatter': 'standard',
'filters': filter_list,
'level': 'ERROR',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder about this being hard coded. Probably fine for now but might want to address in a future log_utils cleanup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could parameterize the function for these elements and set the default values.

@@ -89,7 +90,7 @@ def _initialize_exchange_and_queue(

# Do not try to declare the default exchange. It already exists
if exch.name != '':
channel.exchange_declare(exchange=exch.name, exchange_type=exch.type)
channel.exchange_declare(exchange=exch.name, exchange_type=exch.type, durable=exch.durable)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there other args that we should be including, ie autoDelete and durable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They haven't been necessary until now so probably not.

@paulhamer-noaa
Copy link
Contributor Author

paulhamer-noaa commented Feb 12, 2024 via email

@mackenzie-grimes-noaa
Copy link
Contributor

Yep, looking at things now. Not sure why it takes 6 hours to run these...?

Whoa, 6 hours! That must be how long it takes for GitHub to give up on some infinitely-running test.

Any chance one of the tests is getting caught in an infinite loop? Or maybe repeatedly trying to connect to a RabbitMQ server on localhost or something?

@paulhamer-noaa
Copy link
Contributor Author

paulhamer-noaa commented Feb 12, 2024 via email

@paulhamer-noaa
Copy link
Contributor Author

Well that was weird, publish_confirm needed an update to handle the default durable member of the Exch class.

@paulhamer-noaa paulhamer-noaa merged commit 0ec5b5b into main Feb 13, 2024
2 checks passed
@paulhamer-noaa paulhamer-noaa deleted the IDSSE-578 branch February 13, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants