diff --git a/packages/node_modules/@node-red/runtime/lib/telemetry/index.js b/packages/node_modules/@node-red/runtime/lib/telemetry/index.js index 3c9c5ce4d..02314570e 100644 --- a/packages/node_modules/@node-red/runtime/lib/telemetry/index.js +++ b/packages/node_modules/@node-red/runtime/lib/telemetry/index.js @@ -6,6 +6,9 @@ const cronosjs = require('cronosjs') const METRICS_DIR = path.join(__dirname, 'metrics') const INITIAL_PING_DELAY = 1000 * 60 * 30 // 30 minutes from startup +/** @type {import("got").Got | undefined} */ +let got + let runtime let scheduleTask @@ -48,11 +51,14 @@ async function report () { } // If enabled, gather metrics const metrics = await gather() - console.log(JSON.stringify(metrics, null, 2)) + runtime.log.debug(`Telemetry metrics: ${JSON.stringify(metrics, null, 2)}`) // Post metrics to endpoint - handle any error silently - const { got } = await import('got') + if (!got) { + got = (await import('got')).got + } + runtime.log.debug('Sending telemetry') const response = await got.post('https://telemetry.nodered.org/ping', { json: metrics,