Skip to content

Commit

Permalink
Debug print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahchen6 committed Nov 21, 2024
1 parent 4b96be1 commit 6b10416
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,14 @@ public AgentSpan onRequest(final AgentSpan span, final REQUEST request) {
String method = method(request);
span.setTag(Tags.HTTP_METHOD, method);

System.out.println("In onRequest method in HttpClientDecorator");
if (CLIENT_TAG_HEADERS) {
System.out.println("Tagging client headers...");
for (Map.Entry<String, String> headerTag :
traceConfig(span).getRequestHeaderTags().entrySet()) {
String headerValue = getRequestHeader(request, headerTag.getKey());
System.out.println("headerTag: " + headerTag.getValue());
System.out.println("headerValue: " + headerValue);
if (null != headerValue) {
span.setTag(headerTag.getValue(), headerValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpRequest;
Expand Down Expand Up @@ -51,14 +52,18 @@ protected int status(final HttpResponse httpResponse) {

@Override
protected String getRequestHeader(HttpRequest request, String headerName) {
System.out.println("headerName: " + headerName);
System.out.println("headers: " + Arrays.toString(request.getHeaders(headerName)));
Header[] headers = request.getHeaders(headerName);
List<String> values = new ArrayList<>();
if (headers.length > 0) {
for (Header header : headers) {
values.add(header.getValue());
}
System.out.println("returning " + String.join(",", values));
return String.join(",", values);
}
System.out.println("returning null");
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ abstract class HttpClientTest extends VersionedNamingTestBase {
def "test request header #header tag mapping"() {
when:
def url = server.address.resolve("/success")
System.out.println("testing header, value, value2: " + header + ", " + value + ", " + value2)
String[] headerVals = [header + ":" + value , header + ":" + value2]
def status = (value2 == null) ? doRequest(method, url, [(header): value]) : doRequest(method, url, headerVals)
if (isDataStreamsEnabled()) {
Expand Down

0 comments on commit 6b10416

Please sign in to comment.