Skip to content

Commit

Permalink
feat: fix prometheus remove file (#31)
Browse files Browse the repository at this point in the history
* feat/prometheus_delete_bug_fix:fix prometheus file delete behaviour with the issue of etcd watch delete event not provide both key and value,which lead to file could not be deleted

* feat/prometheus_delete_bug_fix: add logger replacement
  • Loading branch information
lzc1104 authored Sep 22, 2021
1 parent 66ca5fd commit 06faa54
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/proxy/regProxy/etcd/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@ func (d *DataSource) watchPrometheus(path string) {
xlog.Error("watchPrometheus", xlog.String("key", key), xlog.String("value", value))
break
}
if value == "" {
value = keyArr[len(keyArr) -1]
}
filename := keyArr[3] + "_" + value
_ = os.Remove(path + "/" + filename + ".yml")
filePath := path + "/" + filename + ".yml"
err = os.Remove(filePath)
if err != nil {
xlog.Error("remove prometheus file error",xlog.FieldErr(err))
}
case mvccpb.PUT:
key, value := string(event.Kv.Key), string(event.Kv.Value)
keyArr := strings.Split(key, "/")
Expand Down

0 comments on commit 06faa54

Please sign in to comment.