diff --git a/CHANGELOG.md b/CHANGELOG.md index 0272b37d..76728851 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to Pinpoint Node.js agent will be documented in this file. +## [0.8.5] - 2024-05-13 +### Fixed +- #190 Remove JSON.stringify on Info Logger + ## [0.8.4] - 2024-05-03 ### Changed - #186 Change error log level to info log diff --git a/demo/express/app.js b/demo/express/app.js index 5271fed4..92bc3df7 100644 --- a/demo/express/app.js +++ b/demo/express/app.js @@ -12,7 +12,7 @@ var app = express(); // view engine setup app.set('views', path.join(__dirname, 'views')); -app.set('view engine', 'jade'); +app.set('view engine', 'pug'); app.use(logger('dev')); app.use(express.json()); diff --git a/demo/express/package.json b/demo/express/package.json index 65788af9..f0224dbb 100644 --- a/demo/express/package.json +++ b/demo/express/package.json @@ -6,14 +6,14 @@ "start": "node ./bin/www" }, "dependencies": { - "axios": "^0.19.2", + "axios": "^1.6.8", "cookie-parser": "~1.4.4", "debug": "~2.6.9", - "express": "~4.16.1", + "express": "^4.19.2", "http-errors": "~1.6.3", "ioredis": "^4.17.3", - "jade": "~1.11.0", "morgan": "~1.9.1", - "pinpoint-node-agent": "^0.7.0-rc.0" + "pinpoint-node-agent": "^0.8.5-next.2", + "pug": "^3.0.2" } } diff --git a/demo/express/views/error.jade b/demo/express/views/error.pug similarity index 100% rename from demo/express/views/error.jade rename to demo/express/views/error.pug diff --git a/demo/express/views/index.jade b/demo/express/views/index.pug similarity index 100% rename from demo/express/views/index.jade rename to demo/express/views/index.pug diff --git a/demo/express/views/layout.jade b/demo/express/views/layout.pug similarity index 100% rename from demo/express/views/layout.jade rename to demo/express/views/layout.pug diff --git a/lib/client/grpc-bidirectional-stream.js b/lib/client/grpc-bidirectional-stream.js index d4581e32..317faa61 100644 --- a/lib/client/grpc-bidirectional-stream.js +++ b/lib/client/grpc-bidirectional-stream.js @@ -25,12 +25,12 @@ class GrpcBidirectionalStream { }) stream.on('error', (e) => { if (log.isDebug() && e && name) { - log.debug(`GrpcBidirectionalStream stream on error. ${name} on(error): ${JSON.stringify(e)}`) + log.debug(`GrpcBidirectionalStream stream on error. ${name} on(error): ${e}`) } }) stream.on('status', (status) => { if (log.isDebug() && status && name) { - log.debug(`GrpcBidirectionalStream stream data. ${name} on(status): ${JSON.stringify(status)}`) + log.debug(`GrpcBidirectionalStream stream data. ${name} on(status): ${status}`) } }) return stream diff --git a/lib/client/grpc-client-side-stream.js b/lib/client/grpc-client-side-stream.js index e2bf95b1..e42f6a9f 100644 --- a/lib/client/grpc-client-side-stream.js +++ b/lib/client/grpc-client-side-stream.js @@ -36,12 +36,12 @@ class GrpcClientSideStream { }) stream.on('error', (e) => { if (log.isDebug() && e && name) { - log.debug(`GrpcClientSideStream stream on error. ${name} on(error): ${JSON.stringify(e)}`) + log.debug(`GrpcClientSideStream stream on error. ${name} on(error): ${e}`) } }) stream.on('status', (status) => { if (log.isDebug() && status && name) { - log.debug(`GrpcClientSideStream stream data. ${name} on(status): ${JSON.stringify(status)}`) + log.debug(`GrpcClientSideStream stream data. ${name} on(status): ${status}`) } }) return stream diff --git a/lib/client/grpc-data-sender.js b/lib/client/grpc-data-sender.js index 4fd9530f..c0bdcfe4 100644 --- a/lib/client/grpc-data-sender.js +++ b/lib/client/grpc-data-sender.js @@ -110,9 +110,6 @@ class GrpcDataSender { sendAgentInfo(agentInfo, callback) { const pAgentInfo = dataConvertor.convertAgentInfo(agentInfo) - if (log.isDebug()) { - log.debug(`sendAgentInfo pAgentInfo: ${JSON.stringify(pAgentInfo.toObject())}`) - } this.requestAgentInfo.request(pAgentInfo, (err, response) => { if (callback) { callback(err, response) @@ -134,9 +131,6 @@ class GrpcDataSender { sendApiMetaInfo(apiMetaInfo, callback) { const pApiMetaData = dataConvertor.convertApiMetaInfo(apiMetaInfo) - if (log.isDebug()) { - log.debug(`sendApiMetaInfo pApiMetaData: ${JSON.stringify(pApiMetaData.toObject())}`) - } this.requestApiMetaData.request(pApiMetaData, (err, response) => { if (err) { log.error(err) @@ -149,9 +143,6 @@ class GrpcDataSender { sendStringMetaInfo(stringMetaInfo, callback) { const pStringMetaData = dataConvertor.convertStringMetaInfo(stringMetaInfo) - if (log.isDebug()) { - log.debug(`sendStringMetaInfo pStringMetaData: ${JSON.stringify(pStringMetaData.toObject())}`) - } this.requestStringMetaData.request(pStringMetaData, (err, response) => { if (err) { log.error(err) @@ -165,9 +156,6 @@ class GrpcDataSender { sendSpan(span) { try { const pSpan = span.spanMessage - if (log.isDebug()) { - log.debug(`sendSpan pSpan: ${JSON.stringify(pSpan.toObject())}`) - } this.spanStream.write(pSpan) } catch (e) { if (e && e.stack) { @@ -179,9 +167,6 @@ class GrpcDataSender { sendSpanChunk(spanChunk) { try { const pSpanChunk = spanChunk.spanMessage - if (log.isDebug()) { - log.debug(`sendSpanChunk pSpanChunk: ${JSON.stringify(pSpanChunk.toObject())}`) - } this.spanStream.write(pSpanChunk) } catch (e) { if (e && e.stack) { @@ -193,9 +178,6 @@ class GrpcDataSender { sendStat(stat) { try { const pStatMessage = dataConvertor.convertStat(stat) - if (log.isDebug()) { - log.debug(`sendStats pStatMessage: ${JSON.stringify(stat)}`) - } this.statStream.write(pStatMessage) } catch (e) { if (e && e.stack) { @@ -206,17 +188,11 @@ class GrpcDataSender { sendControlHandshake(params) { const pCmdMessage = dataConvertor.convertCmdMessage(params) - if (log.isDebug()) { - log.debug(`sendControlHandshake pCmdMessage: ${JSON.stringify(pCmdMessage.toObject())}`) - } this.profilerStream.write(pCmdMessage) } sendPing() { const pPing = dataConvertor.convertPing() - if (log.isDebug()) { - log.debug(`sendPing pPing: ${JSON.stringify(pPing)}`) - } this.pingStream.write(pPing) } diff --git a/lib/instrumentation/http-shared.js b/lib/instrumentation/http-shared.js index f5277c0a..1e1b3101 100644 --- a/lib/instrumentation/http-shared.js +++ b/lib/instrumentation/http-shared.js @@ -34,10 +34,6 @@ exports.instrumentRequest = function (agent, moduleName) { return function (original) { return function (event, req, res) { if (event === 'request') { - if (log.isInfo()) { - log.info('instrumentRequest in http-shared.js ' + JSON.stringify(req)) - } - const requestData = RequestHeaderUtils.read(req) if (!getPathMatcher().matchPath(requestData.rpcName)) { const trace = agent.createTraceObject(requestData) @@ -47,9 +43,6 @@ exports.instrumentRequest = function (agent, moduleName) { } endOfStream(res, function (err) { - if (log.isInfo()) { - log.info('endOfStream in http-shared.js ' + JSON.stringify(res)) - } if (!err) { if (trace && trace.canSampled()) { trace.spanRecorder.recordAttribute(DefaultAnnotationKey.HTTP_STATUS_CODE, this.statusCode) @@ -131,7 +124,6 @@ exports.traceOutgoingRequest = function (agent, moduleName) { return req function onresponse(res) { - log.debug('intercepted http.ClientcRequest response event %o', {id: httpURL}) // Inspired by: // https://github.com/nodejs/node/blob/9623ce572a02632b7596452e079bba066db3a429/lib/events.js#L258-L274 if (res.prependListener) { @@ -151,7 +143,6 @@ exports.traceOutgoingRequest = function (agent, moduleName) { } function onEnd() { - log.debug('intercepted http.IncomingMessage end event %o', {id: httpURL}) if (asyncTrace) { asyncEventRecorder.recordAttribute(DefaultAnnotationKey.HTTP_STATUS_CODE, this.statusCode) asyncTrace.traceAsyncEnd(asyncEventRecorder) diff --git a/package.json b/package.json index a3c0e666..7a36acb9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pinpoint-node-agent", - "version": "0.8.4", + "version": "0.8.5", "main": "index.js", "scripts": { "test": "tape ./test/**/*.test.js",