-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 ability to send success notifications on webhook #5517
🎉 add ability to send success notifications on webhook #5517
Conversation
final String messageFormat = "Hello World! This is a test from Airbyte to try %s notification settings for sync %s"; | ||
final boolean failureNotified = notificationClient.notifyFailure(String.format(messageFormat, notification.getNotificationType(), "failures")); | ||
final boolean successNotified = notificationClient.notifySuccess(String.format(messageFormat, notification.getNotificationType(), "successes")); | ||
if (failureNotified || successNotified) { |
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 endpoint is called for testing when editing the workspace settings (not a real sync notification)
Do we really need to send both success and failure (two notifications) as tests to try if the webhook works?
Only one "test" notification should be enough since they are using the same webhook URL and only differs in the messaging?
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.
I do not have strong preference. Only reasoning I had was the flags control success and/or failure notifications so it seemed right to send both if both are enabled and send one or other if only one of them (or none if none of them) is enabled.
If you feel strongly, I can drop one. Let me know.
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.
@prasrvenkat thank you for this PR! We really appreciate you digging into so many pieces of our system to put this together. I'm definitely happy to work with you to get this merged!
Here's the plan.
- I left a few comments throughout the PR. LMK if anything doesn't make sense. I think there is only one significant change that I am suggesting around the data model.
- I tried to address some of the questions you left in the PR body below. Again, lmk if anything doesn't make sense!
- After we iterate one more time, I'll loop in our FE guy to help out with the refreshing issue you mentioned.
Ability in front-end to toggle both on/off. I am not that familiar with frontend in general, but tried to get a working solution.
The toggle is not auto-save, its tied to the current formik form so reflects only after save changes.
@jamakase can you take a look at the FE change in this PR and leave any feedback please?
The call site for successful notification is in JobSubmitter after finishing something that is a success. Let me know if this not the right place. Ideally, I thought notification will be downstream option after tracking but there was a notifier already available there so re-used it.
I agree with your assessment that this is not the ideal place. We want to change it so that the notifier happens from within a Temporal Activity. That being said, I think what you have done for now is a good compromise and we can move the call site in the future. So let's stick with what you have!
Migration test was failing so I had to add one, let me know if that is fine, especially the version
That looks right to me! I will re-review after you address some of the data model comments.
Thanks again!
airbyte-migration/src/main/java/io/airbyte/migrate/migrations/MigrationV0_30_0.java
Show resolved
Hide resolved
airbyte-config/models/src/main/resources/types/SlackNotificationConfiguration.yaml
Outdated
Show resolved
Hide resolved
airbyte-migration/src/test/java/io/airbyte/migrate/migrations/MigrateV0_30_0Test.java
Outdated
Show resolved
Hide resolved
db9bc2c
to
2daf991
Compare
Thanks for detailed review, appreciate it. I reworked based on your comment. Let me know what you think @cgardens. |
2daf991
to
f23a84f
Compare
airbyte-webapp/src/pages/SettingsPage/pages/NotificationPage/components/WebHookForm.tsx
Outdated
Show resolved
Hide resolved
airbyte-webapp/src/pages/SettingsPage/pages/NotificationPage/components/WebHookForm.tsx
Outdated
Show resolved
Hide resolved
airbyte-webapp/src/pages/SettingsPage/pages/NotificationPage/components/WebHookForm.tsx
Outdated
Show resolved
Hide resolved
airbyte-webapp/src/pages/SettingsPage/pages/NotificationPage/components/WebHookForm.tsx
Outdated
Show resolved
Hide resolved
airbyte-webapp/src/pages/SettingsPage/pages/NotificationPage/components/WebHookForm.tsx
Outdated
Show resolved
Hide resolved
airbyte-webapp/src/pages/SettingsPage/pages/NotificationPage/NotificationPage.tsx
Outdated
Show resolved
Hide resolved
airbyte-webapp/src/pages/SettingsPage/pages/NotificationPage/NotificationPage.tsx
Outdated
Show resolved
Hide resolved
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.
@prasrvenkat thank you! the changes you made on the backend look good to me.
Once you are done iterating on @jamakase 's feedback on the frontend part, I will help you merge this.
My overall comment is next: is it actually a good idea to extend notifications interface for every new state we want to add? Is it possible that in the future, we may want to add more types of events on which we notify like |
If you are talking about toggles then we need individual states if we want to allow that level of control for all such states in notifications. |
airbyte-webapp/src/pages/SettingsPage/pages/NotificationPage/components/WebHookForm.tsx
Outdated
Show resolved
Hide resolved
airbyte-webapp/src/pages/SettingsPage/pages/NotificationPage/components/WebHookForm.tsx
Outdated
Show resolved
Hide resolved
@prasrvenkat could you resolve the conflicts? After that we can start the process of merging this! thanks a lot |
Co-authored-by: Christophe Duong <christophe.duong@gmail.com>
Co-authored-by: Charles <giardina.charles@gmail.com>
d5a655f
to
0e1fcf1
Compare
@marcosmarxm Done, let me know if anything else needs to be fixed. Thanks |
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.
@prasrvenkat Awesome! This looks like it is ready to go. I am running the acceptance tests on this branch now. Once they are done I will merge.
Thanks for your patience. I was on vacation last week which is why review was postponed.
Sounds good, thanks! |
Thank you @prasrvenkat. This is a great new feature! |
🎉 |
This is a file based migration, which will mess up our database migration. It needs to be replaced with a Flyway migration. |
Is there a way I can update the webhook config programatically ( without going to setting and updating manually) ? |
It is part of the workspace so you can check that endpoint in APIs. I don't think a specific endpoint exists just for updating notification afaik. |
the web hook doesn't work if endpoint is localhost or 0.0.0.0. it works if i set up my service with tools like ngrok. |
What
Ability to get notified on successful sync as well. This makes the success/failure notifications configurable with toggle on the webhook settings page. This is based on #2706 and will fix #4519
How
sendOnSuccess
andsendOnFailure
to indicate whether to send notification on success and/or failure.true
forsendOnFailure
andfalse
forsendOnSuccess
to keep it same as current behavior.formik
form so reflects only after save changes.JobSubmitter
after finishing something that is a success. Let me know if this not the right place. Ideally, I thought notification will be downstream option after tracking but there was a notifier already available there so re-used it.Recommended reading order
Common
config.yaml
andSlackNotificationConfiguration.yaml
for reviewing the new boolean toggles.Backend
NotificationClient.java
to see methods to notify success and failure separately.JobNotifier.java
to see handling success/failure job notifications properly, especially the updated time handling.JobSubmitter.java
to see call-site for invokingJobNotifier
on successful job completion.Migrations
and the new migration added.Frontend
WehbhookForm
changesPre-merge Checklist
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
docs/SUMMARY.md
docs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampledocs/integrations/README.md
airbyte-integrations/builds.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing./publish
command described hereUpdating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
docs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing./publish
command described hereConnector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changes