Skip to content

Commit

Permalink
move all listener code inside condition
Browse files Browse the repository at this point in the history
  • Loading branch information
TalUsvyatsky committed May 8, 2024
1 parent 5365237 commit 75ae1c8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,10 @@ export async function emitTelemetryOnErrorOutsideHandler(
}

const config = getConfig();
const metricsListener = new MetricsListener(new KMSService(), config);
await metricsListener.onStartInvocation(undefined);
if (config.enhancedMetrics) {
const metricsListener = new MetricsListener(new KMSService(), config);
await metricsListener.onStartInvocation(undefined);
incrementErrorsMetric(metricsListener);
await metricsListener.onCompleteInvocation();
}
await metricsListener.onCompleteInvocation();
}

0 comments on commit 75ae1c8

Please sign in to comment.