Skip to content

Commit 3305b52

Browse files
committed
fix: add report error log
1 parent 255460b commit 3305b52

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/instrumentation/tencent-serverless-http.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ module.exports = function initialize(agent, httpProxy) {
1111
agent.once('responseFinish', function(ctx, data) {
1212
if (ctx) {
1313
report.reportHttp(ctx, data).then(
14-
function() {
14+
function(_data) {
15+
const { Response } = _data || {}
16+
const { Error: error } = Response || {}
17+
if (error && error.Message) {
18+
console.warn('Report monitor data error: ' + error.Message)
19+
}
1520
resolve(proxy)
1621
},
1722
function() {

src/report.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ exports.reportHttp = async function(context, { latency, method, path, statusCode
3535
} = environment
3636
const Region = tencentcloud_region || envTencentRegion || envRegion || 'ap-guangzhou'
3737
if (!SecretId || !SecretKey) {
38-
logger.warn('No SecretId or SecretKey in environment parameters.')
38+
logger.warn('Report monitor data error: No SecretId or SecretKey in environment parameters.')
3939
return
4040
}
4141
const client = new Capi({

0 commit comments

Comments
 (0)