dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[Feature-14839][Alert]Add Webhook Alert Plugin to support Enterprise WeChat notifications by robot

Open ahuljh opened this issue 1 year ago • 18 comments

Add Webhook Alert Plugin to support Enterprise WeChat notifications by robot close #14839

Purpose of the pull request

The purpose of this PR is to support Enterprise WeChat notifications by robot. This pull request adds webhook alert plugin.

Brief change log

  • Add dolphinscheduler-alert-webhook to the module dolphinscheduler-alert-plugins.
  • Add classes on which alarms rely, including WebHookSender, WebHookAlertChannel, WebHookAlertChannelFactory, WebHookAlertConstants, and WebHookAlertMessage.
  • Modify the pom.xml file of the dolphinscheduler alert plugins module.
  • Add pom.xml file for dolphinscheduler alert webhook module and introduce corresponding dependencies
  • Write test classes and methods required for message sending.

Verify this pull request

This pull request is code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(or)

If your pull request contain incompatible change, you should also add it to docs/docs/en/guide/upgrede/incompatible.md

ahuljh avatar Sep 02 '23 01:09 ahuljh

Hi @ahuljh Please add the documents of this new feature.

caishunfeng avatar Sep 02 '23 15:09 caishunfeng

Hi @ahuljh Please add the documents of this new feature.

Thank you for your reminder. I will supplement the guidance document, verify the code is correct, and then upload it again. After all have been uploaded, I will remind you to check again. Thanks.

ahuljh avatar Sep 03 '23 00:09 ahuljh

Hi @ahuljh Please add the documents of this new feature.

Hi @caishunfeng The documents and code have been supplemented and verified. Could you please continue with the merge process? Thanks.

ahuljh avatar Sep 03 '23 13:09 ahuljh

About this feature, we already have http and wechat plugin, this webhook looks like another way to use wechat by HTTP. How about we modify HTTP plugin and add a simple way to use HTTP, the same as just a HTTP URL or we modify wechat plugin to support this way?

qingwli avatar Sep 04 '23 01:09 qingwli

image And wechat webhook can @ someone, maybe we modify wechat plugin is better

qingwli avatar Sep 04 '23 02:09 qingwli

image And wechat webhook can @ someone, maybe we modify wechat plugin is better

In fact, we conducted an evaluation before adding the webhook plugin, and if we add the webhook method to the wechat plugin, the Secret and CropId options will be redundant and cannot be adapted based on this. If using the Http plugin, it is necessary to modify the source code of the Http plugin, which will affect the use of other alerts through HTTP. After a comprehensive decision, we have decided to add the Webhook method. This is also the cheapest way.

ahuljh avatar Sep 04 '23 03:09 ahuljh

Hi, @qingwli I will consider adding options for @ everyone and @ designated person. If additional options are needed, I will resubmit the Pull Request. In addition, the goal of this webhook plugin is to adapt to various platforms, not just enterprise WeChat. This plugin will adapt to various other places that require alerting through webhook. Thank you for your suggestion.

ahuljh avatar Sep 04 '23 03:09 ahuljh

About Wechat plugin, we add a send type webhook and add an input field, let the Secret and CropId options not required is a good way? We can support two WeChat way and adapt pervious way

qingwli avatar Sep 04 '23 05:09 qingwli

About Wechat plugin, we add a send type webhook and add an input field, let the Secret and CropId options not required is a good way? We can support two WeChat way and adapt pervious way

By modifying WeChat plugins, you can also meet your desired needs for WeChat. But is it no longer supported for other places that require inputting webhooks. Through webhook plugin, it can be flexibly applied to other places, rather than just WeChat.

ahuljh avatar Sep 04 '23 05:09 ahuljh

About webhook plugin can support different webhook request, but like wechat have @ function, the field is not common in different webhook request, so it's different to be a common plugin if you add some config. If do that it's similar to HTTP plugin.

In my opinion, for ds we support so many plugins, and for any alert ways always have different request combinations, The root way is HTTP too, we just support usage way for easy use. And for user side, If I want to use wechat , I always click Wechat button not webhook. So I think we should enhance wechat plugin.

qingwli avatar Sep 04 '23 10:09 qingwli

Hi, @caishunfeng @zhongjiajie @EricGao888 My company has already used this method, and many people have this need. Do you think it is necessary to add webhook plugins to adapt to different platforms? Or is it to modify the WeChat plugin to only meet the needs of WeChat?

ahuljh avatar Sep 04 '23 11:09 ahuljh

cc @SbloodyS

qingwli avatar Sep 05 '23 01:09 qingwli

It's better to rename it to WeChat-webhook, rather than webhook. Not all webhooks can support markdown.

ruanwenjun avatar Sep 07 '23 10:09 ruanwenjun

It's better to rename it to WeChat-webhook, rather than webhook. Not all webhooks can support markdown.

Yes, your opinion is very good. I will rename the plugin this week.

ahuljh avatar Sep 08 '23 10:09 ahuljh

Expect my code to be quickly merged

ahuljh avatar Sep 08 '23 15:09 ahuljh

@caishunfeng @ruanwenjun plz run CI

fuchanghai avatar Sep 21 '23 03:09 fuchanghai

还没有合并吗?

ocean0551 avatar Jun 19 '24 05:06 ocean0551