Skip to content

Commit

Permalink
debug more
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahchen6 committed Dec 6, 2024
1 parent 2223375 commit a3ef21a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class TagsAssert {
this.spanParentId = span.parentId
this.tags = span.tags
}
// DDSpan [ t_id=86, s_id=85, p_id=0 ] trace=worker.org.gradle.process.internal.worker.GradleWorkerMain/http.request/GET /success *measured* tags={_dd.agent_psr=1.0, _dd.dsm.enabled=1, _dd.profiling.ctx=test, _dd.profiling.enabled=0, _dd.trace_span_attribute_schema=0, _dd.tracer_host=COMP-GHXRH1QQ7F, _sample_rate=1, component=apache-httpclient5, http.method=GET, http.status_code=200, http.url=http://localhost:54233/success, language=jvm, pathway.hash=14628910375923456673, peer.hostname=localhost, peer.port=54233, process_id=72497, request_header_tag=foo,bar,baz, runtime-id=a74ef0dc-8747-43f8-853c-02ddce42dcaa, span.kind=client, thread.id=1, thread.name=Test worker}, duration_ns=3604416, forceKeep=false, links=[]
// DDSpan [ t_id=86, s_id=87, p_id=85 ] trace=worker.org.gradle.process.internal.worker.GradleWorkerMain/test-http-server/test-http-server tags={_dd.dsm.enabled=1, _dd.profiling.ctx=test, _dd.profiling.enabled=0, _dd.trace_span_attribute_schema=0, _dd.tracer_host=COMP-GHXRH1QQ7F, _sample_rate=1, language=jvm, path=/success, process_id=72497, request_header_tag=foo,bar, runtime-id=a74ef0dc-8747-43f8-853c-02ddce42dcaa, span.kind=server, thread.id=27, thread.name=qtp897087270-27}, duration_ns=58625, forceKeep=false, links=[]

static void assertTags(DDSpan span,
@ClosureParams(value = SimpleType, options = ['datadog.trace.agent.test.asserts.TagsAssert'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class TestHttpServer implements AutoCloseable {
clone.resolveStrategy = Closure.DELEGATE_FIRST

try {
clone(api) // come back to here!!!
clone(api)
} catch (Exception e) {
api.response.status(500).send(e.getMessage())
e.printStackTrace()
Expand Down Expand Up @@ -379,7 +379,6 @@ class TestHttpServer implements AutoCloseable {
isDDServer = Boolean.parseBoolean(request.getHeader("is-dd-server"))
}
if (isDDServer) {
// breakpoint with condition: this.req.headers.headers.get("X-Datadog-Test-Request-Header") != null
final AgentSpan.Context extractedContext = propagate().extract(req.orig, GETTER)
if (extractedContext != null) {
System.out.println("EXTRACTEDCONTEXT: " + extractedContext)
Expand Down Expand Up @@ -503,19 +502,10 @@ class TestHttpServer implements AutoCloseable {
static class Headers {
private final Map<String, String> headers

// FIX THIS...... setting header to wrong value, but also fails when header is hardcoded to correct value
private Headers(Request request) {
this.headers = [:]
request.getHeaderNames().each {
String tag = request.getHeader(it)
System.out.println("tag: " + tag)
if (tag == "foo,bar") {
headers.put(it, "foo,bar,baz")
System.out.println("set " + it + " to " + headers.get(it))
} else {
headers.put(it, tag)
}
// headers.put(it, request.getHeader(it))
headers.put(it, request.getHeader(it))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public void forEachKey(
System.out.println("value: " + carrier.getHeader(header));
System.out.println("========= END ACCEPT IS CALLED HERE =========");
}
// ISSUE HERE
// `getHeader` in Request.class:604 calls `get` in HttpFields.class:164
// which returns only the first value for the header, instead of all values
// for the header name.
if (!classifier.accept(header, carrier.getHeader(header))) {
return;
}
Expand Down

0 comments on commit a3ef21a

Please sign in to comment.