From 1c253ece2519f6beca073ca4525095b55171437d Mon Sep 17 00:00:00 2001 From: Igor Unanua Date: Fri, 29 Nov 2024 16:00:29 +0100 Subject: [PATCH] A bunch more messages --- .../src/helpers/bundler-register.js | 2 +- packages/datadog-instrumentations/src/jest.js | 6 +++--- packages/datadog-instrumentations/src/playwright.js | 4 ++-- .../datadog-plugin-aws-sdk/src/services/eventbridge.js | 2 +- .../datadog-plugin-aws-sdk/src/services/kinesis.js | 2 +- packages/datadog-plugin-aws-sdk/src/services/lambda.js | 2 +- packages/datadog-plugin-aws-sdk/src/services/sqs.js | 2 +- packages/datadog-plugin-oracledb/src/index.js | 2 +- packages/datadog-shimmer/src/shimmer.js | 4 ++-- .../src/ci-visibility/dynamic-instrumentation/index.js | 4 ++-- .../dd-trace/src/debugger/devtools_client/config.js | 2 +- .../dd-trace/src/debugger/devtools_client/index.js | 2 +- .../src/debugger/devtools_client/remote_config.js | 2 +- .../dd-trace/src/debugger/devtools_client/status.js | 2 +- packages/dd-trace/src/debugger/index.js | 8 ++++---- packages/dd-trace/src/plugins/util/git.js | 10 +++++----- packages/dd-trace/src/plugins/util/web.js | 4 ++-- 17 files changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/datadog-instrumentations/src/helpers/bundler-register.js b/packages/datadog-instrumentations/src/helpers/bundler-register.js index 491a0ba0600..6c11329bc36 100644 --- a/packages/datadog-instrumentations/src/helpers/bundler-register.js +++ b/packages/datadog-instrumentations/src/helpers/bundler-register.js @@ -47,7 +47,7 @@ dc.subscribe(CHANNEL, (payload) => { loadChannel.publish({ name, version: payload.version, file }) payload.module = hook(payload.module, payload.version) } catch (e) { - log.error(e) + log.error('Error executing bundler hook', e) } } }) diff --git a/packages/datadog-instrumentations/src/jest.js b/packages/datadog-instrumentations/src/jest.js index 0841ab4783a..fd13d2fc805 100644 --- a/packages/datadog-instrumentations/src/jest.js +++ b/packages/datadog-instrumentations/src/jest.js @@ -451,7 +451,7 @@ function cliWrapper (cli, jestVersion) { earlyFlakeDetectionFaultyThreshold = libraryConfig.earlyFlakeDetectionFaultyThreshold } } catch (err) { - log.error(err) + log.error('Jest library configuration error', err) } if (isEarlyFlakeDetectionEnabled) { @@ -472,7 +472,7 @@ function cliWrapper (cli, jestVersion) { isEarlyFlakeDetectionEnabled = false } } catch (err) { - log.error(err) + log.error('Jest known tests error', err) } } @@ -491,7 +491,7 @@ function cliWrapper (cli, jestVersion) { skippableSuites = receivedSkippableSuites } } catch (err) { - log.error(err) + log.error('Jest test-suite skippable error', err) } } diff --git a/packages/datadog-instrumentations/src/playwright.js b/packages/datadog-instrumentations/src/playwright.js index e8332d65c8d..ea6fc822a43 100644 --- a/packages/datadog-instrumentations/src/playwright.js +++ b/packages/datadog-instrumentations/src/playwright.js @@ -412,7 +412,7 @@ function runnerHook (runnerExport, playwrightVersion) { } } catch (e) { isEarlyFlakeDetectionEnabled = false - log.error(e) + log.error('Playwright session start error', e) } if (isEarlyFlakeDetectionEnabled && semver.gte(playwrightVersion, MINIMUM_SUPPORTED_VERSION_EFD)) { @@ -425,7 +425,7 @@ function runnerHook (runnerExport, playwrightVersion) { } } catch (err) { isEarlyFlakeDetectionEnabled = false - log.error(err) + log.error('Playwright known tests error', err) } } diff --git a/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js b/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js index b316f75e6be..a5ca5f08de1 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +++ b/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js @@ -45,7 +45,7 @@ class EventBridge extends BaseAwsSdkPlugin { } request.params.Entries[0].Detail = finalData } catch (e) { - log.error(e) + log.error('EventBridge error injecting request', e) } } } diff --git a/packages/datadog-plugin-aws-sdk/src/services/kinesis.js b/packages/datadog-plugin-aws-sdk/src/services/kinesis.js index 64a67d768ea..cdbd7c077e9 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +++ b/packages/datadog-plugin-aws-sdk/src/services/kinesis.js @@ -97,7 +97,7 @@ class Kinesis extends BaseAwsSdkPlugin { parsedAttributes: decodedData._datadog } } catch (e) { - log.error(e) + log.error('Kinesis error extracting response', e) } } diff --git a/packages/datadog-plugin-aws-sdk/src/services/lambda.js b/packages/datadog-plugin-aws-sdk/src/services/lambda.js index f6ea874872e..b5fe1981c20 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/lambda.js +++ b/packages/datadog-plugin-aws-sdk/src/services/lambda.js @@ -43,7 +43,7 @@ class Lambda extends BaseAwsSdkPlugin { const newContextBase64 = Buffer.from(JSON.stringify(clientContext)).toString('base64') request.params.ClientContext = newContextBase64 } catch (err) { - log.error(err) + log.error('Lambda error injecting request', err) } } } diff --git a/packages/datadog-plugin-aws-sdk/src/services/sqs.js b/packages/datadog-plugin-aws-sdk/src/services/sqs.js index e3a76c3e0b9..9857e46bf28 100644 --- a/packages/datadog-plugin-aws-sdk/src/services/sqs.js +++ b/packages/datadog-plugin-aws-sdk/src/services/sqs.js @@ -163,7 +163,7 @@ class Sqs extends BaseAwsSdkPlugin { return JSON.parse(buffer) } } catch (e) { - log.error(e) + log.error('Sqs error parsing DD attributes', e) } } diff --git a/packages/datadog-plugin-oracledb/src/index.js b/packages/datadog-plugin-oracledb/src/index.js index 7c2f1da029f..eb4fa037cac 100644 --- a/packages/datadog-plugin-oracledb/src/index.js +++ b/packages/datadog-plugin-oracledb/src/index.js @@ -33,7 +33,7 @@ function getUrl (connectString) { try { return new URL(`http://${connectString}`) } catch (e) { - log.error(e) + log.error('Invalid oracle connection string', e) return {} } } diff --git a/packages/datadog-shimmer/src/shimmer.js b/packages/datadog-shimmer/src/shimmer.js index d12c4c130ef..0285c5e5083 100644 --- a/packages/datadog-shimmer/src/shimmer.js +++ b/packages/datadog-shimmer/src/shimmer.js @@ -136,7 +136,7 @@ function wrapMethod (target, name, wrapper, noAssert) { if (callState.completed) { // error was thrown after original function returned/resolved, so // it was us. log it. - log.error(e) + log.error('Shimmer error was thrown after original function returned/resolved', e) // original ran and returned something. return it. return callState.retVal } @@ -144,7 +144,7 @@ function wrapMethod (target, name, wrapper, noAssert) { if (!callState.called) { // error was thrown before original function was called, so // it was us. log it. - log.error(e) + log.error('Shimmer error was thrown before original function was called', e) // original never ran. call it unwrapped. return original.apply(this, args) } diff --git a/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js b/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js index ef65489e60d..ec6e2a1fd75 100644 --- a/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +++ b/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js @@ -90,8 +90,8 @@ class TestVisDynamicInstrumentation { } }).unref() - this.worker.on('error', (err) => log.error(err)) - this.worker.on('messageerror', (err) => log.error(err)) + this.worker.on('error', (err) => log.error('ci-visibility DI worker error', err)) + this.worker.on('messageerror', (err) => log.error('ci-visibility DI worker messageerror', err)) } } diff --git a/packages/dd-trace/src/debugger/devtools_client/config.js b/packages/dd-trace/src/debugger/devtools_client/config.js index 838a1a76cca..fa48779f313 100644 --- a/packages/dd-trace/src/debugger/devtools_client/config.js +++ b/packages/dd-trace/src/debugger/devtools_client/config.js @@ -15,7 +15,7 @@ const config = module.exports = { updateUrl(parentConfig) configPort.on('message', updateUrl) -configPort.on('messageerror', (err) => log.error(err)) +configPort.on('messageerror', (err) => log.error('Debugger config messageerror', err)) function updateUrl (updates) { config.url = updates.url || format({ diff --git a/packages/dd-trace/src/debugger/devtools_client/index.js b/packages/dd-trace/src/debugger/devtools_client/index.js index db71e7028e7..116688c2183 100644 --- a/packages/dd-trace/src/debugger/devtools_client/index.js +++ b/packages/dd-trace/src/debugger/devtools_client/index.js @@ -93,7 +93,7 @@ session.on('Debugger.paused', async ({ params }) => { // TODO: Process template (DEBUG-2628) send(probe.template, logger, snapshot, (err) => { - if (err) log.error(err) + if (err) log.error('Debugger error', err) else ackEmitting(probe) }) } diff --git a/packages/dd-trace/src/debugger/devtools_client/remote_config.js b/packages/dd-trace/src/debugger/devtools_client/remote_config.js index 8a7d7386e33..3db13dc39a6 100644 --- a/packages/dd-trace/src/debugger/devtools_client/remote_config.js +++ b/packages/dd-trace/src/debugger/devtools_client/remote_config.js @@ -44,7 +44,7 @@ rcPort.on('message', async ({ action, conf: probe, ackId }) => { ackError(err, probe) } }) -rcPort.on('messageerror', (err) => log.error(err)) +rcPort.on('messageerror', (err) => log.error('Debugger RC message error', err)) async function start () { sessionStarted = true diff --git a/packages/dd-trace/src/debugger/devtools_client/status.js b/packages/dd-trace/src/debugger/devtools_client/status.js index b28fc3c281e..3fb41b63b11 100644 --- a/packages/dd-trace/src/debugger/devtools_client/status.js +++ b/packages/dd-trace/src/debugger/devtools_client/status.js @@ -55,7 +55,7 @@ function ackEmitting ({ id: probeId, version }) { } function ackError (err, { id: probeId, version }) { - log.error(err) + log.error('Debugger ackError', err) onlyUniqueUpdates(STATUSES.ERROR, probeId, version, () => { const payload = statusPayload(probeId, version, STATUSES.ERROR) diff --git a/packages/dd-trace/src/debugger/index.js b/packages/dd-trace/src/debugger/index.js index 8e3fa56c2e8..cdfa2744451 100644 --- a/packages/dd-trace/src/debugger/index.js +++ b/packages/dd-trace/src/debugger/index.js @@ -40,7 +40,7 @@ function start (config, rc) { ack(error) rcAckCallbacks.delete(ackId) }) - rcChannel.port2.on('messageerror', (err) => log.error(err)) + rcChannel.port2.on('messageerror', (err) => log.error('Debugger RC messageerror', err)) worker = new Worker( join(__dirname, 'devtools_client', 'index.js'), @@ -63,13 +63,13 @@ function start (config, rc) { log.debug(`Dynamic Instrumentation worker thread started successfully (thread id: ${worker.threadId})`) }) - worker.on('error', (err) => log.error(err)) - worker.on('messageerror', (err) => log.error(err)) + worker.on('error', (err) => log.error('Debugger worker error', err)) + worker.on('messageerror', (err) => log.error('Debugger worker messageerror', err)) worker.on('exit', (code) => { const error = new Error(`Dynamic Instrumentation worker thread exited unexpectedly with code ${code}`) - log.error(error) + log.error('Debugger worker exited unexpectedly', error) // Be nice, clean up now that the worker thread encounted an issue and we can't continue rc.removeProductHandler('LIVE_DEBUGGING') diff --git a/packages/dd-trace/src/plugins/util/git.js b/packages/dd-trace/src/plugins/util/git.js index 841755e9246..47707a48679 100644 --- a/packages/dd-trace/src/plugins/util/git.js +++ b/packages/dd-trace/src/plugins/util/git.js @@ -61,7 +61,7 @@ function sanitizedExec ( exitCode: err.status || err.errno }) } - log.error(err) + log.error('Git plugin error executing command', err) return '' } finally { storage.enterWith(store) @@ -144,7 +144,7 @@ function unshallowRepository () { ], { stdio: 'pipe' }) } catch (err) { // If the local HEAD is a commit that has not been pushed to the remote, the above command will fail. - log.error(err) + log.error('Git plugin error executing git command', err) incrementCountMetric( TELEMETRY_GIT_COMMAND_ERRORS, { command: 'unshallow', errorType: err.code, exitCode: err.status || err.errno } @@ -157,7 +157,7 @@ function unshallowRepository () { ], { stdio: 'pipe' }) } catch (err) { // If the CI is working on a detached HEAD or branch tracking hasn’t been set up, the above command will fail. - log.error(err) + log.error('Git plugin error executing fallback git command', err) incrementCountMetric( TELEMETRY_GIT_COMMAND_ERRORS, { command: 'unshallow', errorType: err.code, exitCode: err.status || err.errno } @@ -272,7 +272,7 @@ function generatePackFilesForCommits (commitsToUpload) { try { result = execGitPackObjects(temporaryPath) } catch (err) { - log.error(err) + log.error('Git plugin error executing git pack-objects command', err) incrementCountMetric( TELEMETRY_GIT_COMMAND_ERRORS, { command: 'pack_objects', exitCode: err.status || err.errno, errorType: err.code } @@ -292,7 +292,7 @@ function generatePackFilesForCommits (commitsToUpload) { try { result = execGitPackObjects(cwdPath) } catch (err) { - log.error(err) + log.error('Git plugin error executing fallback git pack-objects command', err) incrementCountMetric( TELEMETRY_GIT_COMMAND_ERRORS, { command: 'pack_objects', exitCode: err.status || err.errno, errorType: err.code } diff --git a/packages/dd-trace/src/plugins/util/web.js b/packages/dd-trace/src/plugins/util/web.js index 5bfb1d6fad4..2d92c74ea91 100644 --- a/packages/dd-trace/src/plugins/util/web.js +++ b/packages/dd-trace/src/plugins/util/web.js @@ -546,7 +546,7 @@ function getHeadersToRecord (config) { .map(h => h.split(':')) .map(([key, tag]) => [key.toLowerCase(), tag]) } catch (err) { - log.error(err) + log.error('Web plugin error getting headers', err) } } else if (config.hasOwnProperty('headers')) { log.error('Expected `headers` to be an array of strings.') @@ -595,7 +595,7 @@ function getQsObfuscator (config) { try { return new RegExp(obfuscator, 'gi') } catch (err) { - log.error(err) + log.error('Web plugin error getting qs obfuscator', err) } }