Browse Source

update 修改主题数据存储 influxDB格式 保持和山东省院的一致 避免聚集进程等问题

dev
lucas 4 months ago
parent
commit
2c482c966f
  1. 9
      storage/storageDBs/storage2Es.go
  2. 2
      storage/storageDBs/storage2InfluxDB.go

9
storage/storageDBs/storage2Es.go

@ -69,8 +69,7 @@ func (the *Storage2Es) SaveRaw(dataList []common_models.EsRaw) {
`, the.rawIndex, _id, source)
body.WriteString(s)
}
//the.esHelper.BulkWrite(the.rawIndex, body.String())
newEsHelper().BulkWrite(the.rawIndex, body.String())
the.esHelper.BulkWrite(the.rawIndex, body.String())
}
func (the *Storage2Es) SaveTheme(dataList []common_models.EsTheme) {
@ -90,8 +89,7 @@ func (the *Storage2Es) SaveTheme(dataList []common_models.EsTheme) {
`, the.themeIndex, _id, source)
body.WriteString(s)
}
//the.esHelper.BulkWrite(the.themeIndex, body.String())
newEsHelper().BulkWrite(the.themeIndex, body.String())
the.esHelper.BulkWrite(the.themeIndex, body.String())
}
func (the *Storage2Es) SaveVib(dataList []common_models.EsVbRaw) {
body := strings.Builder{}
@ -105,8 +103,7 @@ func (the *Storage2Es) SaveVib(dataList []common_models.EsVbRaw) {
`, the.vibIndex, _id, source)
body.WriteString(s)
}
//the.esHelper.BulkWrite(the.vibIndex, body.String())
newEsHelper().BulkWrite(the.vibIndex, body.String())
the.esHelper.BulkWrite(the.vibIndex, body.String())
}
// SaveGroupTheme 分组主题数据写入ES

2
storage/storageDBs/storage2InfluxDB.go

@ -90,7 +90,7 @@ func (the *Storage2InfluxDB) SaveTheme(dataList []common_models.EsTheme) {
}
fields := transform.Obj2mapStr(d.Data)
line := fmt.Sprintf("%d %s %d", d.Sensor, fields, d.CollectTime.UnixNano())
line := fmt.Sprintf("factor_%d,sensor_id=%d %s %d", d.Factor, d.Sensor, fields, d.CollectTime.UnixNano())
sb = append(sb, line)
}
the.influxDBHelper.Write(sb, the.themeBucket)

Loading…
Cancel
Save