Skip to content
Merged

Fix #18

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import java.net.URI;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.HashMap;
import java.util.Map;

public class HttpClientSendInterceptor implements InstanceMethodsAroundInterceptor {

Expand Down Expand Up @@ -67,7 +69,9 @@ public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allA
span.errorOccurred();
}
} else {
Tags.HTTP_RESPONSE_STATUS_CODE.set(span, 404);
Map<String, String> eventMap = new HashMap<String, String>();
eventMap.put("error", "No response");
span.log(System.currentTimeMillis(), eventMap);
span.errorOccurred();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.HierarchyMatch;

import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;

public class HttpRequestInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {

private static final String ENHANCE_PARENT_CLASS = "java.net.http.HttpRequest";
private static final String ENHANCE_CLASS = "jdk.internal.net.http.ImmutableHttpRequest";

private static final String INTERCEPT_HEADERS_METHOD = "headers";

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

@Override
protected ClassMatch enhanceClass() {
return HierarchyMatch.byHierarchyMatch(ENHANCE_PARENT_CLASS);
return byName(ENHANCE_CLASS);
}

@Override
Expand Down
Loading