Skip to content

Commit b58fa70

Browse files
authored
Merge pull request #18 from peachisai/uat
Fix
2 parents 88e0982 + dcf1013 commit b58fa70

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/HttpClientSendInterceptor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import java.net.URI;
3333
import java.net.http.HttpRequest;
3434
import java.net.http.HttpResponse;
35+
import java.util.HashMap;
36+
import java.util.Map;
3537

3638
public class HttpClientSendInterceptor implements InstanceMethodsAroundInterceptor {
3739

@@ -67,7 +69,9 @@ public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allA
6769
span.errorOccurred();
6870
}
6971
} else {
70-
Tags.HTTP_RESPONSE_STATUS_CODE.set(span, 404);
72+
Map<String, String> eventMap = new HashMap<String, String>();
73+
eventMap.put("error", "No response");
74+
span.log(System.currentTimeMillis(), eventMap);
7175
span.errorOccurred();
7276
}
7377

apm-sniffer/bootstrap-plugins/jdk-httpclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/define/HttpRequestInstrumentation.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
2626
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
2727
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
28-
import org.apache.skywalking.apm.agent.core.plugin.match.HierarchyMatch;
28+
29+
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
2930

3031
public class HttpRequestInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
3132

32-
private static final String ENHANCE_PARENT_CLASS = "java.net.http.HttpRequest";
33+
private static final String ENHANCE_CLASS = "jdk.internal.net.http.ImmutableHttpRequest";
3334

3435
private static final String INTERCEPT_HEADERS_METHOD = "headers";
3536

@@ -47,7 +48,7 @@ public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
4748

4849
@Override
4950
protected ClassMatch enhanceClass() {
50-
return HierarchyMatch.byHierarchyMatch(ENHANCE_PARENT_CLASS);
51+
return byName(ENHANCE_CLASS);
5152
}
5253

5354
@Override

0 commit comments

Comments
 (0)