@@ -363,42 +363,49 @@ private IApi GetApi(TracerSettings settings, IDogStatsd statsd, Action<Dictionar
363
363
{
364
364
if ( settings . DataPipelineEnabled )
365
365
{
366
- var telemetrySettings = TelemetrySettings . FromSource ( GlobalConfigurationSource . Instance , TelemetryFactory . Config , settings , isAgentAvailable : null ) ;
367
- TelemetryClientConfiguration ? telemetryClientConfiguration = null ;
368
-
369
- // We don't know how to handle telemetry in Agentless mode yet
370
- // so we disable telemetry in this case
371
- if ( telemetrySettings . TelemetryEnabled && telemetrySettings . Agentless == null )
366
+ try
372
367
{
373
- telemetryClientConfiguration = new TelemetryClientConfiguration
368
+ var telemetrySettings = TelemetrySettings . FromSource ( GlobalConfigurationSource . Instance , TelemetryFactory . Config , settings , isAgentAvailable : null ) ;
369
+ TelemetryClientConfiguration ? telemetryClientConfiguration = null ;
370
+
371
+ // We don't know how to handle telemetry in Agentless mode yet
372
+ // so we disable telemetry in this case
373
+ if ( telemetrySettings . TelemetryEnabled && telemetrySettings . Agentless == null )
374
374
{
375
- Interval = ( ulong ) telemetrySettings . HeartbeatInterval . Milliseconds ,
376
- RuntimeId = new CharSlice ( Tracer . RuntimeId )
377
- } ;
378
- }
375
+ telemetryClientConfiguration = new TelemetryClientConfiguration
376
+ {
377
+ Interval = ( ulong ) telemetrySettings . HeartbeatInterval . Milliseconds ,
378
+ RuntimeId = new CharSlice ( Tracer . RuntimeId )
379
+ } ;
380
+ }
379
381
380
- // When APM is disabled, we don't want to compute stats at all
381
- // A common use case is in Application Security Monitoring (ASM) scenarios:
382
- // when APM is disabled but ASM is enabled.
383
- var clientComputedStats = ! settings . StatsComputationEnabled && ! settings . ApmTracingEnabledInternal ;
382
+ // When APM is disabled, we don't want to compute stats at all
383
+ // A common use case is in Application Security Monitoring (ASM) scenarios:
384
+ // when APM is disabled but ASM is enabled.
385
+ var clientComputedStats = ! settings . StatsComputationEnabled && ! settings . ApmTracingEnabledInternal ;
384
386
385
- var configuration = new TraceExporterConfiguration
386
- {
387
- Url = GetUrl ( settings ) ,
388
- TraceVersion = TracerConstants . AssemblyVersion ,
389
- Env = settings . Environment ,
390
- Version = settings . ServiceVersion ,
391
- Service = settings . ServiceName ,
392
- Hostname = HostMetadata . Instance . Hostname ,
393
- Language = ".NET" ,
394
- LanguageVersion = FrameworkDescription . Instance . ProductVersion ,
395
- LanguageInterpreter = FrameworkDescription . Instance . Name ,
396
- ComputeStats = settings . StatsComputationEnabled ,
397
- TelemetryClientConfiguration = telemetryClientConfiguration ,
398
- ClientComputedStats = clientComputedStats
399
- } ;
387
+ var configuration = new TraceExporterConfiguration
388
+ {
389
+ Url = GetUrl ( settings ) ,
390
+ TraceVersion = TracerConstants . AssemblyVersion ,
391
+ Env = settings . Environment ,
392
+ Version = settings . ServiceVersion ,
393
+ Service = settings . ServiceName ,
394
+ Hostname = HostMetadata . Instance . Hostname ,
395
+ Language = ".NET" ,
396
+ LanguageVersion = FrameworkDescription . Instance . ProductVersion ,
397
+ LanguageInterpreter = FrameworkDescription . Instance . Name ,
398
+ ComputeStats = settings . StatsComputationEnabled ,
399
+ TelemetryClientConfiguration = telemetryClientConfiguration ,
400
+ ClientComputedStats = clientComputedStats
401
+ } ;
400
402
401
- return new TraceExporter ( configuration ) ;
403
+ return new TraceExporter ( configuration ) ;
404
+ }
405
+ catch ( Exception ex )
406
+ {
407
+ Log . Error ( ex , "Failed to create native Trace Exporter, falling back to managed API" ) ;
408
+ }
402
409
}
403
410
404
411
return new Api ( apiRequestFactory , statsd , updateSampleRates , partialFlushEnabled ) ;
0 commit comments