WriteAsync() public method

public WriteAsync ( LineProtocolPayload payload, CancellationToken cancellationToken = default(CancellationToken) ) : Task
payload InfluxDB.LineProtocol.Payload.LineProtocolPayload
cancellationToken System.Threading.CancellationToken
return Task
コード例 #1
0
        private void Send_InfluxDB_EDMS()
        {
            InfluxDB.LineProtocol.Client.LineProtocolClient client =
                new InfluxDB.LineProtocol.Client.LineProtocolClient(new Uri("http://127.0.0.1:8086"), "gravureprint");
            InfluxDB.LineProtocol.Payload.LineProtocolPayload payload =
                new InfluxDB.LineProtocol.Payload.LineProtocolPayload();

            if (distance > 100)
            {
                distance = 0;
            }
            _field.Clear();
            _tags.Clear();
            _tags["model"] = "model123";
            _tags["lot"]   = "lot123";

            var    val  = distance > 10 ? distance % 10 : distance;
            double dval = (double)val / 10.0;

            _field["distance"]  = dval;
            _field["variation"] = dval;
            var data = new InfluxDB.LineProtocol.Payload.LineProtocolPoint("edms", Fields, Tags);

            payload.Add(data);
            client.WriteAsync(payload);
        }
コード例 #2
0
        private void Send_InfluxDB_RVMS()
        {
            InfluxDB.LineProtocol.Client.LineProtocolClient client =
                new InfluxDB.LineProtocol.Client.LineProtocolClient(new Uri("http://127.0.0.1:8086"), "gravureprint");
            InfluxDB.LineProtocol.Payload.LineProtocolPayload payload =
                new InfluxDB.LineProtocol.Payload.LineProtocolPayload();

            if (distance > 100)
            {
                distance = 0;
            }
            _field.Clear();
            _tags.Clear();
            _tags["model"] = "model123";
            _tags["lot"]   = "lot123";


            var    val  = distance > 10 ? distance % 10 : distance;
            double dval = (double)val / 10.0;


            _field["distance"] = dval;
            _field["left"]     = dval;
            _field["right"]    = dval;

            var data = new InfluxDB.LineProtocol.Payload.LineProtocolPoint("rvms", Fields, Tags);

            payload.Add(data);
            Task <LineProtocolWriteResult> influxResult = client.WriteAsync(payload);

            if (!influxResult.Result.Success)
            {
                Debug.Print("▶--RVMS--" + influxResult.Result.ErrorMessage + "...\n");
            }
        }