use of com.nr.lettuce6.instrumentation.NRHolder in project newrelic-java-agent by newrelic.
the class AbstractRedisReactiveCommands_Instrumentation method createDissolvingFlux.
public <T, R> Flux<R> createDissolvingFlux(Supplier<RedisCommand<K, V, T>> commandSupplier) {
Flux<R> result = Weaver.callOriginal();
RedisCommand<K, V, T> cmd = commandSupplier.get();
if (cmd != null) {
ProtocolKeyword type = cmd.getType();
String name = type.name();
String collName = null;
RedisURI uri = null;
if (StatefulRedisConnectionImpl_Instrumentation.class.isInstance(connection)) {
StatefulRedisConnectionImpl_Instrumentation<K, V> connImpl = (StatefulRedisConnectionImpl_Instrumentation<K, V>) connection;
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(), Integer.valueOf(uri.getPort())).noDatabaseName().build();
} else {
params = DatastoreParameters.product("Redis").collection(collName).operation("").noInstance().noDatabaseName().noSlowQuery().build();
}
NRHolder holder = new NRHolder(name, params);
NRSubscribeConsumer subscriberConsumer = new NRSubscribeConsumer(holder);
NRErrorConsumer errorConsumer = new NRErrorConsumer(holder);
Consumer<SignalType> onFinally = new NRSignalTypeConsumer(holder);
return result.doOnSubscribe(subscriberConsumer).doOnError(errorConsumer).doFinally(onFinally);
}
return result;
}
use of com.nr.lettuce6.instrumentation.NRHolder in project newrelic-java-agent by newrelic.
the class AbstractRedisReactiveCommands_Instrumentation method createMono.
public <T> Mono<T> createMono(Supplier<RedisCommand<K, V, T>> commandSupplier) {
Mono<T> result = Weaver.callOriginal();
RedisCommand<K, V, T> cmd = commandSupplier.get();
if (cmd != null) {
ProtocolKeyword type = cmd.getType();
String name = type.name();
String collName = null;
RedisURI uri = null;
if (StatefulRedisConnectionImpl_Instrumentation.class.isInstance(connection)) {
StatefulRedisConnectionImpl_Instrumentation<K, V> connImpl = (StatefulRedisConnectionImpl_Instrumentation<K, V>) connection;
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(), Integer.valueOf(uri.getPort())).noDatabaseName().build();
} else {
params = DatastoreParameters.product("Redis").collection(collName).operation(operation).noInstance().noDatabaseName().noSlowQuery().build();
}
NRHolder holder = new NRHolder(name, params);
NRSubscribeConsumer subscriberConsumer = new NRSubscribeConsumer(holder);
NRErrorConsumer errorConsumer = new NRErrorConsumer(holder);
Consumer<SignalType> onFinally = new NRSignalTypeConsumer(holder);
return result.doOnSubscribe(subscriberConsumer).doOnError(errorConsumer).doFinally(onFinally);
}
return result;
}
Aggregations