-
Notifications
You must be signed in to change notification settings - Fork 898
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
Adding request id to evm log #17013
Adding request id to evm log #17013
Conversation
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.
@pkomanek As we discussed we want to make the same change to the tracking_label
at the request level as well.
Example log snippet:
Q-task_id([service_template_provision_request_r99000000000003]) and
Q-task_id([r99000000000003_service_template_provision_task_99000000000004])
@@ -3,7 +3,7 @@ module MiqRequestTask::StateMachine | |||
delegate :my_zone, :to => :source, :allow_nil => true | |||
|
|||
def my_task_id | |||
"#{self.class.base_model.name.underscore}_#{id}" | |||
"r#{miq_request_id}_#{self.class.base_model.name.underscore}_#{id}" |
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.
@pkomanek Can my_task_id be changed to tracking_id or tracking_label_id? the my_task_id function conflicts with MiqTask. If its used outside of here maybe we could add an alias.
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.
Agreed, I mentioned this on the call this morning. Need to check if it is used elsewhere, but this seems like a good refactoring.
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.
@pkomanek Besides changing the name of the my_task_id method, it looks good. This change is awesome and is going to make debugging customer provisioning issues so much easier.
app/models/miq_request.rb
Outdated
@@ -398,7 +398,7 @@ def execute | |||
:method_name => "create_request_tasks", | |||
:zone => options.fetch(:miq_zone, my_zone), | |||
:role => my_role, | |||
:tracking_label => "#{self.class.name.underscore}_#{id}", | |||
:tracking_label => "#{self.class.name.underscore}_r#{id}", |
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.
This should be moved into a tracking_label_id
method like we do for the task. It can live in the miq_request.rb
file.
The code changes look good. Still would like to review the concept with @jcarter12 and @math3matical to get their feedback before merging. |
ping @jcarter12 @math3matical Look good to you? |
@kbrock @jcarter12 and @math3matical are good with the changes. Because this is an important change, I've reached out to the field for feedback and expect to hear back shortly. |
@pkomanek We requested community feedback because this is a really important change. One great suggestion we'd like to implement is add the tracking label to the request line as well: after: Can you implement this change? |
@@ -126,7 +127,7 @@ def service_resource_id(index, scaling_max) | |||
:method_name => 'execute', | |||
:role => 'ems_operations', | |||
:zone => 'a_zone', | |||
:tracking_label => "service_template_provision_task_#{@task_0.id}", | |||
:tracking_label => "r#{@request.id}_service_template_provision_task_#{@task_0.id}", |
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.
You can de-dup this tracking_label string by adding it to a let block. I'd recommend placing it just above the def create_stp
define.
let(:tracking_label) { "r#{@request.id}_service_template_provision_task_#{@task_0.id}" }
Then the two expect(MiqQueue)
methods change to use :tracking_label => tracking_label
Checked commits pkomanek/manageiq@fbeab34~...5fb68f7 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@tinaafitz PTAL |
@pkomanek Can you update the screen shot to reflect the request log changes? |
@tinaafitz sure, is it ok? |
@pkomanek Looks great. :-) |
We are adding the letter
r
plusrequest_id
as a prefix oftracking_label
. With this change we are able to find all related tasks in the log by a single request_id.https://bugzilla.redhat.com/show_bug.cgi?id=1535229
Logs:
before:
after:
filter command: grep "Q-task_id(\[.*\])" log/evm.log