@@ -234,7 +234,7 @@ private static string GetMetricsHostNameFromAgentUri(Uri agentUri)
234234
235235 private MetricsTransportSettings ConfigureMetricsTransport ( string ? metricsUrl , string ? traceAgentUrl , string ? agentHost , int dogStatsdPort , string ? metricsPipeName , string ? metricsUnixDomainSocketPath )
236236 {
237- if ( ! string . IsNullOrWhiteSpace ( metricsUrl ) && TryGetMetricsUriAndTransport ( metricsUrl ! , out var settingsFromUri ) )
237+ if ( ! string . IsNullOrEmpty ( metricsUrl ) && TryGetMetricsUriAndTransport ( metricsUrl ! , out var settingsFromUri ) )
238238 {
239239 return settingsFromUri ;
240240 }
@@ -252,7 +252,7 @@ private MetricsTransportSettings ConfigureMetricsTransport(string? metricsUrl, s
252252
253253 MetricsTransportSettings settings ;
254254
255- if ( ! string . IsNullOrWhiteSpace ( traceAgentUrl )
255+ if ( ! string . IsNullOrEmpty ( traceAgentUrl )
256256 && ! traceAgentUrl ! . StartsWith ( UnixDomainSocketPrefix )
257257 && Uri . TryCreate ( traceAgentUrl , UriKind . Absolute , out var tcpUri ) )
258258 {
@@ -273,11 +273,11 @@ private MetricsTransportSettings ConfigureMetricsTransport(string? metricsUrl, s
273273 portSource : dogStatsDPortSource ,
274274 out settings ) ;
275275 }
276- else if ( ! string . IsNullOrWhiteSpace ( metricsPipeName ) )
276+ else if ( ! string . IsNullOrEmpty ( metricsPipeName ) )
277277 {
278278 settings = new MetricsTransportSettings ( TransportType . NamedPipe , PipeName : metricsPipeName ) ;
279279 }
280- else if ( metricsUnixDomainSocketPath != null )
280+ else if ( ! string . IsNullOrEmpty ( metricsUnixDomainSocketPath ) )
281281 {
282282#if NETCOREAPP3_1_OR_GREATER
283283 SetUds ( metricsUnixDomainSocketPath , metricsUnixDomainSocketPath , metricsUnixDomainSocketPath , ConfigurationKeys . MetricsUnixDomainSocketPath , out settings ) ;
@@ -447,22 +447,22 @@ public Raw(IConfigurationSource source, IConfigurationTelemetry telemetry)
447447 // Get values from the config
448448 var config = new ConfigurationBuilder ( source , telemetry ) ;
449449 // NOTE: Keep this in sync with CreateUpdatedFromManualConfig below
450- TraceAgentUri = config . WithKeys ( ConfigurationKeys . AgentUri ) . AsString ( ) ;
451- TracesPipeName = config . WithKeys ( ConfigurationKeys . TracesPipeName ) . AsString ( ) ;
452- TracesUnixDomainSocketPath = config . WithKeys ( ConfigurationKeys . TracesUnixDomainSocketPath ) . AsString ( ) ;
450+ TraceAgentUri = config . WithKeys ( ConfigurationKeys . AgentUri ) . AsString ( ) ? . Trim ( ) ;
451+ TracesPipeName = config . WithKeys ( ConfigurationKeys . TracesPipeName ) . AsString ( ) ? . Trim ( ) ;
452+ TracesUnixDomainSocketPath = config . WithKeys ( ConfigurationKeys . TracesUnixDomainSocketPath ) . AsString ( ) ? . Trim ( ) ;
453453
454454 TraceAgentHost = config
455455 . WithKeys ( ConfigurationKeys . AgentHost , "DD_TRACE_AGENT_HOSTNAME" , "DATADOG_TRACE_AGENT_HOSTNAME" )
456- . AsString ( ) ;
456+ . AsString ( ) ? . Trim ( ) ;
457457
458458 TraceAgentPort = config
459459 . WithKeys ( ConfigurationKeys . AgentPort , "DATADOG_TRACE_AGENT_PORT" )
460460 . AsInt32 ( ) ;
461461
462- MetricsUrl = config . WithKeys ( ConfigurationKeys . MetricsUri ) . AsString ( ) ;
462+ MetricsUrl = config . WithKeys ( ConfigurationKeys . MetricsUri ) . AsString ( ) ? . Trim ( ) ;
463463 DogStatsdPort = config . WithKeys ( ConfigurationKeys . DogStatsdPort ) . AsInt32 ( 0 ) ;
464- MetricsPipeName = config . WithKeys ( ConfigurationKeys . MetricsPipeName ) . AsString ( ) ;
465- MetricsUnixDomainSocketPath = config . WithKeys ( ConfigurationKeys . MetricsUnixDomainSocketPath ) . AsString ( ) ;
464+ MetricsPipeName = config . WithKeys ( ConfigurationKeys . MetricsPipeName ) . AsString ( ) ? . Trim ( ) ;
465+ MetricsUnixDomainSocketPath = config . WithKeys ( ConfigurationKeys . MetricsUnixDomainSocketPath ) . AsString ( ) ? . Trim ( ) ;
466466
467467 TracesPipeTimeoutMs = config
468468 . WithKeys ( ConfigurationKeys . TracesPipeTimeoutMs )
0 commit comments