Rewrite plugin using new API#87
Conversation
| */ | ||
| private static String generateOperationName(Invoker<?> invoker, Invocation invocation) { | ||
| StringBuilder operationName = new StringBuilder(); | ||
| operationName.append(invoker.getUrl().getPath()); |
There was a problem hiding this comment.
Multi invocations about invoker.getUrl(), it may be a performance leak.
| StringBuilder requestURL = new StringBuilder(); | ||
| requestURL.append(invoker.getUrl().getProtocol() + "://"); | ||
| requestURL.append(invoker.getUrl().getHost()); | ||
| requestURL.append(":" + invoker.getUrl().getPort() + "/"); |
There was a problem hiding this comment.
Three invoker.getUrl() invocations. same as above.
| import javax.servlet.http.HttpServletResponse; | ||
|
|
||
| /** | ||
| * {@link TomcatInterceptor} fetch the serialized context data by use {@link HttpServletRequest#getHeader(String)}. |
| HttpServletResponse response = (HttpServletResponse) interceptorContext.allArguments()[1]; | ||
|
|
||
| Span span = ContextManager.INSTANCE.activeSpan(); | ||
| Tags.STATUS_CODE.set(span, response.getStatus()); |
There was a problem hiding this comment.
Miss Tags.ERROR.set, which based on response.status, 200 = false, otherwise true.
| if (url != null) { | ||
| com.weibo.api.motan.rpc.Request request = (com.weibo.api.motan.rpc.Request) interceptorContext.allArguments()[0]; | ||
| Span span = ContextManager.INSTANCE.createSpan(generateViewPoint(url, request)); | ||
| Tags.COMPONENT.set(span, "Motan"); |
| private static String generateOperationName(URL serviceURI, Request request) { | ||
| StringBuilder viewPoint = new StringBuilder(serviceURI.getPath()); | ||
| viewPoint.append("." + request.getMethodName()); | ||
| viewPoint.append("(" + request.getParamtersDesc() + ")"); |
| Tags.SPAN_LAYER.asDB(span); | ||
| if (interceptorContext.allArguments().length > 0 | ||
| && interceptorContext.allArguments()[0] instanceof String) { | ||
| span.setTag("operation_key", (String) interceptorContext.allArguments()[0]); |
wu-sheng
left a comment
There was a problem hiding this comment.
Comments are not good enough, before merge.
| * {@link DubboInterceptor#afterMethod(EnhancedClassInstanceContext, InstanceMethodInvokeContext, Object)} be executed after | ||
| * {@link com.alibaba.dubbo.monitor.support.MonitorFilter#invoke(Invoker, Invocation)}, and it will check {@link Result#getException()} if is null. | ||
| * current active span will log the exception and set true to the value of error tag if the {@link Result#getException()} is not null. | ||
| */ |
| /** | ||
| * Active span will log the exception and set current span value of error tag. | ||
| */ | ||
| private void dealException(Throwable throwable) { |
There was a problem hiding this comment.
Log the throwable, which occurs in Dubbo RPC service.
|
|
||
| /** | ||
| * Generate operation name. | ||
| * the operation name should be like this <code>com.a.eye.skywalking.plugin.test.Test.test(String)</code>. |
There was a problem hiding this comment.
Format operation name. e.g. com.a.eye.skywalking.plugin.test.Test.test(String)
| * | ||
| * @return operation name. | ||
| */ | ||
| private static String generateOperationName(URL requestURL, Invocation invocation) { |
| /** | ||
| * Set the serialized context data to the first request param that extend {@link SWBaseBean} of dubbo service. | ||
| * | ||
| * @param contextDataStr serialized context data. |
There was a problem hiding this comment.
@param contextDataStr {@link ContextCarrier.serialize()}
| */ | ||
| private static final String ENHANCE_CLASS = "redis.clients.jedis.JedisCluster"; | ||
| /** | ||
| * Class that intercept all constructors with arg. |
There was a problem hiding this comment.
This comment make no sense. Which methods will be intercepted should be commented on the real class.
| private static final String KEY_NAME_OF_REQUEST_URL = "REQUEST_URL"; | ||
|
|
||
| /** | ||
| * The key name that the serialized context data stored in {@link Request#getAttachments()} |
| */ | ||
| private static final String ATTACHMENT_KEY_OF_CONTEXT_DATA = "contextData"; | ||
| /** | ||
| * Motan component |
There was a problem hiding this comment.
This comment make no sense. It is likely:
The 'componet' tag value of Motan RPC framework.
or
A constant for setting the span component name to indicate that it represents a motan client/server span.
| * | ||
| * @author zhangxin | ||
| */ | ||
| public class ProviderInterceptor implements InstanceConstructorInterceptor, InstanceMethodsAroundInterceptor { |
There was a problem hiding this comment.
You should have a naming policy, whether include the component name or not?
| <dependency> | ||
| <groupId>com.a.eye</groupId> | ||
| <artifactId>skywalking-sniffer-mock</artifactId> | ||
| <version>3.0-2017</version> |
wu-sheng
left a comment
There was a problem hiding this comment.
Comments need improve. I will try me best.
No description provided.