Skip to content

Commit

Permalink
Fix issue with Live Metrics enablement (#1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorhdzg committed Nov 8, 2023
1 parent f250ff8 commit cc5c36a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions applicationinsights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ export function start() {
_clientRequests.enable(defaultClient.config.enableAutoCollectDependencies);
_webSnippet.enable(defaultClient.config.enableWebInstrumentation, defaultClient.config.webInstrumentationConnectionString);
if (defaultClient.config.enableSendLiveMetrics) {
// Initialize Live metrics in case config was provided in telemetryClient config, double initialization check is part of liveMetrics client
if (!liveMetricsClient) {
// No qps client exists. Create one and prepare it to be enabled at .start()
liveMetricsClient = new QuickPulseClient(defaultClient.config, defaultClient.context, defaultClient.getAuthorizationHandler);
_performanceLiveMetrics = new AutoCollectPerformance(liveMetricsClient as any, 1000, true);
liveMetricsClient.addCollector(_performanceLiveMetrics);
defaultClient.quickPulseClient = liveMetricsClient; // Need this so we can forward all manual tracks to live metrics via PerformanceMetricsTelemetryProcessor
}
liveMetricsClient.enable(defaultClient.config.enableSendLiveMetrics)
}
_azureFunctions.enable(defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions);

Expand Down

0 comments on commit cc5c36a

Please sign in to comment.