@@ -120,7 +120,7 @@ function _setDefaultConfig() {
120120 defaultClient . config . enableAutoDependencyCorrelation = true ;
121121 }
122122 if ( defaultClient . config . enableSendLiveMetrics == undefined ) {
123- defaultClient . config . enableSendLiveMetrics = true ;
123+ defaultClient . config . enableSendLiveMetrics = false ;
124124 }
125125 if ( defaultClient . config . enableAutoCollectExtendedMetrics == undefined ) {
126126 defaultClient . config . enableAutoCollectExtendedMetrics = true ;
@@ -154,8 +154,14 @@ export function start() {
154154 _serverRequests . enable ( defaultClient . config . enableAutoCollectRequests ) ;
155155 _clientRequests . enable ( defaultClient . config . enableAutoCollectDependencies ) ;
156156 _webSnippet . enable ( defaultClient . config . enableWebInstrumentation , defaultClient . config . webInstrumentationConnectionString ) ;
157- if ( liveMetricsClient && defaultClient . config . enableSendLiveMetrics ) {
158- liveMetricsClient . enable ( defaultClient . config . enableSendLiveMetrics ) ;
157+ if ( defaultClient . config . enableSendLiveMetrics ) {
158+ if ( ! liveMetricsClient ) {
159+ // No qps client exists. Create one and prepare it to be enabled at .start()
160+ liveMetricsClient = new QuickPulseClient ( defaultClient . config , defaultClient . context , defaultClient . getAuthorizationHandler ) ;
161+ _performanceLiveMetrics = new AutoCollectPerformance ( liveMetricsClient as any , 1000 , true ) ;
162+ liveMetricsClient . addCollector ( _performanceLiveMetrics ) ;
163+ defaultClient . quickPulseClient = liveMetricsClient ; // Need this so we can forward all manual tracks to live metrics via PerformanceMetricsTelemetryProcessor
164+ }
159165 }
160166 _azureFunctions . enable ( defaultClient . config . enableAutoCollectIncomingRequestAzureFunctions ) ;
161167
@@ -505,7 +511,6 @@ export function dispose() {
505511 }
506512 if ( liveMetricsClient ) {
507513 liveMetricsClient . enable ( false ) ;
508- defaultClient . config . enableSendLiveMetrics = false ;
509514 liveMetricsClient = undefined ;
510515 }
511516 if ( _azureFunctions ) {
0 commit comments