spring-rabbitmq 的 opentracing 工具没有定义用于跟踪org.springframework.amqp.rabbit.core.RabbitTemplate#send
. 这是代码的链接:RabbitMqSendTracingAspect.java
我尝试实现它并在定义切入点时遇到了一些严重的错误。
这是我的代码:
@Aspect
@Configuration
public class AmqpSendTracingAspect {
private final Tracer tracer;
public AmqpSendTracingAspect(Tracer tracer) {
this.tracer = tracer;
}
@Around(value = "execution(* org.springframework.amqp.core.AmqpTemplate.send(..)) " +
"&& args(exchange,routingKey, message)",
argNames = "pjp,exchange,routingKey,message")
public Object traceAmqpSend(ProceedingJoinPoint pjp,
String exchange, String routingKey, Message message) throws Throwable {
final Object[] args = pjp.getArgs();
System.out.println("Aspect RUnning");
final MessageProperties messageProperties = message.getMessageProperties();
Scope scope = AmqpTracingUtils.buildSendSpan(tracer, messageProperties);
tracer.inject(
scope.span().context(),
Format.Builtin.TEXT_MAP,
new AmqpInjectAdapter(messageProperties));
AmqpSpanDecorator spanDecorator = new AmqpSpanDecorator();
spanDecorator.onSend(messageProperties, exchange, routingKey, scope.span());
args[2] = message;
try {
return pjp.proceed(args);
} catch (Exception ex) {
spanDecorator.onError(ex, scope.span());
throw ex;
} finally {
scope.close();
}
}
}
CglibAopProxy
即使我用@EnableAspectJAutoProxy(proxyTargetClass = false)
Unable to proxy interface-implementing method [public final void org.springframework.amqp.rabbit.core.RabbitTemplate.start()] because it is marked as final: Consider using interface-based JDK proxies instead!
Unable to proxy interface-implementing method [public final void org.springframework.amqp.rabbit.core.RabbitTemplate.stop()] because it is marked as final: Consider using interface-based JDK proxies instead!
请帮帮我!