Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add prewebhook and cronitor telemetry integration #1099

Merged
merged 2 commits into from
May 6, 2022
Merged

Conversation

vcastellm
Copy link
Member

@vcastellm vcastellm commented Apr 26, 2022

Prewebhook configuration will behave the same as Webhook but will be run before running the job.

We're integrating with Cronitor service for advanced monitoring.

@vcastellm vcastellm requested a review from yvanoers April 26, 2022 20:24
dkron/grpc.go Outdated
@@ -237,7 +237,7 @@ func (grpcs *GRPCServer) ExecutionDone(ctx context.Context, execDoneReq *proto.E
}

// Send notification
if err := Notification(grpcs.agent.config, execution, exg, job).Send(grpcs.logger); err != nil {
if err := NewNotifier(grpcs.agent.config, execution, exg, job, grpcs.logger).End(); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

.Start() and .End() initially confused me; I thought End() was supposed to be called on the same notification object as Start(). But it isn't, they're not related.
I suggest renaming these to something like SendPreNotifications and SendPostNotifications.
Or maybe, instead of one constructor-method, have two methods taking appropriate arguments (saves the nil arg to be passed when sending the prehooks) that initialize and immediately send:

if err:= SendPostNotifications(grpcs.agent.config, execution, exg, job, grpcs.logger); err != nil { etc

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, makes much more sense, I tried to maintain the legacy interface but wasn't a good idea, refactored to these recommendations.

@vcastellm vcastellm requested a review from yvanoers May 4, 2022 21:30
Copy link
Collaborator

@yvanoers yvanoers left a comment

Choose a reason for hiding this comment

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

LGTM!

@vcastellm vcastellm merged commit 5419221 into master May 6, 2022
@vcastellm vcastellm deleted the prehook branch May 6, 2022 06:24
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants