Skip to content

Commit

Permalink
del Sysout
Browse files Browse the repository at this point in the history
  • Loading branch information
songlonqi-java committed Sep 14, 2023
1 parent d158248 commit a6a5d9b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
}
Expand All @@ -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);
}
}
Expand All @@ -145,8 +141,6 @@ public static class ConsumerAsyncReceiveAdvice {
public static void onExit(
@Advice.This Consumer<?> consumer,
@Advice.Return(readOnly = false) CompletableFuture<Message<?>> future) {
System.out.println("-------- init ----Consumer AsyncReceive-------");

future = wrap(future, consumer);
}
}
Expand All @@ -159,7 +153,6 @@ public static void onExit(
@Advice.This Consumer<?> consumer,
@Advice.Return(readOnly = false) CompletableFuture<Messages<?>> future) {

System.out.println("-------- init ----Consumer batch AsyncReceive-------");
future = wrapBatch(future, consumer);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public String[] helperClassNames() {

@Override
public void adviceTransformations(AdviceTransformation transformation) {
System.out.println("--- add producer adviceTransformations-------------------------");
transformation.applyAdvice(
isConstructor()
.and(isPublic())
Expand All @@ -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();
Expand All @@ -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<ProducerImpl, ProducerData> contextStore =
InstrumentationContext.get(ProducerImpl.class, ProducerData.class);
ProducerData producerData = contextStore.get(producer);
Expand All @@ -131,19 +119,13 @@ public static void onEnter(
ContextStore<ProducerImpl, ProducerData> 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---------------------");
}
}
}

0 comments on commit a6a5d9b

Please sign in to comment.