Fix profile recheck error (#4690)

This commit is contained in:
mrproliu 2020-04-22 19:25:56 +08:00 committed by GitHub
parent e28e2f48b4
commit 4e821415ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 37 additions and 356 deletions

View File

@ -96,7 +96,7 @@
<property name="format" value="(^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$)"/>
</module>
<module name="PackageName">
<property name="format" value="^org\.apache\.skywalking(\.[a-zA-Z][a-zA-Z0-9]*)+$"/>
<property name="format" value="^(org|test)\.apache\.skywalking(\.[a-zA-Z][a-zA-Z0-9]*)+$"/>
</module>
<module name="ParameterName"/>
<module name="StaticVariableName">

View File

@ -80,7 +80,7 @@ public final class Tags {
public static final class HTTP {
public static final StringTag METHOD = new StringTag(10, "http.method");
public static final StringTag PARAMS = new StringTag(11, "http.params");
public static final StringTag PARAMS = new StringTag(11, "http.params", true);
}
/**

View File

@ -50,7 +50,12 @@ public class ThreadProfiler {
this.traceSegmentId = traceSegmentId;
this.profilingThread = profilingThread;
this.executionContext = executionContext;
this.profilingStatus = ProfileStatusReference.createWithPending();
if (tracingContext.profileStatus() == null) {
this.profilingStatus = ProfileStatusReference.createWithPending();
} else {
this.profilingStatus = tracingContext.profileStatus();
this.profilingStatus.updateStatus(ProfileStatus.PENDING);
}
this.profilingMaxTimeMills = TimeUnit.MINUTES.toMillis(Config.Profile.MAX_DURATION);
}

View File

@ -23,7 +23,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.apache.skywalking.e2e.verification.AbstractMatcher;
import org.assertj.core.api.Assertions;
@Data
@ToString(callSuper = true)
@ -34,12 +33,22 @@ public class ProfileStackTreeMatcher extends AbstractMatcher<ProfileAnalyzation.
@Override
public void verify(ProfileAnalyzation.ProfileStackTree profileStackTree) {
Assertions.assertThat(profileStackTree.getElements()).hasSameSizeAs(this.elements);
int size = this.elements.size();
for (int i = 0; i < size; i++) {
elements.get(i).verify(profileStackTree.getElements().get(i));
boolean hasVerified = false;
for (int dataElement = 0; dataElement < profileStackTree.getElements().size(); dataElement++) {
try {
elements.get(i).verify(profileStackTree.getElements().get(dataElement));
hasVerified = true;
break;
} catch (Throwable e) {
}
}
if (!hasVerified) {
throw new IllegalStateException("Cannot found " + elements.get(i).getCodeSignature());
}
}
}
}

View File

@ -20,10 +20,12 @@ package org.apache.skywalking.e2e;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@EnableJpaRepositories
@SpringBootApplication
@ComponentScan({"org.apache.skywalking", "test.apache.skywalking"})
public class Service0Application {
public static void main(String[] args) {
SpringApplication.run(Service0Application.class, args);

View File

@ -16,7 +16,7 @@
*
*/
package org.apache.skywalking.e2e.profile;
package test.apache.skywalking.e2e.profile;
import lombok.Data;
import org.apache.skywalking.e2e.User;

View File

@ -16,7 +16,7 @@
*
*/
package org.apache.skywalking.e2e.profile;
package test.apache.skywalking.e2e.profile;
import java.util.concurrent.TimeUnit;
import lombok.RequiredArgsConstructor;
@ -31,7 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
public class ProfileController {
private final UserRepo userRepo;
@PostMapping("/profile/users")
@PostMapping("/profile/{name}")
public User createAuthor(@RequestBody final CreateUser createUser) throws InterruptedException {
final User user = userRepo.save(createUser.toUser());
if (createUser.isEnableProfiling()) {

View File

@ -141,7 +141,7 @@ public class ProfileE2E extends SkyWalkingTestAdapter {
void createProfileTask() throws Exception {
final ProfileTaskCreationRequest creationRequest = ProfileTaskCreationRequest.builder()
.serviceId("ZTJlLXByb2ZpbGUtc2VydmljZQ==.1")
.endpointName("/profile/users")
.endpointName("/profile/{name}")
.duration(1)
.startTime(-1)
.minDurationThreshold(1500)

View File

@ -14,5 +14,5 @@
# limitations under the License.
endpoints:
- key: ZTJlLXByb2ZpbGUtc2VydmljZQ==.1_L3Byb2ZpbGUvdXNlcnM=
label: /profile/users
- key: ZTJlLXByb2ZpbGUtc2VydmljZQ==.1_L3Byb2ZpbGUve25hbWV9
label: /profile/{name}

View File

@ -16,7 +16,7 @@
tasks:
- id: not null
serviceId: ZTJlLXByb2ZpbGUtc2VydmljZQ==.1
endpointName: /profile/users
endpointName: /profile/{name}
startTime: gt 0
duration: gt 0
minDurationThreshold: gt 0

View File

@ -16,7 +16,7 @@
tasks:
- id: not null
serviceId: ZTJlLXByb2ZpbGUtc2VydmljZQ==.1
endpointName: /profile/users
endpointName: /profile/{name}
startTime: gt 0
duration: gt 0
minDurationThreshold: gt 0

View File

@ -20,345 +20,9 @@ elements:
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 2
parentId: 1
codeSignature: not null
- id: gt 0
parentId: gt 0
codeSignature: test.apache.skywalking.e2e.profile.ProfileController.createAuthor:-1
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 3
parentId: 2
codeSignature: not null
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 4
parentId: 3
codeSignature: not null
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 5
parentId: 4
codeSignature: org.apache.tomcat.util.net.SocketProcessorBase.run:49
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 6
parentId: 5
codeSignature: org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun:1639
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 7
parentId: 6
codeSignature: org.apache.coyote.AbstractProtocol$ConnectionHandler.process:868
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 8
parentId: 7
codeSignature: org.apache.coyote.AbstractProcessorLight.process:65
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 9
parentId: 8
codeSignature: org.apache.coyote.http11.Http11Processor.service:367
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 10
parentId: 9
codeSignature: org.apache.catalina.connector.CoyoteAdapter.service:343
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 11
parentId: 10
codeSignature: org.apache.catalina.core.StandardEngineValve.invoke:74
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 12
parentId: 11
codeSignature: org.apache.catalina.valves.ErrorReportValve.invoke:92
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 13
parentId: 12
codeSignature: org.apache.catalina.core.StandardHostValve.invoke:-1
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 14
parentId: 13
codeSignature: org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept:86
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 15
parentId: 14
codeSignature: not null
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 16
parentId: 15
codeSignature: not null
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 17
parentId: 16
codeSignature: not null
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 18
parentId: 17
codeSignature: org.apache.catalina.authenticator.AuthenticatorBase.invoke:541
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 19
parentId: 18
codeSignature: org.apache.catalina.core.StandardContextValve.invoke:96
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 20
parentId: 19
codeSignature: org.apache.catalina.core.StandardWrapperValve.invoke:202
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 21
parentId: 20
codeSignature: org.apache.catalina.core.ApplicationFilterChain.doFilter:166
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 22
parentId: 21
codeSignature: org.apache.catalina.core.ApplicationFilterChain.internalDoFilter:193
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 23
parentId: 22
codeSignature: org.springframework.web.filter.OncePerRequestFilter.doFilter:119
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 24
parentId: 23
codeSignature: org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal:201
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 25
parentId: 24
codeSignature: org.apache.catalina.core.ApplicationFilterChain.doFilter:166
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 26
parentId: 25
codeSignature: org.apache.catalina.core.ApplicationFilterChain.internalDoFilter:193
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 27
parentId: 26
codeSignature: org.springframework.web.filter.OncePerRequestFilter.doFilter:119
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 28
parentId: 27
codeSignature: org.springframework.web.filter.FormContentFilter.doFilterInternal:93
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 29
parentId: 28
codeSignature: org.apache.catalina.core.ApplicationFilterChain.doFilter:166
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 30
parentId: 29
codeSignature: org.apache.catalina.core.ApplicationFilterChain.internalDoFilter:193
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 31
parentId: 30
codeSignature: org.springframework.web.filter.OncePerRequestFilter.doFilter:119
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 32
parentId: 31
codeSignature: org.springframework.web.filter.RequestContextFilter.doFilterInternal:100
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 33
parentId: 32
codeSignature: org.apache.catalina.core.ApplicationFilterChain.doFilter:166
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 34
parentId: 33
codeSignature: org.apache.catalina.core.ApplicationFilterChain.internalDoFilter:193
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 35
parentId: 34
codeSignature: org.apache.tomcat.websocket.server.WsFilter.doFilter:53
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 36
parentId: 35
codeSignature: org.apache.catalina.core.ApplicationFilterChain.doFilter:166
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 37
parentId: 36
codeSignature: org.apache.catalina.core.ApplicationFilterChain.internalDoFilter:231
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 38
parentId: 37
codeSignature: javax.servlet.http.HttpServlet.service:741
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 39
parentId: 38
codeSignature: org.springframework.web.servlet.FrameworkServlet.service:883
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 40
parentId: 39
codeSignature: javax.servlet.http.HttpServlet.service:660
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 41
parentId: 40
codeSignature: org.springframework.web.servlet.FrameworkServlet.doPost:909
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 42
parentId: 41
codeSignature: org.springframework.web.servlet.FrameworkServlet.processRequest:1006
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 43
parentId: 42
codeSignature: org.springframework.web.servlet.DispatcherServlet.doService:943
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 44
parentId: 43
codeSignature: org.springframework.web.servlet.DispatcherServlet.doDispatch:1040
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 45
parentId: 44
codeSignature: org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle:87
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 46
parentId: 45
codeSignature: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal:793
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 47
parentId: 46
codeSignature: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod:879
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 48
parentId: 47
codeSignature: org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle:106
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 49
parentId: 48
codeSignature: org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest:138
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 50
parentId: 49
codeSignature: org.springframework.web.method.support.InvocableHandlerMethod.doInvoke:190
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 51
parentId: 50
codeSignature: not null
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 52
parentId: 51
codeSignature: not null
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 53
parentId: 52
codeSignature: not null
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 54
parentId: 53
codeSignature: not null
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 55
parentId: 54
codeSignature: org.apache.skywalking.e2e.profile.ProfileController.createAuthor:38
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 56
parentId: 55
codeSignature: not null
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 57
parentId: 56
codeSignature: not null
duration: gt 0
durationChildExcluded: 0
count: gt 0
- id: 58
parentId: 57
codeSignature: not null
duration: gt 0
durationChildExcluded: gt 0
count: gt 0

View File

@ -19,7 +19,7 @@ spans:
serviceCode: not null
startTime: gt 0
endTime: gt 0
endpointName: /profile/users
endpointName: /profile/{name}
tags:
- key: url
value: not null

View File

@ -16,7 +16,7 @@
traces:
- key: not null
endpointNames:
- /profile/users
- /profile/{name}
duration: ge 0
start: gt 0
isError: false

View File

@ -32,6 +32,7 @@ for exec_data in "${JACOCO_HOME}"/*.exec; do
sudo rm -rf "${JACOCO_HOME}"/classes/"${exec_data}"/org/apache/skywalking/oap/server/core/query/entity || true
sudo rm -rf "${JACOCO_HOME}"/classes/"${exec_data}"/org/apache/skywalking/testcase || true
sudo rm -rf "${JACOCO_HOME}"/classes/"${exec_data}"/org/apache/skywalking/e2e || true
sudo rm -rf "${JACOCO_HOME}"/classes/"${exec_data}"/test/apache/skywalking/e2e || true
java -jar "${JACOCO_HOME}"/jacococli.jar report \
--classfiles "${JACOCO_HOME}"/classes/"$exec_data" \