本文整理汇总了Java中redis.clients.util.Slowlog类的典型用法代码示例。如果您正苦于以下问题:Java Slowlog类的具体用法?Java Slowlog怎么用?Java Slowlog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Slowlog类属于redis.clients.util包,在下文中一共展示了Slowlog类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: slowlog
import redis.clients.util.Slowlog; //导入依赖的package包/类
@Test
public void slowlog() {
// do something
jedis.configSet("slowlog-log-slower-than", "0");
jedis.set("foo", "bar");
jedis.set("foo2", "bar2");
List<Slowlog> reducedLog = jedis.slowlogGet(1);
assertEquals(1, reducedLog.size());
Slowlog log = reducedLog.get(0);
assertTrue(log.getId() > 0);
assertTrue(log.getTimeStamp() > 0);
assertTrue(log.getExecutionTime() > 0);
assertNotNull(log.getArgs());
List<byte[]> breducedLog = jedis.slowlogGetBinary(1);
assertEquals(1, breducedLog.size());
List<Slowlog> log1 = jedis.slowlogGet();
List<byte[]> blog1 = jedis.slowlogGetBinary();
assertNotNull(log1);
assertNotNull(blog1);
long len1 = jedis.slowlogLen();
jedis.slowlogReset();
List<Slowlog> log2 = jedis.slowlogGet();
List<byte[]> blog2 = jedis.slowlogGetBinary();
long len2 = jedis.slowlogLen();
assertTrue(len1 > len2);
assertTrue(log1.size() > log2.size());
assertTrue(blog1.size() > blog2.size());
}
示例2: slowlogGet
import redis.clients.util.Slowlog; //导入依赖的package包/类
@Override
public List<Slowlog> slowlogGet() {
Span span = helper.buildSpan("slowlogGet");
try {
return super.slowlogGet();
} catch (Exception e) {
onError(e, span);
throw e;
} finally {
span.finish();
}
}
示例3: countNumberOfNewSlowLogs
import redis.clients.util.Slowlog; //导入依赖的package包/类
private int countNumberOfNewSlowLogs(List<Slowlog> slowlogs) {
int count = 0;
if(previousTimeStamp != currentTimeStamp) {
for (Slowlog individualLog : slowlogs) {
Long tempTimeStamp = individualLog.getTimeStamp();
if (tempTimeStamp > previousTimeStamp && tempTimeStamp <= currentTimeStamp) {
count++;
}
}
}
logger.debug("The number of new slow logs between {} and {} are : {}", previousTimeStamp, currentTimeStamp, count);
return count;
}
示例4: slowlogGet
import redis.clients.util.Slowlog; //导入依赖的package包/类
@Override
public List<Slowlog> slowlogGet() {
client.slowlogGet();
return Slowlog.from(client.getObjectMultiBulkReply());
}
示例5: slowlogGet
import redis.clients.util.Slowlog; //导入依赖的package包/类
public List<Slowlog> slowlogGet() {
client.slowlogGet();
return Slowlog.from(client.getObjectMultiBulkReply());
}
示例6: slowlogGet
import redis.clients.util.Slowlog; //导入依赖的package包/类
@Override
public List<Slowlog> slowlogGet() {
return jedis.slowlogGet();
}
示例7: slowlogGet
import redis.clients.util.Slowlog; //导入依赖的package包/类
@Override
public List<Slowlog> slowlogGet() {
return null;
}
示例8: slowlogGet
import redis.clients.util.Slowlog; //导入依赖的package包/类
@Override
public List<Slowlog> slowlogGet() {
client.slowlogGet();
return Slowlog.from(client.getObjectMultiBulkReply());
}
示例9: slowlogGet
import redis.clients.util.Slowlog; //导入依赖的package包/类
@Override
public List<Slowlog> slowlogGet() {
throw new UnsupportedOperationException("configGet() not implemented.");
//return null;
}
示例10: slowlogGet
import redis.clients.util.Slowlog; //导入依赖的package包/类
public List<Slowlog> slowlogGet() {
client.slowlogGet();
return Slowlog.from(client.getObjectMultiBulkReply());
}
示例11: slowlogGet
import redis.clients.util.Slowlog; //导入依赖的package包/类
@Override public List<Slowlog> slowlogGet() {
throw new FakeJedisNotImplementedException();
}
示例12: slowlogGet
import redis.clients.util.Slowlog; //导入依赖的package包/类
public List<Slowlog> slowlogGet() {
client.slowlogGet();
return Slowlog.from(client.getObjectMultiBulkReply());
}
示例13: slowogMetricsTest
import redis.clients.util.Slowlog; //导入依赖的package包/类
@Test
public void slowogMetricsTest() throws IOException {
ArgumentCaptor<List> pathCaptor = ArgumentCaptor.forClass(List.class);
AMonitorJob aMonitorJob = mock(AMonitorJob.class);
MonitorConfiguration configuration = new MonitorConfiguration("Redis Monitor", "Custom Metrics|Redis", aMonitorJob);
configuration.setConfigYml("src/test/resources/conf/config.yml");
MetricWriteHelper metricWriteHelper = mock(MetricWriteHelper.class);
JedisPool jedisPool = mock(JedisPool.class);
Jedis jedis = mock(Jedis.class);
CountDownLatch countDownLatch = new CountDownLatch(1);
when(jedisPool.getResource()).thenReturn(jedis);
List<Object> objectList = Lists.newArrayList();
List list1 = new ArrayList();
list1.add(15L);
list1.add(1505158204L);
list1.add(18L);
List list11 = new ArrayList();
list11.add("slowlog".getBytes());
list11.add("get".getBytes());
list1.add(list11);
List list2 = new ArrayList();
list2.add(14L);
list2.add(1505158203L);
list2.add(18L);
List list21 = new ArrayList();
list21.add("slowlog".getBytes());
list21.add("get".getBytes());
list2.add(list21);
objectList.add(list1);
objectList.add(list2);
when(jedis.slowlogGet(jedis.slowlogLen())).thenReturn(Slowlog.from(objectList));
Map<String, String> server = Maps.newHashMap();
server.put("host", "localhost");
server.put("port", "6379");
server.put("name", "Server1");
SlowLogMetrics slowLogMetrics = new SlowLogMetrics(configuration, server, metricWriteHelper, jedisPool, countDownLatch, 1505158200000L, 1505158220000L);
slowLogMetrics.run();
verify(metricWriteHelper).transformAndPrintMetrics(pathCaptor.capture());
for (Metric metric : (List<Metric>)pathCaptor.getValue()){
Assert.assertTrue(metric.getMetricPath().equals("Server|Component:AppLevels|Custom metrics|Redis|Server1|SlowLog|no_of_new_slow_logs"));
Assert.assertTrue(metric.getMetricValue().equals("2"));
}
}
示例14: slowlogGet
import redis.clients.util.Slowlog; //导入依赖的package包/类
List<Slowlog> slowlogGet();