Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#8557] Send caller app name #8570

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[#8557] add jdk http support
  • Loading branch information
yjqg6666 committed Dec 30, 2021
commit be20ec5d62fe0f5751bc9f85e5edc961e0d29e07
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public abstract class AbstractHttpURLConnectionInterceptor implements AroundInte
private final ServerResponseHeaderRecorder<HttpURLConnection> responseHeaderRecorder;

private final RequestTraceWriter<HttpURLConnection> requestTraceWriter;
private final ApplicationInfoSender<HttpURLConnection> applicationInfoSender;

public AbstractHttpURLConnectionInterceptor(TraceContext traceContext, MethodDescriptor descriptor, InterceptorScope scope) {
this.traceContext = traceContext;
Expand All @@ -63,6 +64,7 @@ public AbstractHttpURLConnectionInterceptor(TraceContext traceContext, MethodDes

ClientHeaderAdaptor<HttpURLConnection> clientHeaderAdaptor = new HttpURLConnectionClientHeaderAdaptor();
this.requestTraceWriter = new DefaultRequestTraceWriter<>(clientHeaderAdaptor, traceContext);
this.applicationInfoSender = new DefaultApplicationInfoSender<>(clientHeaderAdaptor, traceContext);
}

abstract boolean isConnected(Object target);
Expand Down Expand Up @@ -111,6 +113,11 @@ public void before(Object target, Object[] args) {
this.requestTraceWriter.write(request);
}
}

if (addRequestHeader) {
this.applicationInfoSender.sendCallerApplicationName(request);
}

}

private boolean canAddHeaderToRequest(Object target) {
Expand Down