Skip to content

Commit

Permalink
Enable v2 telemetry by default (#4638)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewlock authored Sep 19, 2023
1 parent 4db4ffa commit cd4ce84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
10 changes: 2 additions & 8 deletions tracer/src/Datadog.Trace/Telemetry/TelemetrySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,12 @@ public static TelemetrySettings FromSource(IConfigurationSource source, IConfigu

var dependencyCollectionEnabled = config.WithKeys(ConfigurationKeys.Telemetry.DependencyCollectionEnabled).AsBool(true);

var isRunningInAzureAppService = config
.WithKeys(ConfigurationKeys.AzureAppService.AzureAppServicesContextKey)
.AsBool(false);

// Currently enabled by default in AAS, will be flipped to true for all in later versions as part of the rollout
var v2Enabled = config.WithKeys(ConfigurationKeys.Telemetry.V2Enabled).AsBool(defaultValue: isRunningInAzureAppService);
var v2Enabled = config.WithKeys(ConfigurationKeys.Telemetry.V2Enabled).AsBool(defaultValue: true);

// For testing purposes only
var debugEnabled = config.WithKeys(ConfigurationKeys.Telemetry.DebugEnabled).AsBool(false);

// Currently disabled, will be flipped to true in later versions as part of the rollout
// Also, will require v2 enabled
// Requires v2 enabled
bool metricsEnabled;
if (isServerless)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,29 +294,14 @@ public void HeartbeatInterval(string value, double expected)
settings.HeartbeatInterval.Should().Be(TimeSpan.FromSeconds(expected));
}

[Theory]
[InlineData("0", false)]
[InlineData(null, false)]
[InlineData("", false)]
[InlineData("1", true)]
public void V2Enabled_DisabledByDefault(string value, bool expected)
{
var source = CreateConfigurationSource((ConfigurationKeys.Telemetry.V2Enabled, value));
var settings = TelemetrySettings.FromSource(source, NullConfigurationTelemetry.Instance, () => true, isServerless: false);

settings.V2Enabled.Should().Be(expected);
}

[Theory]
[InlineData("0", false)]
[InlineData(null, true)]
[InlineData("", true)]
[InlineData("1", true)]
public void V2Enabled_EnabledByDefaultInAas(string value, bool expected)
public void V2Enabled_EnabledByDefault(string value, bool expected)
{
var source = CreateConfigurationSource(
(ConfigurationKeys.AzureAppService.AzureAppServicesContextKey, "1"),
(ConfigurationKeys.Telemetry.V2Enabled, value));
var source = CreateConfigurationSource((ConfigurationKeys.Telemetry.V2Enabled, value));
var settings = TelemetrySettings.FromSource(source, NullConfigurationTelemetry.Instance, () => true, isServerless: false);

settings.V2Enabled.Should().Be(expected);
Expand Down

0 comments on commit cd4ce84

Please sign in to comment.