You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2019/05/20 07:34:15 UTC
[skywalking] branch master updated: Avoid webflux plugin generating
many endpoints & optimization http plugin toPath method (#2718)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 90fe05b Avoid webflux plugin generating many endpoints & optimization http plugin toPath method (#2718)
90fe05b is described below
commit 90fe05b1d99b5a32f5298126747d8a0b0c5e00e0
Author: 于玉桔 <76...@qq.com>
AuthorDate: Mon May 20 15:34:07 2019 +0800
Avoid webflux plugin generating many endpoints & optimization http plugin toPath method (#2718)
* Avoid webflux plugin generating many endpoints
---
.../plugin/spring/webflux/v5/OnInboundNextInterceptor.java | 11 ++++++++++-
.../plugin/vertx3/HttpClientRequestImplEndInterceptor.java | 5 +++--
.../apm/plugin/vertx3/RouterImplAcceptInterceptor.java | 5 +++--
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/webflux-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/webflux/v5/OnInboundNextInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/webflux-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/webflux/v5/OnInboundNextInterceptor.java
index e6031f7..fd279fe 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/webflux-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/webflux/v5/OnInboundNextInterceptor.java
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/webflux-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/webflux/v5/OnInboundNextInterceptor.java
@@ -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;
+ }
+ }
}
diff --git a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplEndInterceptor.java b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplEndInterceptor.java
index 55a75f3..229468e 100644
--- a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplEndInterceptor.java
+++ b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/HttpClientRequestImplEndInterceptor.java
@@ -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;
}
diff --git a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/RouterImplAcceptInterceptor.java b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/RouterImplAcceptInterceptor.java
index a534c30..f063a6a 100644
--- a/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/RouterImplAcceptInterceptor.java
+++ b/apm-sniffer/apm-sdk-plugin/vertx-plugins/vertx-core-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/vertx3/RouterImplAcceptInterceptor.java
@@ -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;
}