public class RedisDBAnalyzer implements ExternalResourceAnalyzer { public static final OperationType TYPE = OperationType.valueOf("redis-client-method"); public List<ExternalResourceDescriptor> locateExternalResourceName(Trace trace) { Collection<Frame> dbFrames = trace.getLastFramesOfType(TYPE); if ((dbFrames == null) || dbFrames.isEmpty()) { return Collections.emptyList(); } List<ExternalResourceDescriptor> dbDescriptors = new ArrayList<ExternalResourceDescriptor>(dbFrames.size()); for (Frame dbFrame : dbFrames) { Operation op = dbFrame.getOperation(); String host = op.get("host", String.class); Integer portProperty = op.get("port", Integer.class); int port = portProperty == null ? -1 : portProperty.intValue(); String dbName = op.get("dbName", String.class); String redisHash = MD5NameGenerator.getName(dbName + host + port); dbDescriptors.add( new ExternalResourceDescriptor( dbFrame, "redis:" + redisHash, dbName, ExternalResourceType.DATABASE.name(), "Redis", host, port)); } return dbDescriptors; } }