feat: persist agent provider error details - #80
gabriel-farache wants to merge 2 commits into
Conversation
PR Summary by QodoPersist agent failure reasons and log provider diagnostics
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
084dd50 to
25d6d59
Compare
Signed-off-by: gabriel-farache <gfarache@redhat.com>
25d6d59 to
be3fd75
Compare
| if data.Details.ProviderError.Message != "" { | ||
| attrs = append(attrs, "provider_error_message", data.Details.ProviderError.Message) | ||
| } | ||
| slog.Error("agent reported error", attrs...) |
There was a problem hiding this comment.
This slog.Error runs before UpdateStatusFrom, so a superseded agent's error event logs "agent reported error" even though the transition is rejected. Better moving it after the applied check.
Also, an agent reporting a provider error is expected operation, not a control plane fault. What about using Warn so error-level monitoring stays focused on internal failures?
There was a problem hiding this comment.
I can use warn instead of error I am good with it
As for the log placement, I would like to keep it where it is as even if the transaction fail for some DB issue, the information is still important to be logged. Plus, moving the log statement out of the condition will require having a boolean to know if we need to log something.
I already rejected it from qodo: #80 (comment)
Is that OK if I leave the log statement where it currently is?
Signed-off-by: gabriel-farache <gfarache@redhat.com>
Narrow down from #78
Currently, the Control-Plane completely drops the error details it received from the agent (this was found when doing dcm-project/environment-agent#53) so the root cause is actually lost to the user and to the admin as well.
This PR:
Managing of the delete process to record the error is out of the scope of this PR, it may be addressed in a later one once the deletion process is unified
Changing the API to show the error to the user is also out of the scope of this PR