use of com.lambdaworks.redis.protocol.ProtocolKeyword in project uavstack by uavorg.
the class LettuceCommandHandlerIT method doWriteStart.
@SuppressWarnings("unchecked")
public Object doWriteStart(Object[] args) {
ProtocolKeyword cmd = (ProtocolKeyword) args[0];
String host = (String) args[1];
Integer port = (Integer) args[2];
String targetURL = "redis://" + host + ":" + port;
String redisAction = cmd.toString();
if (logger.isDebugable()) {
logger.debug("REDIS INVOKE START: " + targetURL + " action: " + redisAction, null);
}
Map<String, Object> params = new HashMap<String, Object>();
params.put(CaptureConstants.INFO_CLIENT_REQUEST_URL, targetURL);
params.put(CaptureConstants.INFO_CLIENT_REQUEST_ACTION, redisAction);
params.put(CaptureConstants.INFO_CLIENT_APPID, appid);
params.put(CaptureConstants.INFO_CLIENT_TYPE, "redis.client.Lettuce");
// register adapter
UAVServer.instance().runSupporter("com.creditease.uav.apm.supporters.InvokeChainSupporter", "registerAdapter", LettuceClientAdapter.class);
ivcContextParams = (Map<String, Object>) UAVServer.instance().runSupporter("com.creditease.uav.apm.supporters.InvokeChainSupporter", "runCap", InvokeChainConstants.CHAIN_APP_CLIENT, InvokeChainConstants.CapturePhase.PRECAP, params, LettuceClientAdapter.class, args);
UAVServer.instance().runMonitorCaptureOnServerCapPoint(CaptureConstants.CAPPOINT_APP_CLIENT, Monitor.CapturePhase.PRECAP, params);
return null;
}
use of com.lambdaworks.redis.protocol.ProtocolKeyword in project newrelic-java-agent by newrelic.
the class AbstractRedisAsyncCommands_Instrumentation method dispatch.
@SuppressWarnings("unchecked")
@Trace
public <T> AsyncCommand<K, V, T> dispatch(RedisCommand<K, V, T> cmd) {
AsyncCommand<K, V, T> acmd = Weaver.callOriginal();
String collName = "?";
RedisURI uri = null;
StatefulConnection<K, V> conn = getConnection();
if (StatefulRedisConnectionImpl_Instrumentation.class.isInstance(conn)) {
StatefulRedisConnectionImpl_Instrumentation<K, V> connImpl = (StatefulRedisConnectionImpl_Instrumentation<K, V>) conn;
if (connImpl.redisURI != null) {
uri = connImpl.redisURI;
}
}
String operation = "UnknownOp";
ProtocolKeyword t = cmd.getType();
if (t != null && t.name() != null && !t.name().isEmpty()) {
operation = t.name();
}
DatastoreParameters params = null;
if (uri != null) {
params = DatastoreParameters.product("Redis").collection(collName).operation(operation).instance(uri.getHost(), uri.getPort()).noDatabaseName().build();
} else {
params = DatastoreParameters.product("Redis").collection(collName).operation("").noInstance().noDatabaseName().noSlowQuery().build();
}
Segment segment = NewRelic.getAgent().getTransaction().startSegment("Lettuce", operation);
NRBiConsumer<T> nrBiConsumer = new NRBiConsumer<T>(segment, params);
acmd.whenComplete(nrBiConsumer);
return acmd;
}
Aggregations