Skip to content

Commit

Permalink
exit spans should not be tagged
Browse files Browse the repository at this point in the history
  • Loading branch information
evanchooly committed Sep 9, 2024
1 parent 87d0a4b commit 0026f35
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static com.datadog.debugger.agent.ConfigurationAcceptor.Source.REMOTE_CONFIG;
import static com.datadog.debugger.util.TestHelper.setFieldInConfig;
import static datadog.trace.api.DDTags.DD_STACK_CODE_ORIGIN_FRAME;
import static datadog.trace.api.DDTags.DD_STACK_CODE_ORIGIN_TYPE;
import static java.lang.String.format;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
Expand Down Expand Up @@ -70,10 +71,10 @@ public class CodeOriginTest {
DDTags.DD_CODE_ORIGIN_METHOD_SIGNATURE);
private static final List<String> STACK_FRAME_TAGS =
asList(
format(DD_STACK_CODE_ORIGIN_FRAME, 0, "file"),
format(DD_STACK_CODE_ORIGIN_FRAME, 0, "line"),
format(DD_STACK_CODE_ORIGIN_FRAME, 0, "method"),
format(DD_STACK_CODE_ORIGIN_FRAME, 0, "type"));
format(DD_STACK_CODE_ORIGIN_FRAME, 0, 0, "file"),
format(DD_STACK_CODE_ORIGIN_FRAME, 0, 0, "line"),
format(DD_STACK_CODE_ORIGIN_FRAME, 0, 0, "method"),
format(DD_STACK_CODE_ORIGIN_FRAME, 0, 0, "type"));
private static final List<String> COMBO_TAGS = new ArrayList<>();

private final Instrumentation instr = ByteBuddyAgent.install();
Expand Down Expand Up @@ -105,6 +106,8 @@ public class CodeOriginTest {
static {
COMBO_TAGS.addAll(CODE_ORIGIN_TAGS);
COMBO_TAGS.addAll(STACK_FRAME_TAGS);

System.out.println("****** CodeOriginTest.static initializer COMBO_TAGS = " + COMBO_TAGS);
}

@Test
Expand Down Expand Up @@ -199,7 +202,7 @@ private static void checkForTags(
format(
"Existing keys for %s: %s",
span.getOperationName(), new TreeSet<>(span.getTags().keySet()));
assertEquals(span.getTag(DDTags.DD_STACK_CODE_ORIGIN_TYPE), spanType, keys);
assertEquals(span.getTag(format(DD_STACK_CODE_ORIGIN_TYPE, 0)), spanType, keys);
for (String tag : included) {
assertNotNull(span.getTag(tag), tag + " not found. " + keys);
}
Expand All @@ -219,11 +222,11 @@ private static void checkExitSpanTags(MutableSpan span) {
assertNull(span.getTag(DDTags.DD_CODE_ORIGIN_METHOD), keys);
assertNull(span.getTag(DDTags.DD_CODE_ORIGIN_METHOD_SIGNATURE), keys);

assertEquals(span.getTag(DDTags.DD_STACK_CODE_ORIGIN_TYPE), "exit", keys);
assertNotNull(span.getTag(format(DD_STACK_CODE_ORIGIN_FRAME, 0, "file")));
assertNotNull(span.getTag(format(DD_STACK_CODE_ORIGIN_FRAME, 0, "line")));
assertNotNull(span.getTag(format(DD_STACK_CODE_ORIGIN_FRAME, 0, "method")));
assertNotNull(span.getTag(format(DD_STACK_CODE_ORIGIN_FRAME, 0, "type")));
assertNull(span.getTag(format(DD_STACK_CODE_ORIGIN_TYPE, 1)), keys);
assertNull(span.getTag(format(DD_STACK_CODE_ORIGIN_FRAME, 1, 0, "file")));
assertNull(span.getTag(format(DD_STACK_CODE_ORIGIN_FRAME, 1, 0, "line")));
assertNull(span.getTag(format(DD_STACK_CODE_ORIGIN_FRAME, 1, 0, "method")));
assertNull(span.getTag(format(DD_STACK_CODE_ORIGIN_FRAME, 1, 0, "type")));
}

public static Config createConfig() {
Expand Down

0 comments on commit 0026f35

Please sign in to comment.