Skip to content

[WIP] Move resource id param to logger initialize #570

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

agrare
Copy link
Member

@agrare agrare commented Apr 4, 2025

No description provided.

@agrare agrare force-pushed the move_resource_id_param_to_logger_initialize branch 2 times, most recently from 1a57f86 to 3666834 Compare April 4, 2025 13:33
@agrare agrare force-pushed the move_resource_id_param_to_logger_initialize branch from 3666834 to d1a9849 Compare April 4, 2025 15:30
Copy link
Member

@kbrock kbrock left a comment

Choose a reason for hiding this comment

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

good stuff

automation_log_wrapper.add(severity, message, progname, &block)

severity ||= Logger::UNKNOWN
return true if severity < @level
Copy link
Member

Choose a reason for hiding this comment

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

Do we want our level, or the level of our wrapped log?

(that is the whole automation_log_wrapper.send("#{severity}?") thing)

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we sync the :level from the wrapped logger when we build it initially? I don't want to add more call-outs to the 'hard-coded' log_wrapper since I want to try to drop this and just use a normal broadcast

@kbrock kbrock self-assigned this Apr 9, 2025
@miq-bot miq-bot added the wip label Apr 9, 2025
@miq-bot
Copy link
Member

miq-bot commented May 27, 2025

This pull request is not mergeable. Please rebase and repush.

@miq-bot
Copy link
Member

miq-bot commented May 27, 2025

This pull request is not mergeable. Please rebase and repush.

@@ -168,11 +168,13 @@ def self.with_automation_env
private_class_method :with_automation_env

def self.process_ruby_method_results(return_code, msg, miq_request_id)
logger = ManageIQ::AutomationEngine::Logger.create_log_wrapper(:resource_id => miq_request_id)
Copy link
Member

@kbrock kbrock May 30, 2025

Choose a reason for hiding this comment

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

I wonder if we can simplify the creation of the logger even further. Moving a logger into the workspace is helpful, but also thinking about creating the log wrapper being an even simpler method.

ManageIQ::AutomationEngine.logger(miq_request_id)

That is just an example, haven't thought through this properly.

@@ -63,7 +67,7 @@ def self.instantiate_with_user(uri, user, attrs)

workspace
rescue MiqAeException => err
$miq_ae_logger.error(err.message, :resource_id => miq_request_id)
workspace.logger.error(err.message, :resource_id => miq_request_id)
Copy link
Member

Choose a reason for hiding this comment

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

did the workspace.logger allow us to no longer pass :resource_id?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

so we can change this line?

Suggested change
workspace.logger.error(err.message, :resource_id => miq_request_id)
workspace.logger.error(err.message)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants