未验证 提交 a1c47b7c 编写于 作者: M matao3754 提交者: GitHub

添加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: N马涛 <matao@staff.sina.com.cn>
上级 6c8e7b02
......@@ -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
......
此差异已折叠。
{"version":3,"file":"index-835a6df5e01917561f12.js","sources":["webpack:///index-835a6df5e01917561f12.js"],"mappings":"AAAA;;;;;;AA+wGA;;;;;;;AA2qqCA","sourceRoot":""}
\ No newline at end of file
此差异已折叠。
{"version":3,"file":"index-c6eeb66b35b8fd41c6bf.js","sources":["webpack:///index-c6eeb66b35b8fd41c6bf.js"],"mappings":"AAAA;;;;;;AA+wGA;;;;;;;AAmqqCA","sourceRoot":""}
\ No newline at end of file
<!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>
\ No newline at end of file
<!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>
\ No newline at end of file
......@@ -38,15 +38,15 @@ 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)
}
if u.Phone != "" && !str.IsPhone(u.Phone) {
errors.Bomb("%s format error", u.Phone)
}
if u.Email != "" && !str.IsMail(u.Email) {
errors.Bomb("%s format error", u.Email)
}
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,9 +74,13 @@ 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 {
continue
maskTagsList, exists = mcache.MaskCache.GetByKey(key)
if !exists {
continue
}
}
for i := 0; i < len(maskTagsList); i++ {
......
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
}
此差异已折叠。
......@@ -111,7 +111,7 @@ class CustomForm extends Component<Props> {
{getFieldDecorator('metric', {
initialValue: initialValues.metric,
rules: [
{ required: true },
{ required: false },
],
})(
<Input />,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册