Skip to content

Commit 1cf14e3

Browse files
author
Jeff Sabin
committed
Increased the version number to 2.3.0. Added roll-up documentation to the README.
1 parent 3d74656 commit 1cf14e3

File tree

2 files changed

+66
-34
lines changed

2 files changed

+66
-34
lines changed

README.md

+64-32
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ Sending metrics is done by using the MetricBuilder. You simply add a metric, the
1212
the data points.
1313

1414

15-
MetricBuilder builder = MetricBuilder.getInstance();
16-
builder.addMetric("metric1")
17-
.addTag("host", "server1")
18-
.addTag("customer", "Acme")
19-
.addDataPoint(System.currentTimeMillis(), 10)
20-
.addDataPoint(System.currentTimeMillis(), 30L);
15+
MetricBuilder builder = MetricBuilder.getInstance();
16+
builder.addMetric("metric1")
17+
.addTag("host", "server1")
18+
.addTag("customer", "Acme")
19+
.addDataPoint(System.currentTimeMillis(), 10)
20+
.addDataPoint(System.currentTimeMillis(), 30L);
2121
HttpClient client = new HttpClient("http://localhost:8080");
22-
Response response = client.pushMetrics(builder);
23-
client.shutdown();
22+
Response response = client.pushMetrics(builder);
23+
client.shutdown();
2424

2525
## Querying Data Points
2626

2727
Querying data points is similarly done by using the QueryBuilder class. A query requires a date range. The start date is
2828
required, but the end date defaults to NOW if not specified. The metric(s) that you are querying for is also required.
2929
Optionally, tags may be added to narrow down the search.
3030

31-
QueryBuilder builder = QueryBuilder.getInstance();
31+
QueryBuilder builder = QueryBuilder.getInstance();
3232
builder.setStart(2, TimeUnit.MONTHS)
3333
.setEnd(1, TimeUnit.MONTHS)
3434
.addMetric("metric1")
@@ -43,7 +43,7 @@ Querying metric tags is done by using the QueryTagBuilder class. A query require
4343
required, but the end date defaults to NOW if not specified. The metric(s) that you are querying for is also required.
4444
Optionally, tags may be added to narrow down the search.
4545

46-
QueryTagBuilder builder = QueryTagBuilder.getInstance();
46+
QueryTagBuilder builder = QueryTagBuilder.getInstance();
4747
builder.setStart(2, TimeUnit.MONTHS)
4848
.setEnd(1, TimeUnit.MONTHS)
4949
.addMetric("metric1")
@@ -55,45 +55,77 @@ Optionally, tags may be added to narrow down the search.
5555

5656
You can get a list of all metric names in KairosDB.
5757

58-
HttpClient client = new HttpClient("http://localhost:8080");
59-
GetResponse response = client.getMetricNames();
58+
HttpClient client = new HttpClient("http://localhost:8080");
59+
GetResponse response = client.getMetricNames();
6060

61-
System.out.println("Response Code =" + response.getStatusCode());
62-
for (String name : response.getResults())
61+
System.out.println("Response Code =" + response.getStatusCode());
62+
for (String name : response.getResults())
6363
{
64-
System.out.println(name);
64+
System.out.println(name);
6565
}
66-
client.shutdown();
66+
client.shutdown();
6767

6868
## Querying Tag Names
69+
6970
Similarly you can get a list of all tag names in KairosDB.
7071

71-
HttpClient client = new HttpClient("http://localhost:8080");
72-
GetResponse response = client.getTagNames();
72+
HttpClient client = new HttpClient("http://localhost:8080");
73+
GetResponse response = client.getTagNames();
7374

74-
System.out.println("response=" + response.getStatusCode());
75-
for (String name : response.getResults())
76-
{
77-
System.out.println(name);
78-
}
79-
client.shutdown();
75+
System.out.println("response=" + response.getStatusCode());
76+
for (String name : response.getResults())
77+
{
78+
System.out.println(name);
79+
}
80+
client.shutdown();
8081

8182
## Querying Tag Values
83+
8284
And a list of all tag values.
8385

84-
HttpClient client = new HttpClient("http://localhost:8080");
85-
GetResponse response = client.getTagValues();
86+
HttpClient client = new HttpClient("http://localhost:8080");
87+
GetResponse response = client.getTagValues();
8688

87-
System.out.println("response=" + response.getStatusCode());
88-
for (String name : response.getResults())
89+
System.out.println("response=" + response.getStatusCode());
90+
for (String name : response.getResults())
8991
{
90-
System.out.println(name);
92+
System.out.println(name);
9193
}
92-
client.shutdown();
93-
94+
client.shutdown();
95+
9496
## Create Roll-up Task
9597

98+
You can get of a list of roll-up tasks using the RollupBuilder.
99+
100+
RollupBuilder builder = RollupBuilder.getInstance("Metric1_rollupTask", new RelativeTime(1, TimeUnit.DAYS));
101+
Rollup rollup1 = builder.addRollup("metric1_rollup");
102+
QueryBuilder builder1 = rollup1.addQuery();
103+
builder1.setStart(1, TimeUnit.HOURS);
104+
builder1.addMetric("metric1")
105+
.addAggregator(AggregatorFactory.createMaxAggregator(1, TimeUnit.MINUTES));
106+
client.createRollup(builder);
107+
client.shutdown();
108+
109+
## Get Roll-up Task
110+
111+
Or just get a specified roll-up task
112+
113+
RollupResponse rollupResponse = client.getRollupTask("ddafbb87-3063-4013-8e98-da2ff8671caf");
114+
for (RollupTask rollupTask : rollupResponse.getRollupTasks())
115+
{
116+
for (Rollup rollup : rollupTask.getRollups())
117+
{
118+
System.out.println(rollup);
119+
}
120+
}
121+
client.shutdown();
122+
123+
## Delete Roll-up task
124+
125+
Or delete a roll-up task
96126

127+
Response response = client.deleteRollup("ddafbb87-3063-4013-8e98-da2ff8671caf");
128+
client.shutdown();
97129

98130
## Custom Data Types
99131
Starting with version 0.9.4 of KairosDB, you can store more than just numbers as values. This version of the client
@@ -159,7 +191,7 @@ Last, you must cast to your new type following a query for a metric.
159191

160192
## KairosDB compatibility
161193

162-
Version 2.2.0 of the client was tested with KairosDB version 1.1.3-1.
194+
Version 2.3.0 of the client was tested with KairosDB version 1.2.1-1.
163195

164196
## Contributions
165197

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>org.kairosdb</groupId>
77
<artifactId>client</artifactId>
8-
<version>2.2.0</version>
8+
<version>2.3.0</version>
99
<packaging>jar</packaging>
1010

1111

@@ -47,7 +47,7 @@
4747
<dependency>
4848
<groupId>com.google.guava</groupId>
4949
<artifactId>guava</artifactId>
50-
<version>19.0</version>
50+
<version>25.1-jre</version>
5151
</dependency>
5252
<dependency>
5353
<groupId>org.hamcrest</groupId>

0 commit comments

Comments
 (0)