Skip to content

Commit

Permalink
Fix tracer enabled detection default value
Browse files Browse the repository at this point in the history
Checking for trace enabled needs to be true by default if no token
  • Loading branch information
jpbempel committed Nov 3, 2023
1 parent 23bbe14 commit ebc3241
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private CorrelationAccess() {
MethodHandle traceIdHandle = null;
MethodHandle spanIdHandle = null;
// ignore correlations if tracer is not enabled
if (ConfigProvider.getInstance().getBoolean(TraceInstrumentationConfig.TRACE_ENABLED, false)) {
if (ConfigProvider.getInstance().getBoolean(TraceInstrumentationConfig.TRACE_ENABLED, true)) {
try {
Class<?> clz =
ClassLoader.getSystemClassLoader().loadClass(CORRELATION_IDENTIFIER_CLASSNAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ public void fields() throws IOException, URISyntaxException {
int result = Reflect.on(testClass).call("main", "f").get();
assertEquals(42, result);
Snapshot snapshot = assertOneSnapshot(listener);
assertCaptureFieldCount(snapshot.getCaptures().getEntry(), 5);
assertCaptureFieldCount(snapshot.getCaptures().getEntry(), 7); // +2 for correlation ids
assertCaptureFields(snapshot.getCaptures().getEntry(), "intValue", "int", "24");
assertCaptureFields(snapshot.getCaptures().getEntry(), "doubleValue", "double", "3.14");
assertCaptureFields(
Expand All @@ -1158,7 +1158,7 @@ public void fields() throws IOException, URISyntaxException {
Arrays.asList("foo", "bar"));
assertCaptureFields(
snapshot.getCaptures().getEntry(), "strMap", "java.util.HashMap", Collections.emptyMap());
assertCaptureFieldCount(snapshot.getCaptures().getReturn(), 5);
assertCaptureFieldCount(snapshot.getCaptures().getReturn(), 7); // +2 for correlation ids
assertCaptureFields(snapshot.getCaptures().getReturn(), "intValue", "int", "48");
assertCaptureFields(snapshot.getCaptures().getReturn(), "doubleValue", "double", "3.14");
assertCaptureFields(snapshot.getCaptures().getReturn(), "strValue", "java.lang.String", "done");
Expand Down Expand Up @@ -1188,11 +1188,11 @@ public void inheritedFields() throws IOException, URISyntaxException {
assertEquals(42, result);
Snapshot snapshot = assertOneSnapshot(listener);
// Only Declared fields in the current class are captured, not inherited fields
assertCaptureFieldCount(snapshot.getCaptures().getEntry(), 5);
assertCaptureFieldCount(snapshot.getCaptures().getEntry(), 7); // +2 for correlation ids
assertCaptureFields(
snapshot.getCaptures().getEntry(), "strValue", "java.lang.String", "foobar");
assertCaptureFields(snapshot.getCaptures().getEntry(), "intValue", "int", "24");
assertCaptureFieldCount(snapshot.getCaptures().getReturn(), 5);
assertCaptureFieldCount(snapshot.getCaptures().getReturn(), 7); // +2 for correlation ids
assertCaptureFields(
snapshot.getCaptures().getReturn(), "strValue", "java.lang.String", "barfoo");
assertCaptureFields(snapshot.getCaptures().getEntry(), "intValue", "int", "24");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ private JsonSnapshotSerializer.IntakeRequest doTestTracer(LogProbe logProbe) thr
@Override
protected ProcessBuilder createProcessBuilder(Path logFilePath, String... params) {
List<String> commandParams = getDebuggerCommandParams();
commandParams.add("-Ddd.trace.enabled=true");
commandParams.add(
"-Ddd.trace.methods=datadog.smoketest.debugger.controller.WebController[processWithArg]");
return ProcessBuilderHelper.createProcessBuilder(
Expand Down

0 comments on commit ebc3241

Please sign in to comment.