Avoid webflux plugin generating many endpoints & optimization http plugin toPath method (#2718)

* Avoid webflux plugin generating many endpoints
This commit is contained in:
于玉桔 2019-05-20 15:34:07 +08:00 committed by 吴晟 Wu Sheng
parent 7b21c337e0
commit 90fe05b1d9
3 changed files with 16 additions and 5 deletions

View File

@ -46,7 +46,7 @@ public class OnInboundNextInterceptor implements InstanceMethodsAroundIntercepto
}
if (allArguments[1] instanceof HttpRequest) {
AbstractSpan span = ContextManager.createEntrySpan(request.uri(), contextCarrier);
AbstractSpan span = ContextManager.createEntrySpan(toPath(request.uri()), contextCarrier);
Tags.URL.set(span, request.uri());
Tags.HTTP.METHOD.set(span, request.method().name());
span.setComponent(ComponentsDefine.SPRING_MVC_ANNOTATION);
@ -65,4 +65,13 @@ public class OnInboundNextInterceptor implements InstanceMethodsAroundIntercepto
Class<?>[] argumentsTypes, Throwable t) {
ContextManager.activeSpan().errorOccurred().log(t);
}
private static String toPath(String uri) {
int index = uri.indexOf("?");
if (index > -1) {
return uri.substring(0, index);
} else {
return uri;
}
}
}

View File

@ -86,8 +86,9 @@ public class HttpClientRequestImplEndInterceptor implements InstanceMethodsAroun
}
private static String toPath(String uri) {
if (uri.contains("?")) {
return uri.substring(0, uri.indexOf("?"));
int index = uri.indexOf("?");
if (index > -1) {
return uri.substring(0, index);
} else {
return uri;
}

View File

@ -73,8 +73,9 @@ public class RouterImplAcceptInterceptor implements InstanceMethodsAroundInterce
}
private static String toPath(String uri) {
if (uri.contains("?")) {
return uri.substring(0, uri.indexOf("?"));
int index = uri.indexOf("?");
if (index > -1) {
return uri.substring(0, index);
} else {
return uri;
}