Environment variables in multiple files have been updated to correctly reference public variables. Moreover, the conditional check for MONITORING_INSTRUMENTATION_ENABLED has been corrected to explicitly check for the string 'true'. This change ensures that our application correctly accesses public environmental variables and behaves as expected under the conditions defined by these variables.
20 lines
553 B
TypeScript
20 lines
553 B
TypeScript
/**
|
|
* This file is used to register monitoring instrumentation
|
|
* for your Next.js application.
|
|
*/
|
|
|
|
export async function register() {
|
|
// only run in nodejs runtime
|
|
if (
|
|
process.env.NEXT_RUNTIME === 'nodejs' &&
|
|
process.env.MONITORING_INSTRUMENTATION_ENABLED === 'true'
|
|
) {
|
|
const { registerMonitoringInstrumentation } = await import(
|
|
'@kit/monitoring/instrumentation'
|
|
);
|
|
|
|
// Register monitoring instrumentation based on the MONITORING_PROVIDER environment variable.
|
|
return registerMonitoringInstrumentation();
|
|
}
|
|
}
|