-
Notifications
You must be signed in to change notification settings - Fork 0
/
tempodb_client_example.cpp
44 lines (30 loc) · 1.22 KB
/
tempodb_client_example.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "tempodb/Client.h"
#include <boost/network/message.hpp>
#include <iostream>
typedef TempoDB::Series Series;
int main(int argc, char *argv[]) {
TempoDB::Client client("4bf5848729ad400cb63774abc7aa32fa", "5c65b7c5bddb4b8c9400f012f59f357d", "http://api-staging.tempo-db.com");
// std::vector<Series> slist = client.listSeries();
// std::cout << "Printing: " << slist.size() << std::endl;
// for(int i = 0; i < slist.size(); i++)
// {
// std::cout << slist[i].toString() << std::endl;
// }
// std::cout << std::endl;
// Series sbykey = client.getSeriesByKey("demo-series");
// std::cout << sbykey.toString() << std::endl;
Series s = client.getSeries("38f7efc590364368a8732427d6e838ba");
std::cout << s.toJson() << std::endl;
// for(int i = 0; i < s.tags.size(); i++)
// std::cout << s.tags[i] << std::endl;
// for(MapSS::iterator ci = s.attributes.begin(); ci != s.attributes.end(); ++ci)
// std::cout << ci->first << " : " << ci->second << std::endl;
s.tags.push_back("tag3");
std::cout << s.toJson() << std::endl;
try {
Series s2 = client.updateSeries(s);
std::cout << s2.toJson() << std::endl;
}
catch (std::exception & e) { std::cerr << e.what() << std::endl; }
return 0;
}