Skip to content

Commit ca372e5

Browse files
VIA-286 AJ/AS Enabling logging of performance profiling in preprod
1 parent f43dfce commit ca372e5

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

infrastructure/environments/prod/locals.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ locals {
2121
application_environment_variables = {
2222
SSM_PREFIX = "/${local.prefix}/"
2323

24-
PINO_LOG_LEVEL = "warn"
24+
PINO_LOG_LEVEL = "error"
2525
DEPLOY_ENVIRONMENT = local.environment
2626
PROFILE_PERFORMANCE = "false"
2727

src/utils/performance.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ const profilePerformanceStart = (markerName: string) => {
1313
const profilePerformanceEnd = (markerName: string) => {
1414
if (isPerformanceProfilingEnabled) {
1515
const measurement = performance.measure(`${markerName}-latency`, markerName);
16-
log.info(
17-
{
18-
marker: measurement.name,
19-
startTimestamp: measurement.startTime,
20-
latencyMillis: measurement.duration,
21-
},
22-
"performance profile",
23-
);
16+
const message = {
17+
marker: measurement.name,
18+
startTimestamp: measurement.startTime,
19+
latencyMillis: measurement.duration,
20+
};
21+
if (process.env.PINO_LOG_LEVEL === "info") {
22+
log.info(message, "performance profile");
23+
} else {
24+
log.warn(message, "performance profile");
25+
}
2426
}
2527
};
2628

0 commit comments

Comments
 (0)