Skip to content
Open
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
2 changes: 0 additions & 2 deletions tracer/missing-nullability-files.csv
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ src/Datadog.Trace/Configuration/ConfigurationKeys.AzureAppService.cs
src/Datadog.Trace/Configuration/ConfigurationKeys.Debugger.cs
src/Datadog.Trace/Configuration/ConfigurationKeys.DirectLogSubmission.cs
src/Datadog.Trace/Configuration/ConfigurationKeys.Exporter.cs
src/Datadog.Trace/Configuration/ConfigurationKeys.GCPFunction.cs
src/Datadog.Trace/Configuration/ConfigurationKeys.Iast.cs
src/Datadog.Trace/Configuration/ConfigurationKeys.Logging.cs
src/Datadog.Trace/Configuration/ConfigurationKeys.Rcm.cs
Expand All @@ -93,7 +92,6 @@ src/Datadog.Trace/Configuration/DeprecationMessages.cs
src/Datadog.Trace/Configuration/IDynamicConfigurationManager.cs
src/Datadog.Trace/Configuration/IntegrationRegistry.cs
src/Datadog.Trace/Configuration/TracerSettingsConstants.cs
src/Datadog.Trace/ContinuousProfiler/ConfigurationKeys.cs
src/Datadog.Trace/ContinuousProfiler/ContextTracker.cs
src/Datadog.Trace/ContinuousProfiler/IContextTracker.cs
src/Datadog.Trace/ContinuousProfiler/IProfilerStatus.cs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// </copyright>

using BenchmarkDotNet.Configs;
using Datadog.Trace.Configuration;
using Datadog.Trace.ContinuousProfiler;
using Datadog.Trace.ExtensionMethods;
using Datadog.Trace.Util;
Expand Down Expand Up @@ -33,14 +34,14 @@ internal static IConfig WithDatadog(this IConfig config, bool? enableProfiler)
{
var cfg = config.AddLogger(DatadogSessionLogger.Default);

enableProfiler ??= (EnvironmentHelpers.GetEnvironmentVariable(ConfigurationKeys.ProfilingEnabled) ?? string.Empty).ToBoolean() ?? false;
enableProfiler ??= (EnvironmentHelpers.GetEnvironmentVariable(ConfigurationKeys.Profiler.ProfilingEnabled) ?? string.Empty).ToBoolean() ?? false;
switch (enableProfiler)
{
case true:
cfg = cfg.WithOption(ConfigOptions.KeepBenchmarkFiles, true);
break;
case false:
EnvironmentHelpers.SetEnvironmentVariable(ConfigurationKeys.ProfilingEnabled, null);
EnvironmentHelpers.SetEnvironmentVariable(ConfigurationKeys.Profiler.ProfilingEnabled, null);
break;
}

Expand Down
4 changes: 2 additions & 2 deletions tracer/src/Datadog.Trace/ClrProfiler/Instrumentation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,8 @@ private static void StartDiagnosticManager()
var observers = new List<DiagnosticObserver>();

// get environment variables directly so we don't access Trace.Instance yet
var functionsExtensionVersion = EnvironmentHelpers.GetEnvironmentVariable(Datadog.Trace.Configuration.ConfigurationKeys.AzureFunctions.FunctionsExtensionVersion);
var functionsWorkerRuntime = EnvironmentHelpers.GetEnvironmentVariable(Datadog.Trace.Configuration.ConfigurationKeys.AzureFunctions.FunctionsWorkerRuntime);
var functionsExtensionVersion = EnvironmentHelpers.GetEnvironmentVariable(PlatformKeys.AzureFunctions.FunctionsExtensionVersion);
var functionsWorkerRuntime = EnvironmentHelpers.GetEnvironmentVariable(PlatformKeys.AzureFunctions.FunctionsWorkerRuntime);

if (!string.IsNullOrEmpty(functionsExtensionVersion) && !string.IsNullOrEmpty(functionsWorkerRuntime))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,6 @@ internal class AzureAppService
/// </summary>
internal const string SiteExtensionVersionKey = "DD_AAS_DOTNET_EXTENSION_VERSION";

/// <summary>
/// Example: 8c500027-5f00-400e-8f00-60000000000f+apm-dotnet-EastUSwebspace
/// Format: {subscriptionId}+{planResourceGroup}-{hostedInRegion}
/// </summary>
internal const string WebsiteOwnerNameKey = "WEBSITE_OWNER_NAME";

/// <summary>
/// This is the name of the resource group the site instance is assigned to.
/// </summary>
internal const string ResourceGroupKey = "WEBSITE_RESOURCE_GROUP";

/// <summary>
/// This is the unique name of the website instance within Azure App Services.
/// Its presence is used to determine if we are running in Azure App Services.
/// </summary>
internal const string SiteNameKey = "WEBSITE_SITE_NAME";

/// <summary>
/// The instance name in Azure where the traced application is running.
/// </summary>
internal const string InstanceNameKey = "COMPUTERNAME";

/// <summary>
/// The instance ID in Azure where the traced application is running.
/// </summary>
internal const string InstanceIdKey = "WEBSITE_INSTANCE_ID";

/// <summary>
/// The operating system in Azure where the traced application is running.
/// </summary>
internal const string OperatingSystemKey = "WEBSITE_OS";

/// <summary>
/// Used to force the loader to start the trace agent (in case automatic instrumentation is disabled)
/// </summary>
Expand All @@ -62,12 +30,6 @@ internal class AzureAppService
/// Used to force the loader to start dogstatsd (in case automatic instrumentation is disabled)
/// </summary>
public const string AasEnableCustomMetrics = "DD_AAS_ENABLE_CUSTOM_METRICS";

/// <summary>
/// Used to identify consumption plan functions. Consumption plans will either not have this variable,
/// or will have a value of "dynamic".
/// </summary>
public const string WebsiteSKU = "WEBSITE_SKU";
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// <copyright file="ConfigurationKeys.Profiler.cs" company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
// </copyright>

#nullable enable

namespace Datadog.Trace.Configuration
{
internal static partial class ConfigurationKeys
{
internal static class Profiler
{
public const string ProfilingEnabled = "DD_PROFILING_ENABLED";
public const string CodeHotspotsEnabled = "DD_PROFILING_CODEHOTSPOTS_ENABLED";
public const string EndpointProfilingEnabled = "DD_PROFILING_ENDPOINT_COLLECTION_ENABLED";
public const string SsiDeployed = "DD_INJECTION_ENABLED";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IS DD_INJECTION_ENABLED a Profiler setting?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's not 🤔 It's a general "SSI" setting, so maybe we need another category here. Either that, or it's just a "global" setting like DD_API_KEY etc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it's changed in the newly generated keys at the end of the stack

public const string ProfilerManagedActivationEnabled = "DD_PROFILING_MANAGED_ACTIVATION_ENABLED";
}
}
}
23 changes: 0 additions & 23 deletions tracer/src/Datadog.Trace/Configuration/ConfigurationKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -762,29 +762,6 @@ public static class Proxy
public const string ProxyNoProxy = "DD_PROXY_NO_PROXY";
}

/// <summary>
/// String format patterns used to match integration-specific configuration keys.
/// </summary>
public static class Integrations
{
/// <summary>
/// Configuration key pattern for enabling or disabling an integration.
/// </summary>
public const string Enabled = "DD_TRACE_{0}_ENABLED";

/// <summary>
/// Configuration key pattern for enabling or disabling Analytics in an integration.
/// </summary>
[Obsolete(DeprecationMessages.AppAnalytics)]
public const string AnalyticsEnabled = "DD_TRACE_{0}_ANALYTICS_ENABLED";

/// <summary>
/// Configuration key pattern for setting Analytics sampling rate in an integration.
/// </summary>
[Obsolete(DeprecationMessages.AppAnalytics)]
public const string AnalyticsSampleRate = "DD_TRACE_{0}_ANALYTICS_SAMPLE_RATE";
}

/// <summary>
/// String constants for debug configuration keys.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ public ImmutableAzureAppServiceSettings(IConfigurationSource? source, IConfigura
}

SubscriptionId = GetSubscriptionId(source, telemetry);
ResourceGroup = config.WithKeys(ConfigurationKeys.AzureAppService.ResourceGroupKey).AsString();
SiteName = config.WithKeys(ConfigurationKeys.AzureAppService.SiteNameKey).AsString();
ResourceGroup = config.WithKeys(PlatformKeys.AzureAppService.ResourceGroupKey).AsString();
SiteName = config.WithKeys(PlatformKeys.AzureAppService.SiteNameKey).AsString();
ResourceId = CompileResourceId(subscriptionId: SubscriptionId, siteName: SiteName, resourceGroup: ResourceGroup);
InstanceId = config.WithKeys(ConfigurationKeys.AzureAppService.InstanceIdKey).AsString("unknown");
InstanceName = config.WithKeys(ConfigurationKeys.AzureAppService.InstanceNameKey).AsString("unknown");
OperatingSystem = config.WithKeys(ConfigurationKeys.AzureAppService.OperatingSystemKey).AsString("unknown");
InstanceId = config.WithKeys(PlatformKeys.AzureAppService.InstanceIdKey).AsString("unknown");
InstanceName = config.WithKeys(PlatformKeys.AzureAppService.InstanceNameKey).AsString("unknown");
OperatingSystem = config.WithKeys(PlatformKeys.AzureAppService.OperatingSystemKey).AsString("unknown");
SiteExtensionVersion = config.WithKeys(ConfigurationKeys.AzureAppService.SiteExtensionVersionKey).AsString("unknown");
WebsiteSKU = config.WithKeys(ConfigurationKeys.AzureAppService.WebsiteSKU).AsString();
WebsiteSku = config.WithKeys(PlatformKeys.AzureAppService.WebsiteSku).AsString();

FunctionsWorkerRuntime = config.WithKeys(ConfigurationKeys.AzureFunctions.FunctionsWorkerRuntime).AsString();
FunctionsExtensionVersion = config.WithKeys(ConfigurationKeys.AzureFunctions.FunctionsExtensionVersion).AsString();
FunctionsWorkerRuntime = config.WithKeys(PlatformKeys.AzureFunctions.FunctionsWorkerRuntime).AsString();
FunctionsExtensionVersion = config.WithKeys(PlatformKeys.AzureFunctions.FunctionsExtensionVersion).AsString();

if (FunctionsWorkerRuntime is not null && FunctionsExtensionVersion is not null)
{
Expand Down Expand Up @@ -118,7 +118,7 @@ public ImmutableAzureAppServiceSettings(IConfigurationSource? source, IConfigura

public bool IsFunctionsApp { get; }

public string? WebsiteSKU { get; }
public string? WebsiteSku { get; }

public string? FunctionsExtensionVersion { get; }

Expand All @@ -142,19 +142,19 @@ private static bool ShouldSkipClientSpanWithinFunctions(Scope? scope)
{
if (subscriptionId == null)
{
Log.Warning("Could not successfully retrieve the subscription ID from variable: {Variable}", ConfigurationKeys.AzureAppService.WebsiteOwnerNameKey);
Log.Warning("Could not successfully retrieve the subscription ID from variable: {Variable}", PlatformKeys.AzureAppService.WebsiteOwnerNameKey);
return null;
}

if (siteName == null)
{
Log.Warning("Could not successfully retrieve the deployment ID from variable: {Variable}", ConfigurationKeys.AzureAppService.SiteNameKey);
Log.Warning("Could not successfully retrieve the deployment ID from variable: {Variable}", PlatformKeys.AzureAppService.SiteNameKey);
return null;
}

if (resourceGroup == null)
{
Log.Warning("Could not successfully retrieve the resource group name from variable: {Variable}", ConfigurationKeys.AzureAppService.ResourceGroupKey);
Log.Warning("Could not successfully retrieve the resource group name from variable: {Variable}", PlatformKeys.AzureAppService.ResourceGroupKey);
return null;
}

Expand All @@ -164,7 +164,7 @@ private static bool ShouldSkipClientSpanWithinFunctions(Scope? scope)
private static string? GetSubscriptionId(IConfigurationSource source, IConfigurationTelemetry telemetry)
{
var websiteOwner = new ConfigurationBuilder(source, telemetry)
.WithKeys(ConfigurationKeys.AzureAppService.WebsiteOwnerNameKey)
.WithKeys(PlatformKeys.AzureAppService.WebsiteOwnerNameKey)
.AsString(websiteOwner => !string.IsNullOrWhiteSpace(websiteOwner));

if (!string.IsNullOrWhiteSpace(websiteOwner))
Expand All @@ -186,7 +186,7 @@ private static bool ShouldSkipClientSpanWithinFunctions(Scope? scope)
public static bool IsRunningInAzureAppServices(IConfigurationSource source, IConfigurationTelemetry telemetry)
{
var siteName = new ConfigurationBuilder(source, telemetry)
.WithKeys(ConfigurationKeys.AzureAppService.SiteNameKey)
.WithKeys(PlatformKeys.AzureAppService.SiteNameKey)
.AsString();

return !string.IsNullOrEmpty(siteName);
Expand All @@ -200,17 +200,17 @@ public static bool IsRunningInAzureAppServices(IConfigurationSource source, ICon
public static bool IsRunningInAzureFunctions(IConfigurationSource source, IConfigurationTelemetry telemetry)
{
var siteName = new ConfigurationBuilder(source, telemetry)
.WithKeys(ConfigurationKeys.AzureAppService.SiteNameKey)
.WithKeys(PlatformKeys.AzureAppService.SiteNameKey)
.AsString();

// "dotnet", "dotnet-isolated"
var workerRuntime = new ConfigurationBuilder(source, telemetry)
.WithKeys(ConfigurationKeys.AzureFunctions.FunctionsWorkerRuntime)
.WithKeys(PlatformKeys.AzureFunctions.FunctionsWorkerRuntime)
.AsString();

// "~4", "~1"
var extensionVersion = new ConfigurationBuilder(source, telemetry)
.WithKeys(ConfigurationKeys.AzureFunctions.FunctionsExtensionVersion)
.WithKeys(PlatformKeys.AzureFunctions.FunctionsExtensionVersion)
.AsString();

return !string.IsNullOrEmpty(siteName) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public ImmutableGCPFunctionSettings(IConfigurationSource? source, IConfiguration
source ??= NullConfigurationSource.Instance;
var config = new ConfigurationBuilder(source, telemetry);

var deprecatedFunctionKey = config.WithKeys(ConfigurationKeys.GCPFunction.DeprecatedFunctionNameKey).AsString();
var deprecatedProjectKey = config.WithKeys(ConfigurationKeys.GCPFunction.DeprecatedProjectKey).AsString();
var deprecatedFunctionKey = config.WithKeys(PlatformKeys.GcpFunction.DeprecatedFunctionNameKey).AsString();
var deprecatedProjectKey = config.WithKeys(PlatformKeys.GcpFunction.DeprecatedProjectKey).AsString();
IsDeprecatedFunction = deprecatedFunctionKey != null && deprecatedProjectKey != null;

var functionNameKey = config.WithKeys(ConfigurationKeys.GCPFunction.FunctionNameKey).AsString();
var functionTargetKey = config.WithKeys(ConfigurationKeys.GCPFunction.FunctionTargetKey).AsString();
var functionNameKey = config.WithKeys(PlatformKeys.GcpFunction.FunctionNameKey).AsString();
var functionTargetKey = config.WithKeys(PlatformKeys.GcpFunction.FunctionTargetKey).AsString();
IsNewerFunction = functionNameKey != null && functionTargetKey != null;

IsGCPFunction = IsDeprecatedFunction || IsNewerFunction;
Expand Down
Loading
Loading