@@ -125,8 +125,6 @@ internal TracerSettings(IConfigurationSource? source, IConfigurationTelemetry te
125125 . AsBoolResult ( )
126126 . OverrideWith ( in otelActivityListenerEnabled , ErrorLog , defaultValue : false ) ;
127127
128- var exporter = new ExporterSettings ( source , _telemetry ) ;
129-
130128 PeerServiceTagsEnabled = config
131129 . WithKeys ( ConfigurationKeys . PeerServiceDefaultsEnabled )
132130 . AsBool ( defaultValue : false ) ;
@@ -335,66 +333,6 @@ not null when string.Equals(value, "otlp", StringComparison.OrdinalIgnoreCase) =
335333
336334 OpenTelemetryLogsEnabled = OpenTelemetryLogsEnabled && OtelLogsExporterEnabled ;
337335
338- DataPipelineEnabled = config
339- . WithKeys ( ConfigurationKeys . TraceDataPipelineEnabled )
340- . AsBool ( defaultValue : EnvironmentHelpers . IsUsingAzureAppServicesSiteExtension ( ) && ! EnvironmentHelpers . IsAzureFunctions ( ) ) ;
341-
342- if ( DataPipelineEnabled )
343- {
344- // Due to missing quantization and obfuscation in native side, we can't enable the native trace exporter
345- // as it may lead to different stats results than the managed one.
346- if ( StatsComputationEnabled )
347- {
348- DataPipelineEnabled = false ;
349- Log . Warning (
350- $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but { ConfigurationKeys . StatsComputationEnabled } is enabled. Disabling data pipeline.") ;
351- _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
352- }
353-
354- // Windows supports UnixDomainSocket https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
355- // but tokio hasn't added support for it yet https://github.com/tokio-rs/tokio/issues/2201
356- // There's an issue here, in that technically a user can initially be configured to send over TCP/named pipes,
357- // and so we allow and enable the datapipeline. Later, they could configure the app in code to send over UDS.
358- // This is a problem, as we currently don't support toggling the data pipeline at runtime, so we explicitly block
359- // this scenario in the public API.
360- if ( exporter . TracesTransport == TracesTransportType . UnixDomainSocket && FrameworkDescription . Instance . IsWindows ( ) )
361- {
362- DataPipelineEnabled = false ;
363- Log . Warning (
364- $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but TracesTransport is set to UnixDomainSocket which is not supported on Windows. Disabling data pipeline.") ;
365- _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
366- }
367-
368- if ( ! isLibDatadogAvailable . IsAvailable )
369- {
370- DataPipelineEnabled = false ;
371- if ( isLibDatadogAvailable . Exception is not null )
372- {
373- Log . Warning (
374- isLibDatadogAvailable . Exception ,
375- $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but libdatadog is not available. Disabling data pipeline.") ;
376- }
377- else
378- {
379- Log . Warning (
380- $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but libdatadog is not available. Disabling data pipeline.") ;
381- }
382-
383- _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
384- }
385-
386- // SSI already utilizes libdatadog. To prevent unexpected behavior,
387- // we proactively disable the data pipeline when SSI is enabled. Theoretically, this should not cause any issues,
388- // but as a precaution, we are taking a conservative approach during the initial rollout phase.
389- if ( ! string . IsNullOrEmpty ( EnvironmentHelpers . GetEnvironmentVariable ( "DD_INJECTION_ENABLED" ) ) )
390- {
391- DataPipelineEnabled = false ;
392- Log . Warning (
393- $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but SSI is enabled. Disabling data pipeline.") ;
394- _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
395- }
396- }
397-
398336 // We should also be writing telemetry for OTEL_LOGS_EXPORTER similar to OTEL_METRICS_EXPORTER, but we don't have a corresponding Datadog config
399337 // When we do, we can insert that here
400338 CustomSamplingRulesFormat = config . WithKeys ( ConfigurationKeys . CustomSamplingRulesFormat )
@@ -731,9 +669,72 @@ not null when string.Equals(value, "otlp", StringComparison.OrdinalIgnoreCase) =
731669 // We create a lazy here because this is kind of expensive, and we want to avoid calling it if we can
732670 _fallbackApplicationName = new ( ( ) => ApplicationNameHelpers . GetFallbackApplicationName ( this ) ) ;
733671
734- // Move the creation of these settings inside SettingsManager?
735- var initialMutableSettings = MutableSettings . CreateInitialMutableSettings ( source , telemetry , errorLog , this ) ;
736- Manager = new ( this , initialMutableSettings , exporter ) ;
672+ // There's a circular dependency here because DataPipeline depends on ExporterSettings,
673+ // but the settings manager depends on TracerSettings. Basically this is all fine as long
674+ // as nothing in the MutableSettings or ExporterSettings depends on the value of DataPipelineEnabled!
675+ Manager = new ( source , this , telemetry , errorLog ) ;
676+
677+ var exporter = new ExporterSettings ( source , _telemetry ) ;
678+
679+ DataPipelineEnabled = config
680+ . WithKeys ( ConfigurationKeys . TraceDataPipelineEnabled )
681+ . AsBool ( defaultValue : EnvironmentHelpers . IsUsingAzureAppServicesSiteExtension ( ) && ! EnvironmentHelpers . IsAzureFunctions ( ) ) ;
682+
683+ if ( DataPipelineEnabled )
684+ {
685+ // Due to missing quantization and obfuscation in native side, we can't enable the native trace exporter
686+ // as it may lead to different stats results than the managed one.
687+ if ( StatsComputationEnabled )
688+ {
689+ DataPipelineEnabled = false ;
690+ Log . Warning (
691+ $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but { ConfigurationKeys . StatsComputationEnabled } is enabled. Disabling data pipeline.") ;
692+ _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
693+ }
694+
695+ // Windows supports UnixDomainSocket https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
696+ // but tokio hasn't added support for it yet https://github.com/tokio-rs/tokio/issues/2201
697+ // There's an issue here, in that technically a user can initially be configured to send over TCP/named pipes,
698+ // and so we allow and enable the datapipeline. Later, they could configure the app in code to send over UDS.
699+ // This is a problem, as we currently don't support toggling the data pipeline at runtime, so we explicitly block
700+ // this scenario in the public API.
701+ if ( exporter . TracesTransport == TracesTransportType . UnixDomainSocket && FrameworkDescription . Instance . IsWindows ( ) )
702+ {
703+ DataPipelineEnabled = false ;
704+ Log . Warning (
705+ $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but TracesTransport is set to UnixDomainSocket which is not supported on Windows. Disabling data pipeline.") ;
706+ _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
707+ }
708+
709+ if ( ! isLibDatadogAvailable . IsAvailable )
710+ {
711+ DataPipelineEnabled = false ;
712+ if ( isLibDatadogAvailable . Exception is not null )
713+ {
714+ Log . Warning (
715+ isLibDatadogAvailable . Exception ,
716+ $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but libdatadog is not available. Disabling data pipeline.") ;
717+ }
718+ else
719+ {
720+ Log . Warning (
721+ $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but libdatadog is not available. Disabling data pipeline.") ;
722+ }
723+
724+ _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
725+ }
726+
727+ // SSI already utilizes libdatadog. To prevent unexpected behavior,
728+ // we proactively disable the data pipeline when SSI is enabled. Theoretically, this should not cause any issues,
729+ // but as a precaution, we are taking a conservative approach during the initial rollout phase.
730+ if ( ! string . IsNullOrEmpty ( EnvironmentHelpers . GetEnvironmentVariable ( "DD_INJECTION_ENABLED" ) ) )
731+ {
732+ DataPipelineEnabled = false ;
733+ Log . Warning (
734+ $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but SSI is enabled. Disabling data pipeline.") ;
735+ _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
736+ }
737+ }
737738 }
738739
739740 internal bool IsRunningInCiVisibility { get ; }
0 commit comments