Add() public method

public Add ( LineProtocolPoint point ) : void
point LineProtocolPoint
return void
Ejemplo n.º 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);
        }
Ejemplo n.º 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");
            }
        }
        public void Emit(PointData[] points)
        {
            var payload = new LineProtocolPayload();

            foreach (var point in points)
            {
                payload.Add(new LineProtocolPoint(point.Measurement, point.Fields, point.Tags, point.UtcTimestamp));
            }

            var influxResult = _client.WriteAsync(payload).Result;
            if (!influxResult.Success)
                CollectorLog.WriteLine(influxResult.ErrorMessage);
        }
Ejemplo n.º 4
0
        private void Send_InfluxDB_Test()
        {
            Task <LineProtocolWriteResult> influxResult = null;

            try
            {
                InfluxDB.LineProtocol.Client.LineProtocolClient client =
                    new InfluxDB.LineProtocol.Client.LineProtocolClient(new Uri("http://127.0.0.1:8086"), "unieye");
                InfluxDB.LineProtocol.Payload.LineProtocolPayload payload =
                    new InfluxDB.LineProtocol.Payload.LineProtocolPayload();

                if (client == null)
                {
                    Debug.Print("@@@@@@@@@@@@@@@@@@@@@\n");
                }

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


                //var val = distance > 10 ? distance % 10 : distance;
                double val  = 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);

                //influxResult=client.WriteAsync(payload);

                //influxResult.Wait();
                //if (!influxResult.Result.Success)
                //    Console.Error.WriteLine(influxResult.Result.ErrorMessage);
            }
            catch (Exception e)
            {
                string    err = "";
                Exception er  = e;
                while (er.InnerException != null)
                {
                    err += er.Message + "\n";
                    er   = er.InnerException;
                }
                Debug.Print(err);
            }
            return;
            //influxResult.Wait();
            //await Task.WhenAll(influxResult);
            //var re = await influxResult;
            //if (!influxResult.Result.Success)
            //{
            //    //Debug.Print("▶-----------" + influxResult.ErrorMessage + "...\n");
            //}

            //var client = new LineProtocolClient(new Uri("http://my-server:8086"), "data");
            //var influxResult = await client.WriteAsync(payload);
            //if (!influxResult.Success)
            //    Console.Error.WriteLine(influxResult.ErrorMessage);
        }