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

Add event recorder for ISBService, Pipeline and NumaflowController Rollout #173

Merged
merged 3 commits into from
Aug 14, 2024

Conversation

chandankumar4
Copy link
Contributor

Fixes #153

Modifications

  • Record event for ISBServiceRollout, PipelineRollout and NumaflowControllerRollout

Verification

@@ -143,12 +153,14 @@ func (r *ISBServiceRolloutReconciler) Reconcile(ctx context.Context, req ctrl.Re
statusUpdateErr := r.updateISBServiceRolloutStatus(ctx, isbServiceRollout)
if statusUpdateErr != nil {
r.customMetrics.ISBServicesSyncFailed.WithLabelValues().Inc()
r.recorder.Eventf(isbServiceRollout, corev1.EventTypeWarning, "StatusUpdateFailed", "Failed to update isb service rollout status: %v", err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe the ISBServicesSyncFailed metric, the Event, and possibly the logging of the error should all go into one function?

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 don't think it's valid for cases, like here logger is not available

Copy link
Collaborator

Choose a reason for hiding this comment

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

How do you mean that logger isn't available there? It's always available. If it's a function which is sort of at the top of the stack in our code we call logger.GetBaseLogger() like we do in that function here. Otherwise, we call logger.FromContext(ctx) to get the logger.

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 mean, Currently we are not logging the error here and if we have a separate fn which will log error as well then we might get duplicate log as it's returning the error from here so parent fn will also print that error. if that's okay then I'll make the change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we always returning an error from Reconcile() - I'm curious if doing so results in an error being logged by the controller-runtime framework. It seems to me like it does. In that case, we could remove where we are explicitly logging because the framework does it anyway. Then this function could just write the Event and write the metric.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make the changes accordingly

@chandankumar4 chandankumar4 changed the title Add event recorder for isb service Add event recorder for ISBServiceRollout, PipelineRollout and NumaflowControllerRollout Aug 14, 2024
@chandankumar4 chandankumar4 changed the title Add event recorder for ISBServiceRollout, PipelineRollout and NumaflowControllerRollout Add event recorder for ISBService, Pipeline and NumaflowController Rollout Aug 14, 2024
@chandankumar4 chandankumar4 marked this pull request as ready for review August 14, 2024 08:16
Signed-off-by: chandankumar4 <[email protected]>
@chandankumar4 chandankumar4 merged commit 3d65e31 into numaproj:main Aug 14, 2024
5 checks passed
@chandankumar4 chandankumar4 deleted the event branch August 16, 2024 07:02
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.

Emit K8s events for major events
2 participants