From a6a5d9b26cdd06c1d2fcc751a1c4f32f07328999 Mon Sep 17 00:00:00 2001 From: songlq <18332731561@163.com> Date: Thu, 14 Sep 2023 18:31:30 +0800 Subject: [PATCH] del Sysout --- .../pulsar/ConsumerImplInstrumentation.java | 7 ------ .../pulsar/ProducerDecorator.java | 2 -- .../pulsar/ProducerImplInstrumentation.java | 24 +++---------------- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/dd-java-agent/instrumentation/pulsar/src/main/java/datadog/trace/instrumentation/pulsar/ConsumerImplInstrumentation.java b/dd-java-agent/instrumentation/pulsar/src/main/java/datadog/trace/instrumentation/pulsar/ConsumerImplInstrumentation.java index b6514b4d6d4..141c217e958 100644 --- a/dd-java-agent/instrumentation/pulsar/src/main/java/datadog/trace/instrumentation/pulsar/ConsumerImplInstrumentation.java +++ b/dd-java-agent/instrumentation/pulsar/src/main/java/datadog/trace/instrumentation/pulsar/ConsumerImplInstrumentation.java @@ -69,7 +69,6 @@ public String[] helperClassNames() { @Override public void adviceTransformations(AdviceTransformation transformation) { - System.out.println("--- add consumer adviceTransformations-------------------------"); String className = ConsumerImplInstrumentation.class.getName(); transformation.applyAdvice(isConstructor(), className + "$ConsumerConstructorAdvice"); @@ -105,7 +104,6 @@ public static class ConsumerConstructorAdvice { // 初始化 @Advice.OnMethodExit(suppress = Throwable.class) public static void onExit( @Advice.This Consumer consumer, @Advice.Argument(value = 0) PulsarClient client) { - System.out.println("---- init ----------"); PulsarClientImpl pulsarClient = (PulsarClientImpl) client; String url = pulsarClient.getLookup().getServiceUrl(); // VirtualFieldStore.inject(consumer, url); @@ -121,7 +119,6 @@ public static void onExit( @Advice.This Consumer consumer, @Advice.Return Message message, @Advice.Thrown Throwable throwable) { - System.out.println("-------- init ----Consumer Internal-------"); startAndEnd(create(message), throwable,consumer); } } @@ -134,7 +131,6 @@ public static void onExit( @Advice.This Consumer consumer, @Advice.Return Message message, @Advice.Thrown Throwable throwable) { - System.out.println("-------- init ----Consumer SyncReceive-------"); startAndEnd(create(message), throwable,consumer); } } @@ -145,8 +141,6 @@ public static class ConsumerAsyncReceiveAdvice { public static void onExit( @Advice.This Consumer consumer, @Advice.Return(readOnly = false) CompletableFuture> future) { - System.out.println("-------- init ----Consumer AsyncReceive-------"); - future = wrap(future, consumer); } } @@ -159,7 +153,6 @@ public static void onExit( @Advice.This Consumer consumer, @Advice.Return(readOnly = false) CompletableFuture> future) { - System.out.println("-------- init ----Consumer batch AsyncReceive-------"); future = wrapBatch(future, consumer); } } diff --git a/dd-java-agent/instrumentation/pulsar/src/main/java/datadog/trace/instrumentation/pulsar/ProducerDecorator.java b/dd-java-agent/instrumentation/pulsar/src/main/java/datadog/trace/instrumentation/pulsar/ProducerDecorator.java index b481c956cb9..d8017becb22 100644 --- a/dd-java-agent/instrumentation/pulsar/src/main/java/datadog/trace/instrumentation/pulsar/ProducerDecorator.java +++ b/dd-java-agent/instrumentation/pulsar/src/main/java/datadog/trace/instrumentation/pulsar/ProducerDecorator.java @@ -32,7 +32,6 @@ protected CharSequence component() { } public static AgentScope start(PulsarRequest request){ - System.out.println("---------init start span"); UTF8BytesString spanName = UTF8BytesString.create(request.getDestination()+" send"); final AgentSpan span = startSpan(spanName); span.setServiceName("pulsar"); @@ -48,7 +47,6 @@ public static AgentScope start(PulsarRequest request){ } public void end(AgentScope scope, PulsarRequest request, Exception e) { - System.out.println(" ------------init end span"); if (e != null){ scope.span().setError(true); scope.span().setErrorMessage(e.getMessage()); diff --git a/dd-java-agent/instrumentation/pulsar/src/main/java/datadog/trace/instrumentation/pulsar/ProducerImplInstrumentation.java b/dd-java-agent/instrumentation/pulsar/src/main/java/datadog/trace/instrumentation/pulsar/ProducerImplInstrumentation.java index 800cedc3629..0d30a3d6951 100644 --- a/dd-java-agent/instrumentation/pulsar/src/main/java/datadog/trace/instrumentation/pulsar/ProducerImplInstrumentation.java +++ b/dd-java-agent/instrumentation/pulsar/src/main/java/datadog/trace/instrumentation/pulsar/ProducerImplInstrumentation.java @@ -69,7 +69,6 @@ public String[] helperClassNames() { @Override public void adviceTransformations(AdviceTransformation transformation) { - System.out.println("--- add producer adviceTransformations-------------------------"); transformation.applyAdvice( isConstructor() .and(isPublic()) @@ -88,7 +87,6 @@ public static class ProducerImplConstructorAdvice { @Advice.OnMethodExit(suppress = Throwable.class) public static void onExit( @Advice.This ProducerImpl producer, @Advice.Argument(0) PulsarClient client) { - System.out.println("--- Producer ImplConstructorAdvice "); PulsarClientImpl pulsarClient = (PulsarClientImpl) client; String brokerUrl = pulsarClient.getLookup().getServiceUrl(); String topic = producer.getTopic(); @@ -106,17 +104,7 @@ public static void onEnter( @Advice.This ProducerImpl producer, @Advice.Argument(0) Message message, @Advice.Argument(value = 1, readOnly = false) SendCallback callback) { - /* Context parent = Context.current(); - PulsarRequest request = PulsarRequest.create(message, VirtualFieldStore.extract(producer)); - if (!producerInstrumenter().shouldStart(parent, request)) { - return; - } - - Context context = producerInstrumenter().start(parent, request); - callback = new SendCallbackWrapper(context, request, callback); - */ - System.out.println("-------- init Producer Send AsyncMethodAdvice-------"); /*ContextStore contextStore = InstrumentationContext.get(ProducerImpl.class, ProducerData.class); ProducerData producerData = contextStore.get(producer); @@ -131,19 +119,13 @@ public static void onEnter( ContextStore contextStore = InstrumentationContext.get(ProducerImpl.class, ProducerData.class); ProducerData producerData = contextStore.get(producer); - - System.out.println("-----------------------"); - System.out.println(producerData.url); - System.out.println(producerData.topic); - + PulsarRequest request = PulsarRequest.create(message, ProducerData.create(producerData.url, producerData.topic)); - System.out.println(request); - //System.out.println(new SendCallbackWrapper(null,null,null)); + AgentScope scope = ProducerDecorator.start(request); - System.out.println(scope); + callback = new SendCallbackWrapper(scope, request, callback); - System.out.println("---------------out -------AsyncMethodAdvice---------------------"); } } }