diff --git a/lib/tracer-config.js b/lib/tracer-config.js index 3779ed9a19..565fd71bbc 100644 --- a/lib/tracer-config.js +++ b/lib/tracer-config.js @@ -37,15 +37,24 @@ async function endTracingForCluster(config) { // If there are no traced languages, we don't need to do anything. if (!config.languages.some(languages_1.isTracedLanguage)) return; - const endTracingEnvVariables = JSON.parse(fs.readFileSync(path.resolve(config.dbLocation, "temp/tracingEnvironment/end-tracing.json"), "utf8")); - for (const [key, value] of Object.entries(endTracingEnvVariables)) { - if (value !== null) { - process.env[key] = value; - } - else { - delete process.env[key]; + const envVariablesFile = path.resolve(config.dbLocation, "temp/tracingEnvironment/end-tracing.json"); + if (!fs.existsSync(envVariablesFile)) { + throw new Error(`Environment file for ending tracing not found: ${envVariablesFile}`); + } + try { + const endTracingEnvVariables = JSON.parse(fs.readFileSync(envVariablesFile, "utf8")); + for (const [key, value] of Object.entries(endTracingEnvVariables)) { + if (value !== null) { + process.env[key] = value; + } + else { + delete process.env[key]; + } } } + catch (e) { + throw new Error(`Failed to parse file containing end tracing environment variables: ${e}`); + } } exports.endTracingForCluster = endTracingForCluster; async function getTracerConfigForCluster(config) { diff --git a/lib/tracer-config.js.map b/lib/tracer-config.js.map index 87e8d45530..1046e2a389 100644 --- a/lib/tracer-config.js.map +++ b/lib/tracer-config.js.map @@ -1 +1 @@ -{"version":3,"file":"tracer-config.js","sourceRoot":"","sources":["../src/tracer-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,qCAA8D;AAE9D,2CAAyD;AACzD,6CAA+B;AAC/B,iCAA4C;AAO5C,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,yBAAyB;IACzB,eAAe;IACf,8BAA8B;IAC9B,wBAAwB;IACxB,0BAA0B;CAC3B,CAAC,CAAC;AAEI,KAAK,UAAU,oBAAoB,CACxC,MAA0B;IAE1B,kEAAkE;IAClE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC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C;SACH;KACF;IAED,iFAAiF;IACjF,iEAAiE;IACjE,iFAAiF;IACjF,qEAAqE;IACrE,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC7E,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,IAAI,CAC/C,gBAAgB,CAAC,GAAG,CAAC,aAAa,CAAC,EACnC,OAAO,EACP,gBAAgB,CAAC,GAAG,CAAC,iBAAiB,CAAC,EACvC,aAAa,CACd,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AA1DD,0DA0DC"} \ No newline at end of file +{"version":3,"file":"tracer-config.js","sourceRoot":"","sources":["../src/tracer-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,qCAA8D;AAE9D,2CAAyD;AACzD,6CAA+B;AAC/B,iCAA4C;AAO5C,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,yBAAyB;IACzB,eAAe;IACf,8BAA8B;IAC9B,wBAAwB;IACxB,0BAA0B;CAC3B,CAAC,CAAC;AAEI,KAAK,UAAU,oBAAoB,CACxC,MAA0B;IAE1B,kEAAkE;IAClE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,4BAAgB,CAAC;QAAE,OAAO;IAErD,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CACnC,MAAM,CAAC,UAAU,EACjB,0CAA0C,CAC3C,CAAC;IACF,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QACpC,MAAM,IAAI,KAAK,CACb,kDAAkD,gBAAgB,EAAE,CACrE,CAAC;KACH;IACD,IAAI;QACF,MAAM,sBAAsB,GAA+B,IAAI,CAAC,KAAK,CACnE,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,MAAM,CAA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AG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC7E,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,IAAI,CAC/C,gBAAgB,CAAC,GAAG,CAAC,aAAa,CAAC,EACnC,OAAO,EACP,gBAAgB,CAAC,GAAG,CAAC,iBAAiB,CAAC,EACvC,aAAa,CACd,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AA1DD,0DA0DC"} \ No newline at end of file diff --git a/src/tracer-config.ts b/src/tracer-config.ts index 8afe56f59f..3437ed0e67 100644 --- a/src/tracer-config.ts +++ b/src/tracer-config.ts @@ -26,21 +26,30 @@ export async function endTracingForCluster( // If there are no traced languages, we don't need to do anything. if (!config.languages.some(isTracedLanguage)) return; - const endTracingEnvVariables: Map = JSON.parse( - fs.readFileSync( - path.resolve( - config.dbLocation, - "temp/tracingEnvironment/end-tracing.json" - ), - "utf8" - ) + const envVariablesFile = path.resolve( + config.dbLocation, + "temp/tracingEnvironment/end-tracing.json" ); - for (const [key, value] of Object.entries(endTracingEnvVariables)) { - if (value !== null) { - process.env[key] = value; - } else { - delete process.env[key]; + if (!fs.existsSync(envVariablesFile)) { + throw new Error( + `Environment file for ending tracing not found: ${envVariablesFile}` + ); + } + try { + const endTracingEnvVariables: Map = JSON.parse( + fs.readFileSync(envVariablesFile, "utf8") + ); + for (const [key, value] of Object.entries(endTracingEnvVariables)) { + if (value !== null) { + process.env[key] = value; + } else { + delete process.env[key]; + } } + } catch (e) { + throw new Error( + `Failed to parse file containing end tracing environment variables: ${e}` + ); } }