code refactor notify (#1066)
This commit is contained in:
parent
17c7361620
commit
0bd7ba9549
|
@ -7,13 +7,6 @@ import (
|
||||||
"github.com/tidwall/gjson"
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
// the caller can be called for alerting notify by complete this interface
|
|
||||||
type inter interface {
|
|
||||||
Descript() string
|
|
||||||
Notify([]byte)
|
|
||||||
NotifyMaintainer([]byte)
|
|
||||||
}
|
|
||||||
|
|
||||||
// N9E complete
|
// N9E complete
|
||||||
type N9EPlugin struct {
|
type N9EPlugin struct {
|
||||||
Name string
|
Name string
|
||||||
|
@ -48,6 +41,6 @@ func (n *N9EPlugin) NotifyMaintainer(bs []byte) {
|
||||||
// will be loaded for alertingCall , The first letter must be capitalized to be exported
|
// will be loaded for alertingCall , The first letter must be capitalized to be exported
|
||||||
var N9eCaller = N9EPlugin{
|
var N9eCaller = N9EPlugin{
|
||||||
Name: "N9EPlugin",
|
Name: "N9EPlugin",
|
||||||
Description: "Notification by lib",
|
Description: "Notify by lib",
|
||||||
BuildAt: time.Now().Local().Format("2006/01/02 15:04:05"),
|
BuildAt: time.Now().Local().Format("2006/01/02 15:04:05"),
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"runtime"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/didi/nightingale/v5/src/models"
|
"github.com/didi/nightingale/v5/src/models"
|
||||||
|
@ -25,11 +24,6 @@ func notifyMaintainerWithPlugin(e error, title, triggerTime string, users []*mod
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
logger.Errorf("call notify plugin on unsupported os: %s", runtime.GOOS)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
stdinBytes, err := json.Marshal(MaintainMessage{
|
stdinBytes, err := json.Marshal(MaintainMessage{
|
||||||
Tos: users,
|
Tos: users,
|
||||||
Title: title,
|
Title: title,
|
||||||
|
|
Loading…
Reference in New Issue