Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 12 additions & 0 deletions tracer/src/Datadog.Trace/Configuration/ApmTracingConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ private static LibConfig MergeLibConfigs(LibConfig higher, LibConfig lower)
ServiceMapping = higher.ServiceMapping ?? lower.ServiceMapping,
DataStreamsEnabled = higher.DataStreamsEnabled ?? lower.DataStreamsEnabled,
SpanSamplingRules = higher.SpanSamplingRules ?? lower.SpanSamplingRules,
DynamicInstrumentationEnabled = higher.DynamicInstrumentationEnabled ?? lower.DynamicInstrumentationEnabled,
ExceptionReplayEnabled = higher.ExceptionReplayEnabled ?? lower.ExceptionReplayEnabled,
CodeOriginEnabled = higher.CodeOriginEnabled ?? lower.CodeOriginEnabled
};
}
}
Expand Down Expand Up @@ -181,5 +184,14 @@ internal class LibConfig

[JsonProperty("span_sampling_rules")]
public object? SpanSamplingRules { get; set; }

[JsonProperty("dynamic_instrumentation_enabled")]
public bool? DynamicInstrumentationEnabled { get; set; }

[JsonProperty("exception_replay_enabled")]
public bool? ExceptionReplayEnabled { get; set; }

[JsonProperty("code_origin_enabled")]
public bool? CodeOriginEnabled { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ private static bool IsLibConfigComplete(LibConfig libConfig)
RuntimeMetricsEnabled: not null,
ServiceMapping: not null,
DataStreamsEnabled: not null,
SpanSamplingRules: not null
SpanSamplingRules: not null,
DynamicInstrumentationEnabled: not null,
ExceptionReplayEnabled: not null,
CodeOriginEnabled: not null
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ internal class DynamicConfigConfigurationSource : JsonConfigurationSource
{ ConfigurationKeys.CustomSamplingRules, "tracing_sampling_rules" },
// { ConfigurationKeys.SpanSamplingRules, "span_sampling_rules" },
// { ConfigurationKeys.DataStreamsMonitoring.Enabled, "data_streams_enabled" },
{ ConfigurationKeys.GlobalTags, "tracing_tags" }
{ ConfigurationKeys.GlobalTags, "tracing_tags" },
{ ConfigurationKeys.Debugger.DynamicInstrumentationEnabled, "dynamic_instrumentation_enabled" },
{ ConfigurationKeys.Debugger.ExceptionReplayEnabled, "exception_replay_enabled" },
{ ConfigurationKeys.Debugger.CodeOriginForSpansEnabled, "code_origin_enabled" },
};

internal DynamicConfigConfigurationSource(string json, ConfigurationOrigins origin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ await RunDynamicConfigurationTest(
memoryAssertions.NoObjectsExist<LineProbeResolver>();
memoryAssertions.NoObjectsExist<Symbols.SymbolsUploader>();
},
remoteConfig: new { DD_DYNAMIC_INSTRUMENTATION_ENABLED = true },
remoteConfig: new { dynamic_instrumentation_enabled = true },
DynamicInstrumentationEnabledLogEntry,
finalMemoryAssertions: memoryAssertions =>
{
Expand All @@ -88,7 +88,7 @@ await RunDynamicConfigurationTest(
// Initially, no Exception Replay objects should exist
memoryAssertions.NoObjectsExist<ExceptionAutoInstrumentation.ExceptionReplay>();
},
remoteConfig: new { DD_EXCEPTION_REPLAY_ENABLED = true },
remoteConfig: new { exception_replay_enabled = true },
ExceptionReplayEnabledLogEntry);
}

Expand All @@ -108,7 +108,7 @@ await RunDynamicConfigurationTest(
// Initially, no Code Origin object should exist
memoryAssertions.NoObjectsExist<SpanCodeOrigin.SpanCodeOrigin>();
},
remoteConfig: new { DD_CODE_ORIGIN_FOR_SPANS_ENABLED = true },
remoteConfig: new { code_origin_enabled = true },
CodeOriginForSpansEnabledLogEntry);
}

Expand All @@ -135,9 +135,9 @@ await RunDynamicConfigurationTest(
},
remoteConfig: new
{
DD_DYNAMIC_INSTRUMENTATION_ENABLED = true,
DD_EXCEPTION_REPLAY_ENABLED = true,
DD_CODE_ORIGIN_FOR_SPANS_ENABLED = true
dynamic_instrumentation_enabled = true,
exception_replay_enabled = true,
code_origin_enabled = true
},
ExceptionReplayEnabledLogEntry,
finalMemoryAssertions: memoryAssertions =>
Expand Down Expand Up @@ -173,7 +173,7 @@ await RunDynamicConfigurationTest(
memoryAssertions.ObjectsExist<LineProbeResolver>();
memoryAssertions.ObjectsExist<Symbols.SymbolsUploader>();
},
remoteConfig: new { DD_DYNAMIC_INSTRUMENTATION_ENABLED = false },
remoteConfig: new { dynamic_instrumentation_enabled = false },
$"Dynamic Instrumentation {DisabledByRemoteConfiguration}",
finalMemoryAssertions: memoryAssertions =>
{
Expand Down Expand Up @@ -201,7 +201,7 @@ await RunDynamicConfigurationTest(
// Initially, Exception Replay objects should exist
memoryAssertions.ObjectsExist<ExceptionAutoInstrumentation.ExceptionReplay>();
},
remoteConfig: new { DD_EXCEPTION_REPLAY_ENABLED = false },
remoteConfig: new { exception_replay_enabled = false },
$"Exception Replay {DisabledByRemoteConfiguration}");
}

Expand All @@ -222,7 +222,7 @@ await RunDynamicConfigurationTest(
// Initially, Code Origin object should exist
memoryAssertions.ObjectsExist<SpanCodeOrigin.SpanCodeOrigin>();
},
remoteConfig: new { DD_CODE_ORIGIN_FOR_SPANS_ENABLED = false },
remoteConfig: new { code_origin_enabled = false },
$"Code Origin for Spans {DisabledByRemoteConfiguration}");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ public void DynamicConfigConfigurationSource_JTokenConstructor_ProducesSameResul
tracing_enabled = true,
log_injection_enabled = false,
tracing_sampling_rate = 0.75,
tracing_tags = new[] { "key1:value1", "key2:value2" }
tracing_tags = new[] { "key1:value1", "key2:value2" },
dynamic_instrumentation_enabled = true,
exception_replay_enabled = true,
code_origin_enabled = true,
}
};

Expand All @@ -244,6 +247,15 @@ public void DynamicConfigConfigurationSource_JTokenConstructor_ProducesSameResul
var stringTags = stringBuilder.WithKeys(ConfigurationKeys.GlobalTags).AsDictionary();
var jTokenTags = jTokenBuilder.WithKeys(ConfigurationKeys.GlobalTags).AsDictionary();
stringTags.Should().BeEquivalentTo(jTokenTags);

stringBuilder.WithKeys(ConfigurationKeys.Debugger.DynamicInstrumentationEnabled).AsBool().Should()
.Be(jTokenBuilder.WithKeys(ConfigurationKeys.Debugger.DynamicInstrumentationEnabled).AsBool());

stringBuilder.WithKeys(ConfigurationKeys.Debugger.ExceptionReplayEnabled).AsBool().Should()
.Be(jTokenBuilder.WithKeys(ConfigurationKeys.Debugger.ExceptionReplayEnabled).AsBool());

stringBuilder.WithKeys(ConfigurationKeys.Debugger.CodeOriginForSpansEnabled).AsBool().Should()
.Be(jTokenBuilder.WithKeys(ConfigurationKeys.Debugger.CodeOriginForSpansEnabled).AsBool());
}

private static ConfigurationBuilder CreateConfig(params (string Key, object Value)[] settings)
Expand Down
Loading