From 4e821415ea8b930d3c089346d86c650788cbbf8a Mon Sep 17 00:00:00 2001 From: mrproliu <741550557@qq.com> Date: Wed, 22 Apr 2020 19:25:56 +0800 Subject: [PATCH] Fix profile recheck error (#4690) --- apm-checkstyle/checkStyle.xml | 2 +- .../apm/agent/core/context/tag/Tags.java | 2 +- .../agent/core/profile/ThreadProfiler.java | 7 +- .../query/ProfileStackTreeMatcher.java | 17 +- .../skywalking/e2e/Service0Application.java | 2 + .../skywalking/e2e/profile/CreateUser.java | 2 +- .../e2e/profile/ProfileController.java | 4 +- .../skywalking/e2e/profile/ProfileE2E.java | 2 +- .../resources/expected/profile/endpoints.yml | 4 +- .../resources/expected/profile/finished.yml | 2 +- .../resources/expected/profile/notified.yml | 2 +- .../expected/profile/profileAnayzation.yml | 342 +----------------- .../expected/profile/profileSegment.yml | 2 +- .../expected/profile/profileSegments.yml | 2 +- tools/coverage/report.sh | 1 + 15 files changed, 37 insertions(+), 356 deletions(-) rename test/e2e/e2e-service-provider/src/main/java/{org => test}/apache/skywalking/e2e/profile/CreateUser.java (95%) rename test/e2e/e2e-service-provider/src/main/java/{org => test}/apache/skywalking/e2e/profile/ProfileController.java (95%) diff --git a/apm-checkstyle/checkStyle.xml b/apm-checkstyle/checkStyle.xml index daa3e206c5..9958d8f374 100755 --- a/apm-checkstyle/checkStyle.xml +++ b/apm-checkstyle/checkStyle.xml @@ -96,7 +96,7 @@ - + diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java index bafa79902b..9d36386aae 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java @@ -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); } /** diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/profile/ThreadProfiler.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/profile/ThreadProfiler.java index 37254b0e08..856f129002 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/profile/ThreadProfiler.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/profile/ThreadProfiler.java @@ -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); } diff --git a/test/e2e/e2e-data/src/main/java/org/apache/skywalking/e2e/profile/query/ProfileStackTreeMatcher.java b/test/e2e/e2e-data/src/main/java/org/apache/skywalking/e2e/profile/query/ProfileStackTreeMatcher.java index b9eeeaf70c..a59a7ad719 100644 --- a/test/e2e/e2e-data/src/main/java/org/apache/skywalking/e2e/profile/query/ProfileStackTreeMatcher.java +++ b/test/e2e/e2e-data/src/main/java/org/apache/skywalking/e2e/profile/query/ProfileStackTreeMatcher.java @@ -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