Skip to content

Allow disabling remote config management explicitly #6942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 13, 2025
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
1 change: 1 addition & 0 deletions tracer/build/_build/docker/smoke.chiseled.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ ENV COMPlus_DbgEnableMiniDump=1
ENV COMPlus_DbgMiniDumpType=4
ENV DOTNET_DbgMiniDumpName=/dumps/coredump.%t.%p
ENV DOTNET_EnableCrashReport=1
ENV DD_REMOTE_CONFIGURATION_ENABLED=0

## SSI variables
ENV DD_INJECTION_ENABLED=tracer
Expand Down
1 change: 1 addition & 0 deletions tracer/build/_build/docker/smoke.dd-dotnet.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ ENV COMPlus_DbgEnableMiniDump=1
ENV COMPlus_DbgMiniDumpType=4
ENV DOTNET_DbgMiniDumpName=/dumps/coredump.%t.%p
ENV DOTNET_EnableCrashReport=1
ENV DD_REMOTE_CONFIGURATION_ENABLED=0

## SSI variables
ENV DD_INJECTION_ENABLED=tracer
Expand Down
1 change: 1 addition & 0 deletions tracer/build/_build/docker/smoke.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ENV LD_PRELOAD=/opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so
ENV DD_PROFILING_ENABLED=1
ENV DD_APPSEC_ENABLED=1
ENV DD_TRACE_DEBUG=1
ENV DD_REMOTE_CONFIGURATION_ENABLED=0

## SSI variables
ENV DD_INJECTION_ENABLED=tracer
Expand Down
1 change: 1 addition & 0 deletions tracer/build/_build/docker/smoke.dotnet-tool.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ RUN mkdir -p /opt/datadog \
ENV DD_PROFILING_ENABLED=1
ENV DD_APPSEC_ENABLED=1
ENV DD_TRACE_DEBUG=1
ENV DD_REMOTE_CONFIGURATION_ENABLED=0
ENV ASPNETCORE_URLS=http://localhost:5000

# Set a random env var we should ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ RUN mkdir -p /opt/datadog \
ENV DD_PROFILING_ENABLED=1
ENV DD_APPSEC_ENABLED=1
ENV DD_TRACE_DEBUG=1
ENV DD_REMOTE_CONFIGURATION_ENABLED=0
ENV ASPNETCORE_URLS=http://localhost:5000

# Set a random env var we should ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ENV LD_PRELOAD=/opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so
ENV DD_PROFILING_ENABLED=1
ENV DD_APPSEC_ENABLED=1
ENV DD_TRACE_DEBUG=1
ENV DD_REMOTE_CONFIGURATION_ENABLED=0
ENV ASPNETCORE_URLS=http://localhost:5000

# Set a random env var we should ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ENV COMPlus_DbgEnableMiniDump=1
ENV COMPlus_DbgMiniDumpType=4
ENV DOTNET_DbgMiniDumpName=/dumps/coredump.%t.%p
ENV DOTNET_EnableCrashReport=1
ENV DD_REMOTE_CONFIGURATION_ENABLED=0

## SSI variables
ENV DD_INJECTION_ENABLED=tracer
Expand Down
1 change: 1 addition & 0 deletions tracer/build/_build/docker/smoke.nuget.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ENV DD_DOTNET_TRACER_HOME=/app/datadog
ENV DD_PROFILING_ENABLED=1
ENV DD_APPSEC_ENABLED=1
ENV DD_TRACE_DEBUG=1
ENV DD_REMOTE_CONFIGURATION_ENABLED=0

## SSI variables
ENV DD_INJECTION_ENABLED=tracer
Expand Down
1 change: 1 addition & 0 deletions tracer/build/_build/docker/smoke.trimming.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ENV LD_PRELOAD=/opt/datadog/continuousprofiler/Datadog.Linux.ApiWrapper.x64.so
ENV DD_PROFILING_ENABLED=1
ENV DD_APPSEC_ENABLED=1
ENV DD_TRACE_DEBUG=1
ENV DD_REMOTE_CONFIGURATION_ENABLED=0

## SSI variables
ENV DD_INJECTION_ENABLED=tracer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ RUN mkdir /logs; \

# Set the additional env vars
ENV DD_TRACE_LOG_DIRECTORY="C:\logs" \
DD_REMOTE_CONFIGURATION_ENABLED=0 \
ASPNETCORE_URLS=http://localhost:5000

# Set a random env var we should ignore
Expand Down
1 change: 1 addition & 0 deletions tracer/build/_build/docker/smoke.windows.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ENV DD_PROFILING_ENABLED=1 \
CORECLR_ENABLE_PROFILING=1 \
CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8} \
DD_TRACE_LOG_DIRECTORY="C:\logs" \
DD_REMOTE_CONFIGURATION_ENABLED=0 \
ASPNETCORE_URLS=http://localhost:5000

# Set a random env var we should ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ RUN mkdir /logs; \
ENV DD_PROFILING_ENABLED=1 \
DD_TRACE_DEBUG=1 \
DD_APPSEC_ENABLED=1 \
DD_REMOTE_CONFIGURATION_ENABLED=0 \
DD_TRACE_LOG_DIRECTORY="C:\logs" \
ASPNETCORE_URLS=http://localhost:5000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ RUN mkdir /logs; \
ENV DD_PROFILING_ENABLED=1 \
DD_TRACE_DEBUG=1 \
DD_APPSEC_ENABLED=1 \
DD_REMOTE_CONFIGURATION_ENABLED=0 \
DD_TRACE_LOG_DIRECTORY="C:\logs"

# Set a random env var we should ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ RUN mkdir /logs

# Set the required env vars
ENV DD_TRACE_LOG_DIRECTORY="C:\logs" \
DD_REMOTE_CONFIGURATION_ENABLED=0 \
ASPNETCORE_URLS=http://localhost:5000

# Set a random env var we should ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ENV CORECLR_ENABLE_PROFILING=1 \
DD_DOTNET_TRACER_HOME="c:\app\datadog" \
DD_TRACE_LOG_DIRECTORY="C:\logs" \
DD_PROFILING_ENABLED=1 \
DD_REMOTE_CONFIGURATION_ENABLED=0 \
ASPNETCORE_URLS=http://localhost:5000

# Set a random env var we should ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ENV DD_PROFILING_ENABLED=1 \
CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8} \
DD_DOTNET_TRACER_HOME="c:\monitoring-home" \
DD_TRACE_LOG_DIRECTORY="C:\logs" \
DD_REMOTE_CONFIGURATION_ENABLED=0 \
ASPNETCORE_URLS=http://localhost:5000

# Set a random env var we should ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ internal static partial class ConfigurationKeys
{
internal static class Rcm
{
/// <summary>
/// Is remote configuration management (RCM) enabled. Defaults to <c>true</c>. RCM requires
/// the use of the full agent, so will not always be available. This switch is primarily
/// intended for testing and for explicitly disabling RCM even though it is available.
/// </summary>
public const string RemoteConfigurationEnabled = "DD_REMOTE_CONFIGURATION_ENABLED";

/// <summary>
/// Configuration key for RCM poll interval (in seconds).
/// Default value is 5 s
Expand Down
11 changes: 10 additions & 1 deletion tracer/src/Datadog.Trace/Configuration/TracerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,8 @@ _ when x.ToBoolean() is { } boolean => boolean,
converter: x => ToDbmPropagationInput(x) ?? ParsingResult<DbmPropagationLevel>.Failure(),
validator: null);

RemoteConfigurationEnabled = config.WithKeys(ConfigurationKeys.Rcm.RemoteConfigurationEnabled).AsBool(true);

TraceId128BitGenerationEnabled = config
.WithKeys(ConfigurationKeys.FeatureFlags.TraceId128BitGenerationEnabled)
.AsBool(true);
Expand Down Expand Up @@ -1227,6 +1229,11 @@ public bool DiagnosticSourceEnabled
/// </summary>
internal SchemaVersion MetadataSchemaVersion { get; }

/// <summary>
/// Gets a value indicating whether remote configuration has been explicitly disabled.
/// </summary>
internal bool RemoteConfigurationEnabled { get; }

/// <summary>
/// Gets the disabled ADO.NET Command Types that won't have spans generated for them.
/// </summary>
Expand All @@ -1238,9 +1245,11 @@ public bool DiagnosticSourceEnabled

/// <summary>
/// Gets a value indicating whether remote configuration is potentially available.
/// RCM requires the "full" agent (not just the trace agent), so is not available in some scenarios
/// RCM requires the "full" agent (not just the trace agent), so is not available in some scenarios.
/// It may also be explicitly disabled
/// </summary>
internal bool IsRemoteConfigurationAvailable =>
RemoteConfigurationEnabled &&
!(IsRunningInAzureAppService
|| IsRunningMiniAgentInAzureFunctions
|| IsRunningInGCPFunctions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,22 @@ public void TraceId128BitLoggingEnabled(string value, bool expected)
settings.TraceId128BitLoggingEnabled.Should().Be(expected);
}

[Theory]
[PairwiseData]
public void IsRemoteConfigurationAvailable(bool? overrideValue, bool? isRunningInAas)
{
var source = CreateConfigurationSource(
(ConfigurationKeys.AzureAppService.AzureAppServicesContextKey, AsString(isRunningInAas)),
(ConfigurationKeys.Rcm.RemoteConfigurationEnabled, AsString(overrideValue)));
var settings = new TracerSettings(source);

// Default is "rcm is enabled" and "we're not in AAS"
var expected = (overrideValue ?? true) && !(isRunningInAas ?? false);
settings.IsRemoteConfigurationAvailable.Should().Be(expected);

static string AsString(bool? value) => value.HasValue ? (value.Value ? "1" : "0") : string.Empty;
}

[Fact]
public void RecordsTelemetryAboutTfm()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@
"DD_TRACE_LOGFILE_RETENTION_DAYS": "trace_log_file_retention_days",
"DD_TRACE_LOG_SINKS": "trace_log_sinks",
"DD_TRACE_COMMANDS_COLLECTION_ENABLED": "trace_commands_collection_enabled",
"DD_REMOTE_CONFIGURATION_ENABLED": "remote_config_enabled",
"DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS": "remote_config_poll_interval",
"DD_INTERNAL_RCM_POLL_INTERVAL": "remote_config_poll_interval",
"trace.128_bit_traceid_logging_enabled": "trace_128_bits_id_logging_enabled",
Expand Down
Loading