排查max push log 的时候id不唯一
This commit is contained in:
parent
23ee3859ae
commit
ad59188d50
16
maX.go
16
maX.go
@ -18,6 +18,7 @@ type MaXList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MaX struct {
|
type MaX struct {
|
||||||
|
Id string `json:"_id"`
|
||||||
InstID string `json:"instID"`
|
InstID string `json:"instID"`
|
||||||
Period string `json:"period"`
|
Period string `json:"period"`
|
||||||
Timestamp time.Time `json:"timestamp"`
|
Timestamp time.Time `json:"timestamp"`
|
||||||
@ -96,21 +97,12 @@ func (mx *MaX) PushToWriteLogChan(cr *Core) error {
|
|||||||
s := strconv.FormatFloat(float64(mx.Ts), 'f', 0, 64)
|
s := strconv.FormatFloat(float64(mx.Ts), 'f', 0, 64)
|
||||||
did := mx.InstID + "|" + mx.Period + "|" + s
|
did := mx.InstID + "|" + mx.Period + "|" + s
|
||||||
logrus.Debug("did of max:", did)
|
logrus.Debug("did of max:", did)
|
||||||
mx0 := MaX{}
|
|
||||||
mx0.InstID = mx.InstID
|
|
||||||
mx0.Period = mx.Period
|
|
||||||
mx0.KeyName = mx.KeyName
|
|
||||||
mx0.Count = mx.Count
|
|
||||||
mx0.Ts = mx.Ts
|
|
||||||
mx0.AvgVal = mx.AvgVal
|
|
||||||
mx0.LastUpdate = mx.LastUpdate
|
|
||||||
mx0.Timestamp = mx.Timestamp
|
|
||||||
hs := HashString(did)
|
hs := HashString(did)
|
||||||
md, _ := json.Marshal(mx0)
|
mx.Id = hs
|
||||||
mx = &mx0
|
md, _ := json.Marshal(mx)
|
||||||
wg := WriteLog{
|
wg := WriteLog{
|
||||||
Content: md,
|
Content: md,
|
||||||
Tag: "sardine.log.maX." + mx0.Period,
|
Tag: "sardine.log.maX." + mx.Period,
|
||||||
Id: hs,
|
Id: hs,
|
||||||
}
|
}
|
||||||
cr.WriteLogChan <- &wg
|
cr.WriteLogChan <- &wg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user