public List<MonitorStat> retrieve(String traceId, String filePath, String encoding) throws Exception { if (StringUtils.isEmpty(traceId)) { throw new MonitorException("Trace ID is null"); throw new MonitorException("File path is null");
public Map<String, String> retrieveFromCluster(String traceId) throws Exception { JedisCluster cluster = RedisClusterFactory.getCluster(); if (cluster == null) { throw new MonitorException("No redis cluster found, retrieve failed"); } Map<String, String> monitorStatMap = cluster.hgetAll(traceId); if (MapUtils.isEmpty(monitorStatMap)) { return null; } return monitorStatMap; }
public Map<String, String> retrieveFromSentinel(String traceId) throws Exception { Jedis jedis = RedisSentinelPoolFactory.getResource(); if (jedis == null) { throw new MonitorException("No redis sentinel resource found, retrieve failed"); } Map<String, String> monitorStatMap = jedis.hgetAll(traceId); if (MapUtils.isEmpty(monitorStatMap)) { return null; } return monitorStatMap; }
public List<MonitorStat> retrieve(String traceId, RedisType redisType) throws Exception { if (StringUtils.isEmpty(traceId)) { throw new MonitorException("Trace ID is null"); } if (redisType == null) { throw new MonitorException("Redis type is null"); } Map<String, String> monitorStatMap = null; switch (redisType) { case REDIS_SENTINEL: monitorStatMap = retrieveFromSentinel(traceId); break; case REDIS_CLUSTER: monitorStatMap = retrieveFromCluster(traceId); break; } if (MapUtils.isEmpty(monitorStatMap)) { return null; } List<MonitorStat> monitorStatList = retrieve(monitorStatMap); sort(monitorStatList); return monitorStatList; }
public List<MonitorStat> retrieve(String traceId, Map<String, Object> conditions, String encoding) throws Exception { if (StringUtils.isEmpty(traceId)) { throw new MonitorException("Trace ID is null"); throw new MonitorException("Splunk service is null"); throw new MonitorException("Input stream is null");