@@ -140,8 +140,6 @@ internal TracerSettings(IConfigurationSource? source, IConfigurationTelemetry te
140140 . AsBoolResult ( )
141141 . OverrideWith ( in otelActivityListenerEnabled , ErrorLog , defaultValue : false ) ;
142142
143- var exporter = new ExporterSettings ( source , _telemetry ) ;
144-
145143 PeerServiceTagsEnabled = config
146144 . WithKeys ( ConfigurationKeys . PeerServiceDefaultsEnabled )
147145 . AsBool ( defaultValue : false ) ;
@@ -350,66 +348,6 @@ not null when string.Equals(value, "otlp", StringComparison.OrdinalIgnoreCase) =
350348
351349 OpenTelemetryLogsEnabled = OpenTelemetryLogsEnabled && OtelLogsExporterEnabled ;
352350
353- DataPipelineEnabled = config
354- . WithKeys ( ConfigurationKeys . TraceDataPipelineEnabled )
355- . AsBool ( defaultValue : EnvironmentHelpers . IsUsingAzureAppServicesSiteExtension ( ) && ! EnvironmentHelpers . IsAzureFunctions ( ) ) ;
356-
357- if ( DataPipelineEnabled )
358- {
359- // Due to missing quantization and obfuscation in native side, we can't enable the native trace exporter
360- // as it may lead to different stats results than the managed one.
361- if ( StatsComputationEnabled )
362- {
363- DataPipelineEnabled = false ;
364- Log . Warning (
365- $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but { ConfigurationKeys . StatsComputationEnabled } is enabled. Disabling data pipeline.") ;
366- _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
367- }
368-
369- // Windows supports UnixDomainSocket https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
370- // but tokio hasn't added support for it yet https://github.com/tokio-rs/tokio/issues/2201
371- // There's an issue here, in that technically a user can initially be configured to send over TCP/named pipes,
372- // and so we allow and enable the datapipeline. Later, they could configure the app in code to send over UDS.
373- // This is a problem, as we currently don't support toggling the data pipeline at runtime, so we explicitly block
374- // this scenario in the public API.
375- if ( exporter . TracesTransport == TracesTransportType . UnixDomainSocket && FrameworkDescription . Instance . IsWindows ( ) )
376- {
377- DataPipelineEnabled = false ;
378- Log . Warning (
379- $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but TracesTransport is set to UnixDomainSocket which is not supported on Windows. Disabling data pipeline.") ;
380- _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
381- }
382-
383- if ( ! isLibDatadogAvailable . IsAvailable )
384- {
385- DataPipelineEnabled = false ;
386- if ( isLibDatadogAvailable . Exception is not null )
387- {
388- Log . Warning (
389- isLibDatadogAvailable . Exception ,
390- $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but libdatadog is not available. Disabling data pipeline.") ;
391- }
392- else
393- {
394- Log . Warning (
395- $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but libdatadog is not available. Disabling data pipeline.") ;
396- }
397-
398- _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
399- }
400-
401- // SSI already utilizes libdatadog. To prevent unexpected behavior,
402- // we proactively disable the data pipeline when SSI is enabled. Theoretically, this should not cause any issues,
403- // but as a precaution, we are taking a conservative approach during the initial rollout phase.
404- if ( ! string . IsNullOrEmpty ( EnvironmentHelpers . GetEnvironmentVariable ( "DD_INJECTION_ENABLED" ) ) )
405- {
406- DataPipelineEnabled = false ;
407- Log . Warning (
408- $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but SSI is enabled. Disabling data pipeline.") ;
409- _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
410- }
411- }
412-
413351 // We should also be writing telemetry for OTEL_LOGS_EXPORTER similar to OTEL_METRICS_EXPORTER, but we don't have a corresponding Datadog config
414352 // When we do, we can insert that here
415353 CustomSamplingRulesFormat = config . WithKeys ( ConfigurationKeys . CustomSamplingRulesFormat )
@@ -742,9 +680,72 @@ not null when string.Equals(value, "otlp", StringComparison.OrdinalIgnoreCase) =
742680 // We create a lazy here because this is kind of expensive, and we want to avoid calling it if we can
743681 _fallbackApplicationName = new ( ( ) => ApplicationNameHelpers . GetFallbackApplicationName ( this ) ) ;
744682
745- // Move the creation of these settings inside SettingsManager?
746- var initialMutableSettings = MutableSettings . CreateInitialMutableSettings ( source , telemetry , errorLog , this ) ;
747- Manager = new ( this , initialMutableSettings , exporter ) ;
683+ // There's a circular dependency here because DataPipeline depends on ExporterSettings,
684+ // but the settings manager depends on TracerSettings. Basically this is all fine as long
685+ // as nothing in the MutableSettings or ExporterSettings depends on the value of DataPipelineEnabled!
686+ Manager = new ( source , this , telemetry , errorLog ) ;
687+
688+ var exporter = new ExporterSettings ( source , _telemetry ) ;
689+
690+ DataPipelineEnabled = config
691+ . WithKeys ( ConfigurationKeys . TraceDataPipelineEnabled )
692+ . AsBool ( defaultValue : EnvironmentHelpers . IsUsingAzureAppServicesSiteExtension ( ) && ! EnvironmentHelpers . IsAzureFunctions ( ) ) ;
693+
694+ if ( DataPipelineEnabled )
695+ {
696+ // Due to missing quantization and obfuscation in native side, we can't enable the native trace exporter
697+ // as it may lead to different stats results than the managed one.
698+ if ( StatsComputationEnabled )
699+ {
700+ DataPipelineEnabled = false ;
701+ Log . Warning (
702+ $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but { ConfigurationKeys . StatsComputationEnabled } is enabled. Disabling data pipeline.") ;
703+ _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
704+ }
705+
706+ // Windows supports UnixDomainSocket https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
707+ // but tokio hasn't added support for it yet https://github.com/tokio-rs/tokio/issues/2201
708+ // There's an issue here, in that technically a user can initially be configured to send over TCP/named pipes,
709+ // and so we allow and enable the datapipeline. Later, they could configure the app in code to send over UDS.
710+ // This is a problem, as we currently don't support toggling the data pipeline at runtime, so we explicitly block
711+ // this scenario in the public API.
712+ if ( exporter . TracesTransport == TracesTransportType . UnixDomainSocket && FrameworkDescription . Instance . IsWindows ( ) )
713+ {
714+ DataPipelineEnabled = false ;
715+ Log . Warning (
716+ $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but TracesTransport is set to UnixDomainSocket which is not supported on Windows. Disabling data pipeline.") ;
717+ _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
718+ }
719+
720+ if ( ! isLibDatadogAvailable . IsAvailable )
721+ {
722+ DataPipelineEnabled = false ;
723+ if ( isLibDatadogAvailable . Exception is not null )
724+ {
725+ Log . Warning (
726+ isLibDatadogAvailable . Exception ,
727+ $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but libdatadog is not available. Disabling data pipeline.") ;
728+ }
729+ else
730+ {
731+ Log . Warning (
732+ $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but libdatadog is not available. Disabling data pipeline.") ;
733+ }
734+
735+ _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
736+ }
737+
738+ // SSI already utilizes libdatadog. To prevent unexpected behavior,
739+ // we proactively disable the data pipeline when SSI is enabled. Theoretically, this should not cause any issues,
740+ // but as a precaution, we are taking a conservative approach during the initial rollout phase.
741+ if ( ! string . IsNullOrEmpty ( EnvironmentHelpers . GetEnvironmentVariable ( "DD_INJECTION_ENABLED" ) ) )
742+ {
743+ DataPipelineEnabled = false ;
744+ Log . Warning (
745+ $ "{ ConfigurationKeys . TraceDataPipelineEnabled } is enabled, but SSI is enabled. Disabling data pipeline.") ;
746+ _telemetry . Record ( ConfigurationKeys . TraceDataPipelineEnabled , false , ConfigurationOrigins . Calculated ) ;
747+ }
748+ }
748749 }
749750
750751 internal bool IsRunningInCiVisibility { get ; }
0 commit comments