Influxdb bulk insert

hello guys :slight_smile:
I am using influxdb 2.0 and .net unity3d (flux client is not compatible with Unity and cannot be used.)

I trying to insert some lines (bulk insert) into InfluxDB this is my code

  for (i = 0; i < 100000; i++)
        {
            float posiRang_x = UnityEngine.Random.Range(100f, -100f);
            float posiRang_y = UnityEngine.Random.Range(100f, -100f);
            float posiRang_z = UnityEngine.Random.Range(-100f, 100f);

            //string[] first = line.Split('\x020');
            string pk = Guid.NewGuid().ToString("N");

            //pointData = "Point,NAME=TEST,ID=" + pk + " X=" + first[0] + ",Y=" + first[1] + ",Z=" + first[2] + "\n";
            //pointData = "Bulk_test_1t,NAME=TEST,ID=" + pk + " X=" + posiRang_x + ",Y=" + posiRang_y + ",Z=" + posiRang_z + "\n";
            pointData = "Bulk_test_NoId,NAME=TEST X=" + posiRang_x + ",Y=" + posiRang_y + ",Z=" + posiRang_z + " 1617583075000000000\n";

            data1.Add(pointData);

        }
        Debug.Log(i);
        var chlist = string.Join(" ", data1);
        Debug.Log(chlist);
        var data = new StringContent(chlist, Encoding.UTF8, "application/json");
        using (HttpResponseMessage response = await _httpClient.PostAsync(Url, data))
        {
            result = response.Content.ReadAsStringAsync().Result;
            Debug.Log(response.StatusCode);
            if ((int)response.StatusCode != 204)
            {
               Debug.Log(result.ToString());
            }
        }

Yet, when I do a count query in influxdb v2 UI, it shows that only the last line (count +1) was inserted.

Any idea on this?

  • I canโ€™t use flux client and library *

Thanks.