Java Code Examples for net.bytebuddy.asm.Advice#Origin
The following examples show how to use
net.bytebuddy.asm.Advice#Origin .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FixedDelayAgentRule.java From java-specialagent with Apache License 2.0 | 6 votes |
@Advice.OnMethodEnter public static void exit(final @ClassName String className, final @Advice.Origin String origin, @Advice.Argument(value = 0, readOnly = false, typing = Typing.DYNAMIC) Runnable arg) throws Exception { if (!isAllowed(className, origin)) return; final Tracer tracer = GlobalTracer.get(); if (isVerbose(className)) { final Span span = tracer .buildSpan("scheduleWithFixedDelay") .withTag(Tags.COMPONENT, "java-concurrent") .start(); arg = WrapperProxy.wrap(arg, new TracedRunnable(arg, span, true)); span.finish(); } else if (tracer.activeSpan() != null) { arg = WrapperProxy.wrap(arg, new TracedRunnable(arg, tracer.activeSpan(), false)); } }
Example 2
Source File: PrivilegedEventRule.java From java-specialagent with Apache License 2.0 | 6 votes |
@Advice.OnMethodExit(onThrowable = Throwable.class) public static void exit(final @ClassName String className, final @Advice.Origin String origin, final @Advice.Argument(value = 0) Object event) { if (!isAllowed(className, origin)) return; if (event == null) { MDC.remove(TRACE_ID_MDC_KEY); MDC.remove(SPAN_ID_MDC_KEY); return; } final String correlationId = ((Event)event).getCorrelationId(); if (correlationId == null) return; final Span span = SpanAssociations.get().retrieveSpan(correlationId); if (span == null) return; MDC.put(TRACE_ID_MDC_KEY, span.context().toTraceId()); MDC.put(SPAN_ID_MDC_KEY, span.context().toSpanId()); }
Example 3
Source File: HttpUrlConnectionInstrumentation.java From apm-agent-java with Apache License 2.0 | 6 votes |
@Advice.OnMethodEnter(suppress = Throwable.class) public static void enter(@Advice.This HttpURLConnection thiz, @Advice.FieldValue("connected") boolean connected, @Advice.Local("span") Span span, @Advice.Origin String signature) { if (tracer == null || tracer.getActive() == null) { return; } span = inFlightSpans.get(thiz); if (span == null && !connected) { final URL url = thiz.getURL(); span = HttpClientHelper.startHttpClientSpan(tracer.getActive(), thiz.getRequestMethod(), url.toString(), url.getProtocol(), url.getHost(), url.getPort()); if (span != null) { if (!TraceContext.containsTraceContextTextHeaders(thiz, UrlConnectionPropertyAccessor.instance())) { span.propagateTraceContext(thiz, UrlConnectionPropertyAccessor.instance()); } } } if (span != null) { span.activate(); } }
Example 4
Source File: ApmSpanBuilderInstrumentation.java From apm-agent-java with Apache License 2.0 | 5 votes |
@Advice.OnMethodExit(suppress = Throwable.class) public static void createSpan(@Advice.Argument(value = 0, typing = Assigner.Typing.DYNAMIC) @Nullable AbstractSpan<?> parentContext, @Advice.Origin Class<?> spanBuilderClass, @Advice.FieldValue(value = "tags") Map<String, Object> tags, @Advice.FieldValue(value = "operationName") String operationName, @Advice.FieldValue(value = "microseconds") long microseconds, @Advice.Argument(1) @Nullable Iterable<Map.Entry<String, String>> baggage, @Advice.Return(readOnly = false) Object span) { span = doCreateTransactionOrSpan(parentContext, tags, operationName, microseconds, baggage, spanBuilderClass.getClassLoader()); }
Example 5
Source File: OkHttpClientAsyncInstrumentation.java From apm-agent-java with Apache License 2.0 | 5 votes |
@Advice.OnMethodEnter(suppress = Throwable.class) private static void onBeforeEnqueue(@Advice.Origin Class<? extends Call> clazz, @Advice.FieldValue(value = "originalRequest", typing = Assigner.Typing.DYNAMIC, readOnly = false) @Nullable Request originalRequest, @Advice.Argument(value = 0, readOnly = false) @Nullable Callback callback, @Advice.Local("span") Span span) { if (tracer == null || tracer.getActive() == null || callbackWrapperCreator == null) { return; } final WrapperCreator<Callback> wrapperCreator = callbackWrapperCreator.getForClassLoaderOfClass(clazz); if (originalRequest == null || callback == null || wrapperCreator == null) { return; } final AbstractSpan<?> parent = tracer.getActive(); Request request = originalRequest; URL url = request.url(); span = HttpClientHelper.startHttpClientSpan(parent, request.method(), url.toString(), url.getProtocol(), OkHttpClientHelper.computeHostName(url.getHost()), url.getPort()); if (span != null) { span.activate(); if (headerSetterHelperManager != null) { TextHeaderSetter<Request.Builder> headerSetter = headerSetterHelperManager.getForClassLoaderOfClass(Request.class); if (headerSetter != null) { Request.Builder builder = originalRequest.newBuilder(); span.propagateTraceContext(builder, headerSetter); originalRequest = builder.build(); } } callback = wrapperCreator.wrap(callback, span); } }
Example 6
Source File: SpringRabbitMQAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodExit(onThrowable = Throwable.class) public static void exit(final @ClassName String className, final @Advice.Origin String origin, final @Advice.Thrown Throwable thrown) { if (isAllowed(className, origin)) SpringRabbitMQAgentIntercept.handleDeliveryEnd(thrown); }
Example 7
Source File: SpringJmsMQAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodExit(onThrowable = Throwable.class) public static void exit(final @ClassName String className, final @Advice.Origin String origin, final @Advice.Thrown Throwable thrown) { if (isAllowed(className, origin)) SpringJmsAgentIntercept.onMessageExit(thrown); }
Example 8
Source File: AkkaAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodExit(onThrowable = Throwable.class) public static void exit(final @ClassName String className, final @Advice.Origin String origin, final @Advice.Argument(value = 0) Object actorRef, final @Advice.Argument(value = 1) Object message, final @Advice.Thrown Throwable thrown) { if (isAllowed(className, origin)) AkkaAgentIntercept.askEnd(actorRef, message, thrown, null); }
Example 9
Source File: Neo4jDriverAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodExit public static void enter(final @ClassName String className, final @Advice.Origin String origin, @Advice.Return(readOnly = false, typing = Typing.DYNAMIC) Object returned) { if (isAllowed(className, origin)) returned = Neo4jDriverAgentIntercept.exit(returned); }
Example 10
Source File: ThriftAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodExit public static void exit(final @ClassName String className, final @Advice.Origin String origin, @Advice.Return(readOnly = false, typing = Typing.DYNAMIC) Object returned) { if (isAllowed(className, origin)) returned = ThriftProtocolFactoryAgentIntercept.exit(returned); }
Example 11
Source File: JdbcAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodEnter public static void enter(final @ClassName String className, final @Advice.Origin String origin, final @Advice.Argument(value = 1) Class<?> caller) throws Exception { if (isAllowed(className, origin)) JdbcAgentIntercept.isDriverAllowed(caller); }
Example 12
Source File: AsyncHttpClientAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodEnter public static void enter(final @ClassName String className, final @Advice.Origin String origin, final @Advice.Argument(value = 0) Object request, @Advice.Argument(value = 1, readOnly = false, typing = Typing.DYNAMIC) Object handler) { if (isAllowed(className, origin)) handler = AsyncHttpClientAgentIntercept.enter(request, handler); }
Example 13
Source File: LettuceAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodExit(onThrowable = Throwable.class) public static void exit(final @ClassName String className, final @Advice.Origin String origin, final @Advice.Argument(value = 0) Object arg, final @Advice.Return Object returned, final @Advice.Thrown Throwable thrown) { if (isAllowed(className, origin)) LettuceAgentIntercept.dispatchEnd(arg, returned, thrown); }
Example 14
Source File: JmsAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodExit public static void enter(final @ClassName String className, final @Advice.Origin String origin, @Advice.Return(readOnly = false, typing = Typing.DYNAMIC) Object returned) { if (isAllowed(className, origin) && !WrapperProxy.isWrapper(returned)) returned = WrapperProxy.wrap(returned, JmsAgentIntercept.createConsumer(returned)); }
Example 15
Source File: SpringKafkaAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodExit(onThrowable = Throwable.class) public static void exit(final @ClassName String className, final @Advice.Origin String origin, final @Advice.Thrown Throwable thrown) { if (isAllowed(className, origin)) SpringKafkaAgentIntercept.onMessageExit(thrown); }
Example 16
Source File: SpringRabbitMQAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodExit(onThrowable = Throwable.class) public static void exit(final @ClassName String className, final @Advice.Origin String origin, final @Advice.Thrown Throwable thrown) { if (isAllowed(className, origin)) SpringRabbitMQAgentIntercept.onMessageExit(thrown); }
Example 17
Source File: CxfWsClientAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodEnter public static void enter(final @ClassName String className, final @Advice.Origin String origin, final @Advice.This Object thiz) { if (isAllowed(className, origin)) CxfAgentIntercept.addClientTracingFeature(thiz); }
Example 18
Source File: JedisAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodEnter public static void enter(final @ClassName String className, final @Advice.Origin String origin, final @Advice.Argument(value = 0) Object command, final @Advice.Argument(value = 1, readOnly = false, typing = Typing.DYNAMIC) byte[][] args) { if (isAllowed(className, origin)) JedisAgentIntercept.sendCommand(command, args); }
Example 19
Source File: FeignAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodExit(onThrowable = Exception.class) public static void exit(final @ClassName String className, final @Advice.Origin String origin, final @Advice.Thrown Exception thrown, @Advice.Return Object response, final @Advice.Argument(value = 0) Object request, final @Advice.Argument(value = 1) Object options) { if (isAllowed(className, origin)) FeignAgentIntercept.onResponse(response, request, options, thrown); }
Example 20
Source File: SpymemcachedAgentRule.java From java-specialagent with Apache License 2.0 | 4 votes |
@Advice.OnMethodEnter public static void enter(final @ClassName String className, final @Advice.Origin String origin, @Advice.Argument(value = 1, typing = Typing.DYNAMIC, readOnly = false) Object callback) { if (isAllowed(className, origin)) callback = SpymemcachedAgentIntercept.tracingCallback("flush", null, callback); }