添加endpoint屏蔽,并且修改页面对应必填项,去除mcache不必要的锁
* 修改: go.mod 修改: go.sum 重命名: pub/index-c6eeb66b35b8fd41c6bf.css -> pub/index-835a6df5e01917561f12.css 新文件: pub/index-835a6df5e01917561f12.js 新文件: pub/index-835a6df5e01917561f12.js.map 删除: pub/index-c6eeb66b35b8fd41c6bf.js 删除: pub/index-c6eeb66b35b8fd41c6bf.js.map 修改: pub/index.html 修改: src/model/user.go 修改: src/modules/monapi/cron/mask.go 修改: src/modules/monapi/mcache/mask.go 修改: web/package-lock.json 修改: web/src/pages/Monitor/Silence/CustomForm.tsx * Update mask.go Co-authored-by: 马涛 <matao@staff.sina.com.cn>
This commit is contained in:
parent
6c8e7b024f
commit
a1c47b7ca3
1
go.mod
1
go.mod
|
@ -17,6 +17,7 @@ require (
|
|||
github.com/json-iterator/go v1.1.9
|
||||
github.com/mattn/go-isatty v0.0.12
|
||||
github.com/open-falcon/rrdlite v0.0.0-20200214140804-bf5829f786ad
|
||||
github.com/shirou/gopsutil v2.20.4+incompatible
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72
|
||||
github.com/spf13/viper v1.6.2
|
||||
github.com/stretchr/testify v1.4.0
|
||||
|
|
2
go.sum
2
go.sum
|
@ -280,6 +280,8 @@ github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrY
|
|||
github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=
|
||||
github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/shirou/gopsutil v2.20.4+incompatible h1:cMT4rxS55zx9NVUnCkrmXCsEB/RNfG9SwHY9evtX8Ng=
|
||||
github.com/shirou/gopsutil v2.20.4+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index-835a6df5e01917561f12.js","sources":["webpack:///index-835a6df5e01917561f12.js"],"mappings":"AAAA;;;;;;AA+wGA;;;;;;;AA2qqCA","sourceRoot":""}
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index-c6eeb66b35b8fd41c6bf.js","sources":["webpack:///index-c6eeb66b35b8fd41c6bf.js"],"mappings":"AAAA;;;;;;AA+wGA;;;;;;;AAmqqCA","sourceRoot":""}
|
|
@ -1 +1 @@
|
|||
<!doctype html><html><head><meta charset="UTF-8"><title>Nightingale</title><link rel="shortcut icon" href="/favicon.ico"><link href="/index-c6eeb66b35b8fd41c6bf.css" rel="stylesheet"></head><body><div id="react-content"></div><script src="/lib-033bee8514de110e36ef.dll.js"></script><script src="/index-c6eeb66b35b8fd41c6bf.js"></script></body></html>
|
||||
<!doctype html><html><head><meta charset="UTF-8"><title>Nightingale</title><link rel="icon" href="/favicon.ico"><link href="/index-835a6df5e01917561f12.css" rel="stylesheet"></head><body><div id="react-content"></div><script src="/lib-033bee8514de110e36ef.dll.js"></script><script src="/index-835a6df5e01917561f12.js"></script></body></html>
|
|
@ -38,7 +38,7 @@ func (u *User) CheckFields() {
|
|||
if str.Dangerous(u.Dispname) {
|
||||
errors.Bomb("dispname is dangerous")
|
||||
}
|
||||
|
||||
/*
|
||||
if u.Phone != "" && !str.IsPhone(u.Phone) {
|
||||
errors.Bomb("%s format error", u.Phone)
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func (u *User) CheckFields() {
|
|||
if u.Email != "" && !str.IsMail(u.Email) {
|
||||
errors.Bomb("%s format error", u.Email)
|
||||
}
|
||||
|
||||
*/
|
||||
if len(u.Username) > 32 {
|
||||
errors.Bomb("username too long")
|
||||
}
|
||||
|
|
|
@ -74,10 +74,14 @@ func IsMaskEvent(event *model.Event) bool {
|
|||
eventTagsList = append(eventTagsList, fmt.Sprintf("%s=%s", strings.TrimSpace(k), strings.TrimSpace(v)))
|
||||
}
|
||||
key := eventMetric + "#" + event.Endpoint
|
||||
maskTagsList, exists := mcache.MaskCache.GetByKey(key)
|
||||
endpointKey := "#" + event.Endpoint
|
||||
maskTagsList, exists := mcache.MaskCache.GetByKey(endpointKey)
|
||||
if !exists {
|
||||
maskTagsList, exists = mcache.MaskCache.GetByKey(key)
|
||||
if !exists {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
for i := 0; i < len(maskTagsList); i++ {
|
||||
tagsList := strings.Split(maskTagsList[i], ",")
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package mcache
|
||||
|
||||
import "sync"
|
||||
|
||||
// MaskCacheMap 给alarm用,判断告警事件是否被屏蔽
|
||||
// key是'${metric}#${endpoint},value是list,
|
||||
// 每一条是屏蔽策略中配置的tags,比如service=x,module=y
|
||||
type MaskCacheMap struct {
|
||||
sync.RWMutex
|
||||
Data map[string][]string
|
||||
}
|
||||
|
||||
|
@ -19,14 +16,10 @@ func NewMaskCache() *MaskCacheMap {
|
|||
}
|
||||
|
||||
func (mc *MaskCacheMap) SetAll(m map[string][]string) {
|
||||
mc.Lock()
|
||||
mc.Data = m
|
||||
mc.Unlock()
|
||||
}
|
||||
|
||||
func (mc *MaskCacheMap) GetByKey(key string) ([]string, bool) {
|
||||
mc.RLock()
|
||||
value, exists := mc.Data[key]
|
||||
mc.RUnlock()
|
||||
return value, exists
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -111,7 +111,7 @@ class CustomForm extends Component<Props> {
|
|||
{getFieldDecorator('metric', {
|
||||
initialValue: initialValues.metric,
|
||||
rules: [
|
||||
{ required: true },
|
||||
{ required: false },
|
||||
],
|
||||
})(
|
||||
<Input />,
|
||||
|
|
Loading…
Reference in New Issue