Created
December 20, 2012 14:24
-
-
Save ajcronk/4345560 to your computer and use it in GitHub Desktop.
TempoDB .NET read and write samples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new Client.ClientBuilder() | |
.Key("your-api-key") | |
.Secret("your-api-secret") | |
.Build(); | |
static DateTime startDate = new DateTime(2012, 1, 1); | |
static DateTime endDate = new DateTime(2013, 1, 1); | |
static string seriesKey = "test-key" | |
/* | |
read one series | |
returns DataSet | |
https://github.com/tempodb/tempodb-net/blob/master/Client/Model/DataSet.cs | |
*/ | |
var dataSet = client.ReadByKey(seriesKey, startDate, endDate) | |
/* | |
read multiple series | |
returns IList<DataSet> | |
https://github.com/tempodb/tempodb-net/blob/master/Client/Model/DataSet.cs | |
*/ | |
var filter = new Filter(); | |
filter.AddKey(seriesKey); | |
//filter.AddKey("another-key") | |
var multipleDataSets = client.ReadMultipleSeries(startDate, endData, filter); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new Client.ClientBuilder() | |
.Key("your-api-key") | |
.Secret("your-api-secret") | |
.Build(); | |
static DateTime startDate = new DateTime(2012, 1, 1); | |
static DateTime endDate = new DateTime(2013, 1, 1); | |
static string seriesKey = "test-key" | |
var points = new List<Client.Model.DataPoint>(); | |
var r = new Random(); | |
var date = startdate; | |
while (date < endDate) | |
{ | |
points.Add(new Client.Model.DataPoint(date, r.NextDouble() * 100)); | |
date = date.AddMinutes(10); | |
} | |
client.WriteByKey(seriesKey, points); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment