public PostPointAsync ( string dbName, IInfluxDatapoint point ) : Task |
||
dbName | string | InfluxDB database name |
point | IInfluxDatapoint | Influx data point to be written |
리턴 | Task |
public async Task TestPostPointAsync_InvalidReq() { var client = new InfluxDBClient (influxUrl, dbUName, dbpwd); var time = DateTime.Now; var today = DateTime.Now.ToShortDateString (); var now = DateTime.Now.ToShortTimeString (); var valDouble = new InfluxDatapoint<double> (); valDouble.UtcTimestamp = DateTime.UtcNow; valDouble.Tags.Add ("TestDate", today); valDouble.Tags.Add ("TestTime", now); valDouble.Fields.Add ("Doublefield", DataGen.RandomDouble ()); valDouble.Fields.Add ("Doublefield2", Double.NaN); valDouble.MeasurementName = measurementName; valDouble.Precision = TimePrecision.Seconds; var r = await client.PostPointAsync (dbName, valDouble); Assert.IsTrue (r, "PostPointsAsync retunred false"); }
public async Task TestPostStringPointAsync() { try { var client = new InfluxDBClient (influxUrl, dbUName, dbpwd); var time = DateTime.Now; var valString = new InfluxDatapoint<string> (); valString.UtcTimestamp = DateTime.UtcNow; valString.Tags.Add ("TestDate", time.ToShortDateString ()); valString.Tags.Add ("TestTime", time.ToShortTimeString ()); valString.Fields.Add ("Stringfield", @"j0,Oox7ju6lJvA0\");//DataGen.RandomString ()); valString.MeasurementName = measurementName; valString.Precision = TimePrecision.Seconds; var r = await client.PostPointAsync (dbName, valString); Assert.IsTrue (r, "PostPointAsync retunred false"); } catch ( Exception e ) { Assert.Fail ("Unexpected exception of type {0} caught: {1}", e.GetType (), e.Message); return; } }
public async Task TestPostBooleanPointAsync() { try { var client = new InfluxDBClient (influxUrl, dbUName, dbpwd); var time = DateTime.Now; var valBool = new InfluxDatapoint<bool> (); valBool.UtcTimestamp = DateTime.UtcNow; valBool.Tags.Add ("TestDate", time.ToShortDateString ()); valBool.Tags.Add ("TestTime", time.ToShortTimeString ()); valBool.Fields.Add ("Booleanfield", time.Ticks % 2 == 0); valBool.MeasurementName = measurementName; valBool.Precision = TimePrecision.Seconds; var r = await client.PostPointAsync (dbName, valBool); Assert.IsTrue (r, "PostPointAsync retunred false"); } catch ( Exception e ) { Assert.Fail ("Unexpected exception of type {0} caught: {1}", e.GetType (), e.Message); return; } }
public async Task TestPostDoublePointAsync() { try { var client = new InfluxDBClient (influxUrl, dbUName, dbpwd); var time = DateTime.Now; var rand = new Random (); var valDouble = new InfluxDatapoint<double> (); valDouble.UtcTimestamp = DateTime.UtcNow; valDouble.Tags.Add ("TestDate", time.ToShortDateString ()); valDouble.Tags.Add ("TestTime", time.ToShortTimeString ()); valDouble.Fields.Add ("Doublefield", rand.NextDouble ()); valDouble.Fields.Add ("Doublefield2", rand.NextDouble ()); valDouble.MeasurementName = measurementName; valDouble.Precision = TimePrecision.Seconds; var r = await client.PostPointAsync (dbName, valDouble); Assert.IsTrue (r, "PostPointAsync retunred false"); } catch ( Exception e ) { Assert.Fail ("Unexpected exception of type {0} caught: {1}", e.GetType (), e.Message); return; } }