diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b20f29..869534a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +# [1.1.0](https://github.com/serverless-tencent/tencent-component-monitor/compare/v1.0.6...v1.1.0) (2020-05-28) + + +### Features + +* support no report flag ([982b418](https://github.com/serverless-tencent/tencent-component-monitor/commit/982b4182e513255f0d093c53aaf3136e0576cdd7)) + +## [1.0.6](https://github.com/serverless-tencent/tencent-component-monitor/compare/v1.0.5...v1.0.6) (2020-05-25) + + +### Bug Fixes + +* 上报增加100ms超时 ([a3f75dd](https://github.com/serverless-tencent/tencent-component-monitor/commit/a3f75dd05469e35204da38e3401b449539f685c0)) + ## [1.0.5](https://github.com/serverless-tencent/tencent-component-monitor/compare/v1.0.4...v1.0.5) (2020-05-20) diff --git a/package.json b/package.json index 4796f40..50bb92f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tencent-component-monitor", - "version": "1.0.5", + "version": "1.1.0", "description": "Tencent component monitor", "main": "src/index.js", "scripts": { @@ -69,6 +69,6 @@ "semantic-release": "^17.0.4" }, "dependencies": { - "@tencent-sdk/capi": "0.2.15" + "@tencent-sdk/capi": "^0.2.16" } } diff --git a/src/instrumentation/core/http.js b/src/instrumentation/core/http.js index 59c1fa0..dfb3fbd 100644 --- a/src/instrumentation/core/http.js +++ b/src/instrumentation/core/http.js @@ -23,7 +23,7 @@ function wrapEmitWithTransaction(agent, emit) { method: request.method, statusCode } - agent.emit('responseFinish', context, data) + agent.emit('responseFinish', context, data, request.__SLS_NO_REPORT__) } } transaction.end() diff --git a/src/instrumentation/tencent-serverless-http.js b/src/instrumentation/tencent-serverless-http.js index ce8ccbf..7b64ef8 100644 --- a/src/instrumentation/tencent-serverless-http.js +++ b/src/instrumentation/tencent-serverless-http.js @@ -8,8 +8,8 @@ module.exports = function initialize(agent, httpProxy) { transaction.init() const proxy = fn.apply(this, arguments) return new Promise(function(resolve) { - agent.once('responseFinish', function(ctx, data) { - if (ctx) { + agent.once('responseFinish', function(ctx, data, noReport) { + if (ctx && noReport !== true) { report.reportHttp(ctx, data).then( function(/* _data*/) { // const { Response } = _data || {} diff --git a/src/report.js b/src/report.js index 77a30dc..976363d 100644 --- a/src/report.js +++ b/src/report.js @@ -50,7 +50,8 @@ exports.reportHttp = async function(context, { latency, method, path, statusCode } const debugOptions = { debug: false, - host: 'monitor.tencentcloudapi.com' + host: 'monitor.tencentcloudapi.com', + timeout: 100 } const keyPrefix = `${method}_${path}`