use of com.navercorp.pinpoint.plugin.kafka.field.accessor.RemoteAddressFieldAccessor in project pinpoint by naver.
the class ConsumerConstructor_V_2_7_Interceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
if (throwable != null) {
return;
}
if (!(target instanceof RemoteAddressFieldAccessor)) {
return;
}
Map consumerConfig = getMap(args);
if (consumerConfig == null) {
return;
}
String remoteAddress = getRemoteAddress(consumerConfig);
((RemoteAddressFieldAccessor) target)._$PINPOINT$_setRemoteAddress(remoteAddress);
}
use of com.navercorp.pinpoint.plugin.kafka.field.accessor.RemoteAddressFieldAccessor in project pinpoint by naver.
the class ConsumerPollInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
if (!(target instanceof RemoteAddressFieldAccessor)) {
return;
}
String remoteAddress = ((RemoteAddressFieldAccessor) target)._$PINPOINT$_getRemoteAddress();
remoteAddress = StringUtils.defaultIfEmpty(remoteAddress, KafkaConstants.UNKNOWN);
if (result instanceof ConsumerRecords) {
Iterator consumerRecordIterator = ((ConsumerRecords) result).iterator();
while (consumerRecordIterator.hasNext()) {
Object consumerRecord = consumerRecordIterator.next();
if (consumerRecord instanceof RemoteAddressFieldAccessor) {
((RemoteAddressFieldAccessor) consumerRecord)._$PINPOINT$_setRemoteAddress(remoteAddress);
}
}
}
}
use of com.navercorp.pinpoint.plugin.kafka.field.accessor.RemoteAddressFieldAccessor in project pinpoint by naver.
the class ProducerConstructorInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
if (throwable != null) {
return;
}
if (!(target instanceof RemoteAddressFieldAccessor)) {
return;
}
ProducerConfig producerConfig = getProducerConfig(args);
if (producerConfig != null) {
String remoteAddress = getRemoteAddress(producerConfig);
((RemoteAddressFieldAccessor) target)._$PINPOINT$_setRemoteAddress(remoteAddress);
return;
}
// Version 2.2.0+ is supported.
Map map = getMap(args);
if (map != null) {
Object remoteAddressObject = map.get(KafkaConstants.CONFIG_BOOTSTRAP_SERVERS_KEY);
String remoteAddress = getRemoteAddress0(remoteAddressObject);
((RemoteAddressFieldAccessor) target)._$PINPOINT$_setRemoteAddress(remoteAddress);
return;
}
}
use of com.navercorp.pinpoint.plugin.kafka.field.accessor.RemoteAddressFieldAccessor in project pinpoint by naver.
the class ConsumerConstructorInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
if (throwable != null) {
return;
}
if (!(target instanceof RemoteAddressFieldAccessor)) {
return;
}
ConsumerConfig consumerConfig = getConsumerConfig(args);
if (consumerConfig == null) {
return;
}
String remoteAddress = getRemoteAddress(consumerConfig);
((RemoteAddressFieldAccessor) target)._$PINPOINT$_setRemoteAddress(remoteAddress);
}
Aggregations