首页 > 编程语言 >C# InfluxDB批量插入

C# InfluxDB批量插入

时间:2022-08-24 17:55:48浏览次数:65  
标签:批量 插入 C# InfluxDB ran value var dt

Samples

for (int j = 0; j < 96; j++)//24*60/15
                           {
var dt = _endDateTime.AddMinutes(-j * 15).AddMilliseconds(ran.Next(1000));
var ts = (dt.Ticks - _startDateTime.Ticks) * 100L + ran.Next(1000000);
var value = Math.Round((ran.NextDouble() + ran.NextDouble() + 0.0313) * 100, 2);
list.Add(PointData.Measurement("tag_value")
.Tag($"tag_id_{dt.ToString("yyyy-MM")}", t)
.Field("val", value)
.Timestamp(ts, WritePrecision.Ns));//注意时间戳,有肯能数据丢失

}
 _helper.Write(write =>
{//批量插入
  write.WritePoints(list, "po", "se");
});

Source Code

Code

标签:批量,插入,C#,InfluxDB,ran,value,var,dt
From: https://www.cnblogs.com/wuhailong/p/16621050.html

相关文章