Java Client for RedisTimeSeries
As of Jedis 4.2.0, this library is deprecated. Its features have been merged into Jedis. Please install it either from maven or the repo.
<dependencies>
<dependency>
<groupId>com.redislabs</groupId>
<artifactId>jredistimeseries</artifactId>
<version>1.4.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
and
<dependencies>
<dependency>
<groupId>com.redislabs</groupId>
<artifactId>jredistimeseries</artifactId>
<version>1.5.0-SNAPSHOT</version>
</dependency>
</dependencies>
RedisTimeSeries rts = new RedisTimeSeries("localhost", 6379);
Map<String, String> labels = new HashMap<>();
labels.put("country", "US");
labels.put("cores", "8");
rts.create("cpu1", 60*10 /*10min*/, labels);
rts.create("cpu1-avg", 60*10 /*10min*/, null);
rts.createRule("cpu1", Aggregation.AVG, 60 /*1min*/, "cpu1-avg");
rts.add("cpu1", System.currentTimeMillis()/1000 /* time sec */, 80.0);
// Get all the timeseries in US in the last 10min average per min
rts.mrange(System.currentTimeMillis()/1000 - 10*60, System.currentTimeMillis()/1000, Aggregation.AVG, 60, "country=US")