Skip to content

Commit

Permalink
Record SSI injection values in configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewlock committed Jun 7, 2024
1 parent bb5476e commit 37a18f4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions tracer/src/Datadog.Trace/Configuration/TracerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using Datadog.Trace.SourceGenerators;
using Datadog.Trace.Telemetry;
using Datadog.Trace.Telemetry.Metrics;
using Datadog.Trace.Util;

namespace Datadog.Trace.Configuration
{
Expand Down Expand Up @@ -418,6 +419,10 @@ internal TracerSettings(IConfigurationSource? source, IConfigurationTelemetry te
telemetry.Record(ConfigTelemetryData.FullTrustAppDomain, value: AppDomain.CurrentDomain.IsFullyTrusted, ConfigurationOrigins.Default);
telemetry.Record(ConfigTelemetryData.ManagedTracerTfm, value: ConfigTelemetryData.ManagedTracerTfmValue, recordValue: true, ConfigurationOrigins.Default);

// these are SSI variables that would be useful for correlation purposes
telemetry.Record(ConfigTelemetryData.SsiInjectionEnabled, value: EnvironmentHelpers.GetEnvironmentVariable("DD_INJECTION_ENABLED"), recordValue: true, ConfigurationOrigins.EnvVars);
telemetry.Record(ConfigTelemetryData.SsiAllowUnsupportedRuntimesEnabled, value: EnvironmentHelpers.GetEnvironmentVariable("DD_INJECT_FORCE"), recordValue: true, ConfigurationOrigins.EnvVars);

if (AzureAppServiceMetadata is not null)
{
telemetry.Record(ConfigTelemetryData.AasConfigurationError, AzureAppServiceMetadata.IsUnsafeToTrace, ConfigurationOrigins.Default);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ internal static class ConfigTelemetryData
public const string ProfilerLoaded = "profiler_loaded";
public const string CodeHotspotsEnabled = "code_hotspots_enabled";

public const string SsiInjectionEnabled = "ssi_injection_enabled";
public const string SsiAllowUnsupportedRuntimesEnabled = "ssi_forced_injection_enabled";

// We intentionally are using specific values here, not OR_GREATER_THAN
#if NET6_0
public const string ManagedTracerTfmValue = "net6.0";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public class ConfigurationTests
"DD_DOTNET_TRACER_HOME",
"DD_INSTRUMENTATION_INSTALL_ID",
"DD_INSTRUMENTATION_INSTALL_TYPE",
"DD_INSTRUMENTATION_INSTALL_TIME"
"DD_INSTRUMENTATION_INSTALL_TIME",
"DD_INJECTION_ENABLED",
"DD_INJECT_FORCE",
};

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,5 +565,7 @@
"trace.sidecar_trace_sender": "trace_sidecar_trace_sender",
"trace.sampling_rules_format": "trace_sampling_rules_format",
"DD_TRACE_SAMPLING_RULES_FORMAT": "trace_sampling_rules_format",
"trace.agentless": "trace_agentless"
"trace.agentless": "trace_agentless",
"ssi_injection_enabled": "ssi_injection_enabled",
"ssi_forced_injection_enabled": "ssi_forced_injection_enabled"
}

0 comments on commit 37a18f4

Please sign in to comment.