提交 2e2616d0 编写于 作者: Z zhangwei 提交者: wu-sheng

[test/plugin] spring async scenario optimize (#3723)

* optimize

* fix license header
上级 f471293c
......@@ -13,22 +13,22 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
registryItems:
applications:
- {spring-async-scenario: 2}
instances:
- {spring-async-scenario: 1}
operationNames:
- spring-async-scenario: [/spring-async-scenario/case/healthCheck, /spring-async-scenario/case/spring-async,
/zh/team/]
- spring-async-scenario: [/spring-async-scenario/case/asyncVisit, /spring-async-scenario/case/spring-async]
heartbeat: []
segmentItems:
- applicationCode: spring-async-scenario
segmentSize: ge 4
segmentSize: gt 5
segments:
- segmentId: not null
spans:
- operationName: /spring-async-scenario/case/healthCheck
- operationName: /spring-async-scenario/case/spring-async
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -42,11 +42,11 @@ segmentItems:
peer: ''
peerId: 0
tags:
- {key: url, value: 'http://localhost:8080/spring-async-scenario/case/healthCheck'}
- {key: http.method, value: HEAD}
- {key: url, value: 'http://localhost:8080/spring-async-scenario/case/spring-async'}
- {key: http.method, value: GET}
- segmentId: not null
spans:
- operationName: /spring-async-scenario/case/spring-async
- operationName: /spring-async-scenario/case/asyncVisit
operationId: 0
parentSpanId: -1
spanId: 0
......@@ -60,11 +60,39 @@ segmentItems:
peer: ''
peerId: 0
tags:
- {key: url, value: 'http://localhost:8080/spring-async-scenario/case/spring-async'}
- {key: url, value: 'http://localhost:8080/spring-async-scenario/case/asyncVisit'}
- {key: http.method, value: GET}
refs:
- {parentEndpointId: 0, parentEndpoint: SpringAsync, networkAddressId: 0, entryEndpointId: 0,
refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null,
parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /spring-async-scenario/case/spring-async,
entryServiceInstanceId: 1}
- segmentId: not null
spans:
- operationName: /zh/team/
- operationName: /spring-async-scenario/case/asyncVisit
operationId: 0
parentSpanId: -1
spanId: 0
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 1
componentName: ''
isError: false
spanType: Entry
peer: ''
peerId: 0
tags:
- {key: url, value: 'http://localhost:8080/spring-async-scenario/case/asyncVisit'}
- {key: http.method, value: GET}
refs:
- {parentEndpointId: 0, parentEndpoint: SpringAsync, networkAddressId: 0, entryEndpointId: 0,
refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null,
parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /spring-async-scenario/case/spring-async,
entryServiceInstanceId: 1}
- segmentId: not null
spans:
- operationName: /spring-async-scenario/case/asyncVisit
operationId: 0
parentSpanId: 0
spanId: 1
......@@ -75,10 +103,10 @@ segmentItems:
componentName: ''
isError: false
spanType: Exit
peer: skywalking.apache.org:80
peer: localhost:8080
peerId: 0
tags:
- {key: url, value: 'http://skywalking.apache.org/zh/team/?k1=v'}
- {key: url, value: 'http://localhost:8080/spring-async-scenario/case/asyncVisit?by=system'}
- {key: http.method, value: GET}
- operationName: SpringAsync
operationId: 0
......@@ -101,7 +129,7 @@ segmentItems:
entryServiceInstanceId: 1}
- segmentId: not null
spans:
- operationName: /zh/team/
- operationName: /spring-async-scenario/case/asyncVisit
operationId: 0
parentSpanId: 0
spanId: 1
......@@ -112,10 +140,10 @@ segmentItems:
componentName: ''
isError: false
spanType: Exit
peer: skywalking.apache.org:80
peer: localhost:8080
peerId: 0
tags:
- {key: url, value: 'http://skywalking.apache.org/zh/team/?k2=v'}
- {key: url, value: 'http://localhost:8080/spring-async-scenario/case/asyncVisit?by=customize'}
- {key: http.method, value: GET}
- operationName: SpringAsync
operationId: 0
......@@ -136,4 +164,3 @@ segmentItems:
parentTraceSegmentId: not null, parentServiceInstanceId: 1,
networkAddress: '', entryEndpoint: /spring-async-scenario/case/spring-async,
entryServiceInstanceId: 1}
......@@ -34,11 +34,11 @@ public class AsyncBean {
@Async
public void sendVisitBySystem() throws IOException {
httpBean.visit("http://skywalking.apache.org/zh/team/?k1=v");
httpBean.visit("http://localhost:8080/spring-async-scenario/case/asyncVisit?by=system");
}
@Async("customizeAsync")
public void sendVisitByCustomize() throws IOException {
httpBean.visit("http://skywalking.apache.org/zh/team/?k2=v");
httpBean.visit("http://localhost:8080/spring-async-scenario/case/asyncVisit?by=customize");
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.skywalking.apm.testcase.spring.async;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
/**
* @author zhangwei
*/
public class AsyncServlet extends HttpServlet {
private static final long serialVersionUID = 4644954650555106445L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
PrintWriter writer = resp.getWriter();
writer.write("Success");
writer.flush();
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
this.doGet(req, resp);
}
}
......@@ -39,4 +39,13 @@
<servlet-name>healthCheck</servlet-name>
<url-pattern>/case/healthCheck</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>asyncVisit</servlet-name>
<servlet-class>org.apache.skywalking.apm.testcase.spring.async.AsyncServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>asyncVisit</servlet-name>
<url-pattern>/case/asyncVisit</url-pattern>
</servlet-mapping>
</web-app>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册