修复部分问题
This commit is contained in:
parent
59b1aeee5a
commit
262309baef
|
|
@ -33,10 +33,6 @@ public abstract class BaseInvokeMonitor {
|
|||
// 将新创建的Context存放到ThreadLocal栈中。
|
||||
CurrentThreadSpanStack.push(spanData);
|
||||
|
||||
// 根据SpanData生成RequestSpan,并保存
|
||||
|
||||
CurrentThreadSpanStack.push(spanData);
|
||||
|
||||
sendRequestSpan(spanData, id);
|
||||
|
||||
// 并将当前的Context返回回去
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
package com.a.eye.skywalking.plugin.dubbo;
|
||||
|
||||
import com.a.eye.skywalking.invoke.monitor.RPCClientInvokeMonitor;
|
||||
import com.a.eye.skywalking.invoke.monitor.RPCServerInvokeMonitor;
|
||||
import com.a.eye.skywalking.model.ContextData;
|
||||
import com.a.eye.skywalking.model.Identification;
|
||||
import com.a.eye.skywalking.plugin.dubbox.bugfix.below283.BugFixAcitve;
|
||||
import com.a.eye.skywalking.plugin.dubbox.bugfix.below283.SWBaseBean;
|
||||
import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodInvokeContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import com.a.eye.skywalking.invoke.monitor.RPCClientInvokeMonitor;
|
||||
import com.alibaba.dubbo.rpc.Invocation;
|
||||
import com.alibaba.dubbo.rpc.Invoker;
|
||||
import com.alibaba.dubbo.rpc.Result;
|
||||
|
|
@ -19,7 +18,7 @@ import com.alibaba.dubbo.rpc.RpcContext;
|
|||
public class MonitorFilterInterceptor implements InstanceMethodsAroundInterceptor {
|
||||
@Override
|
||||
public void beforeMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
|
||||
MethodInterceptResult result) {
|
||||
MethodInterceptResult result) {
|
||||
Object[] arguments = interceptorContext.allArguments();
|
||||
Invoker invoker = (Invoker) arguments[0];
|
||||
Invocation invocation = (Invocation) arguments[1];
|
||||
|
|
@ -74,7 +73,7 @@ public class MonitorFilterInterceptor implements InstanceMethodsAroundIntercepto
|
|||
|
||||
@Override
|
||||
public Object afterMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
|
||||
Object ret) {
|
||||
Object ret) {
|
||||
Result result = (Result) ret;
|
||||
if (result != null && result.getException() != null) {
|
||||
dealException(result.getException(), context);
|
||||
|
|
@ -91,7 +90,7 @@ public class MonitorFilterInterceptor implements InstanceMethodsAroundIntercepto
|
|||
|
||||
@Override
|
||||
public void handleMethodException(Throwable t, EnhancedClassInstanceContext context,
|
||||
InstanceMethodInvokeContext interceptorContext) {
|
||||
InstanceMethodInvokeContext interceptorContext) {
|
||||
dealException(t, context);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
package com.a.eye.skywalking.plugin.motan;
|
||||
|
||||
import com.a.eye.skywalking.model.Identification;
|
||||
import com.weibo.api.motan.rpc.Request;
|
||||
import com.weibo.api.motan.rpc.URL;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class IdentificationUtil {
|
||||
/**
|
||||
* for example:
|
||||
* <p>
|
||||
* <strong>service URL</strong> : motan://172.18.80.208:0/org.a.eye.skywalking.motan
|
||||
* .FooService?group=default_rpc
|
||||
* <strong>execute method</strong> : helloWorld
|
||||
* <strong>execute parameter</strong>: java.lang.String,java.lang.String
|
||||
* <p>
|
||||
* <p>
|
||||
* <strong>view point</strong>: motan://172.18.80.208:0/org.a.eye.skywalking.motan.FooService.helloWorld
|
||||
* (java.lang.String,java.lang.String)?group=default_rpc
|
||||
*
|
||||
* @param serviceURI such as: motan://172.18.80.208:0/org.a.eye.skywalking.motan.FooService?group=default_rpc
|
||||
* @param request
|
||||
* @return such as: motan://172.18.80.208:0/org.a.eye.skywalking.motan.FooService.helloWorld
|
||||
* (java.lang.String,java.lang.String)?group=default_rpc
|
||||
*/
|
||||
private static String generateViewPoint(URL serviceURI, Request request) {
|
||||
StringBuilder viewPoint = new StringBuilder(serviceURI.getUri());
|
||||
viewPoint.append("." + request.getMethodName());
|
||||
viewPoint.append("(" + request.getParamtersDesc() + ")?group=" + serviceURI.getGroup());
|
||||
return viewPoint.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param request
|
||||
* @param serviceURI such as: motan://172.18.80.208:0/org.a.eye.skywalking.motan.FooService?group=default_rpc
|
||||
* @return
|
||||
*/
|
||||
public static Identification generateIdentify(Request request, URL serviceURI) {
|
||||
return Identification.newBuilder().viewPoint(generateViewPoint(serviceURI, request))
|
||||
.spanType(MotanBuriedPointType.instance()).build();
|
||||
}
|
||||
}
|
||||
|
|
@ -2,13 +2,16 @@ package com.a.eye.skywalking.plugin.motan;
|
|||
|
||||
import com.a.eye.skywalking.invoke.monitor.RPCClientInvokeMonitor;
|
||||
import com.a.eye.skywalking.model.ContextData;
|
||||
import com.a.eye.skywalking.model.Identification;
|
||||
import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.*;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceConstructorInterceptor;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodInvokeContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import com.weibo.api.motan.rpc.Request;
|
||||
import com.weibo.api.motan.rpc.URL;
|
||||
|
||||
import static com.a.eye.skywalking.plugin.motan.IdentificationUtil.generateIdentify;
|
||||
|
||||
/**
|
||||
* Motan client interceptor
|
||||
*/
|
||||
|
|
@ -20,11 +23,11 @@ public class MotanClientInterceptor implements InstanceMethodsAroundInterceptor,
|
|||
|
||||
@Override
|
||||
public void beforeMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
|
||||
MethodInterceptResult result) {
|
||||
Request request = (Request) interceptorContext.allArguments()[0];
|
||||
MethodInterceptResult result) {
|
||||
com.weibo.api.motan.rpc.Request request = (com.weibo.api.motan.rpc.Request) interceptorContext.allArguments()[0];
|
||||
if (request != null) {
|
||||
ContextData contextData = new RPCClientInvokeMonitor()
|
||||
.beforeInvoke(generateIdentify(request, (URL) context.get("serviceURI")));
|
||||
.beforeInvoke(generateIdentify(request, (com.weibo.api.motan.rpc.URL) context.get("serviceURI")));
|
||||
String contextDataStr = contextData.toString();
|
||||
request.setAttachment("contextData", contextDataStr);
|
||||
}
|
||||
|
|
@ -32,15 +35,28 @@ public class MotanClientInterceptor implements InstanceMethodsAroundInterceptor,
|
|||
|
||||
@Override
|
||||
public Object afterMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
|
||||
Object ret) {
|
||||
Object ret) {
|
||||
new RPCClientInvokeMonitor().afterInvoke();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Throwable t, EnhancedClassInstanceContext context,
|
||||
InstanceMethodInvokeContext interceptorContext) {
|
||||
InstanceMethodInvokeContext interceptorContext) {
|
||||
new RPCClientInvokeMonitor().occurException(t);
|
||||
}
|
||||
|
||||
|
||||
private static String generateViewPoint(URL serviceURI, Request request) {
|
||||
StringBuilder viewPoint = new StringBuilder(serviceURI.getUri());
|
||||
viewPoint.append("." + request.getMethodName());
|
||||
viewPoint.append("(" + request.getParamtersDesc() + ")?group=" + serviceURI.getGroup());
|
||||
return viewPoint.toString();
|
||||
}
|
||||
|
||||
|
||||
public static Identification generateIdentify(Request request, URL serviceURI) {
|
||||
return Identification.newBuilder().viewPoint(generateViewPoint(serviceURI, request))
|
||||
.spanType(MotanBuriedPointType.instance()).build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,13 @@ package com.a.eye.skywalking.plugin.motan;
|
|||
|
||||
import com.a.eye.skywalking.invoke.monitor.RPCServerInvokeMonitor;
|
||||
import com.a.eye.skywalking.model.ContextData;
|
||||
import com.a.eye.skywalking.model.Identification;
|
||||
import com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.*;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.ConstructorInvokeContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceConstructorInterceptor;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodInvokeContext;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
|
||||
import com.a.eye.skywalking.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import com.weibo.api.motan.rpc.Request;
|
||||
import com.weibo.api.motan.rpc.URL;
|
||||
|
||||
|
|
@ -15,24 +20,38 @@ public class MotanServerInterceptor implements InstanceConstructorInterceptor, I
|
|||
|
||||
@Override
|
||||
public void beforeMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
|
||||
MethodInterceptResult result) {
|
||||
Request request = (Request) interceptorContext.allArguments()[0];
|
||||
MethodInterceptResult result) {
|
||||
com.weibo.api.motan.rpc.Request request = (com.weibo.api.motan.rpc.Request) interceptorContext.allArguments()[0];
|
||||
if (request != null) {
|
||||
new RPCServerInvokeMonitor().beforeInvoke(new ContextData(request.getAttachments().get("contextData")),
|
||||
IdentificationUtil.generateIdentify(request, (URL) context.get("serviceURI")));
|
||||
generateIdentify(request, (com.weibo.api.motan.rpc.URL) context.get("serviceURI")));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
|
||||
Object ret) {
|
||||
Object ret) {
|
||||
new RPCServerInvokeMonitor().afterInvoke();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Throwable t, EnhancedClassInstanceContext context,
|
||||
InstanceMethodInvokeContext interceptorContext) {
|
||||
InstanceMethodInvokeContext interceptorContext) {
|
||||
new RPCServerInvokeMonitor().occurException(t);
|
||||
}
|
||||
|
||||
|
||||
private static String generateViewPoint(URL serviceURI, Request request) {
|
||||
StringBuilder viewPoint = new StringBuilder(serviceURI.getUri());
|
||||
viewPoint.append("." + request.getMethodName());
|
||||
viewPoint.append("(" + request.getParamtersDesc() + ")?group=" + serviceURI.getGroup());
|
||||
return viewPoint.toString();
|
||||
}
|
||||
|
||||
|
||||
public static Identification generateIdentify(Request request, URL serviceURI) {
|
||||
return Identification.newBuilder().viewPoint(generateViewPoint(serviceURI, request))
|
||||
.spanType(MotanBuriedPointType.instance()).build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class TraceIdPatternConverterActivation extends ClassInstanceMethodsEnhan
|
|||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return "PrintTraceIdInterceptor";
|
||||
return "com.a.eye.skywalking.toolkit.activation.log.log4j.v1.x.PrintTraceIdInterceptor";
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class Log4j2OutputAppenderActivation extends ClassStaticMethodsEnhancePlu
|
|||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return "PrintTraceIdInterceptor";
|
||||
return "com.a.eye.skywalking.toolkit.log.log4j.v2.x.PrintTraceIdInterceptor";
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class LogbackPatternConverterActivation extends ClassInstanceMethodsEnhan
|
|||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return "PrintTraceIdInterceptor";
|
||||
return "com.a.eye.skywalking.toolkit.log.logback.v1.x.PrintTraceIdInterceptor";
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class IndexOperator {
|
|||
|
||||
IndexMetaCollection collection = new IndexMetaCollection();
|
||||
SearchResponse response =
|
||||
client.prepareSearch(INDEX_NAME).setTypes(INDEX_TYPE).setQuery(queryBuilder).execute().actionGet();
|
||||
client.prepareSearch(INDEX_NAME).setTypes(INDEX_TYPE).setFrom(0).setSize(10000).setQuery(queryBuilder).execute().actionGet();
|
||||
for (SearchHit hit : response.getHits()) {
|
||||
DataFileNameDesc desc = new DataFileNameDesc(Long.parseLong(hit.getSource().get("fileName").toString()),
|
||||
Integer.parseInt(hit.getSource().get("fileName_suffix").toString()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue