From 2c482c966f68842cfb616decd3091043b0f31fef Mon Sep 17 00:00:00 2001 From: lucas Date: Thu, 26 Sep 2024 11:32:54 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BF=AE=E6=94=B9=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AD=98=E5=82=A8=20influxDB=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=20=E4=BF=9D=E6=8C=81=E5=92=8C=E5=B1=B1=E4=B8=9C?= =?UTF-8?q?=E7=9C=81=E9=99=A2=E7=9A=84=E4=B8=80=E8=87=B4=20=20=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E8=81=9A=E9=9B=86=E8=BF=9B=E7=A8=8B=E7=AD=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- storage/storageDBs/storage2Es.go | 9 +++------ storage/storageDBs/storage2InfluxDB.go | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/storage/storageDBs/storage2Es.go b/storage/storageDBs/storage2Es.go index f0b150e..fb18f91 100644 --- a/storage/storageDBs/storage2Es.go +++ b/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 diff --git a/storage/storageDBs/storage2InfluxDB.go b/storage/storageDBs/storage2InfluxDB.go index b60b8f0..9d62fb4 100644 --- a/storage/storageDBs/storage2InfluxDB.go +++ b/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)