sobey-monitor-sdk 1.1.17 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +19 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +19 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +19 -17
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -423,11 +423,11 @@ if (typeof window !== 'undefined') {
|
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
+
var version = "1.1.17";
|
|
427
|
+
|
|
426
428
|
/**
|
|
427
429
|
* 数据上报管理
|
|
428
430
|
*/
|
|
429
|
-
// SDK 版本
|
|
430
|
-
const SDK_VERSION$1 = '1.0.0';
|
|
431
431
|
/**
|
|
432
432
|
* 上报器类
|
|
433
433
|
*/
|
|
@@ -564,7 +564,7 @@ class Reporter {
|
|
|
564
564
|
pageUrl: getPageUrl(),
|
|
565
565
|
timestamp: Date.now(),
|
|
566
566
|
userAgent: getUserAgent(),
|
|
567
|
-
sdkVersion: cfg.version ||
|
|
567
|
+
sdkVersion: cfg.version || version,
|
|
568
568
|
};
|
|
569
569
|
}
|
|
570
570
|
/**
|
|
@@ -839,19 +839,20 @@ function shouldReportHttpError(status) {
|
|
|
839
839
|
// 获取配置的状态码列表
|
|
840
840
|
if (!config.isInitialized()) {
|
|
841
841
|
// 配置未初始化时,不上报
|
|
842
|
+
console.log(`[Monitor] shouldReportHttpError: config not initialized, status=${status}, returning false`);
|
|
842
843
|
return false;
|
|
843
844
|
}
|
|
844
845
|
const cfg = config.get();
|
|
845
846
|
const httpErrorStatusCodes = cfg.error?.httpErrorStatusCodes;
|
|
846
847
|
// 如果未配置状态码列表或为空数组,则不上报任何HTTP错误
|
|
847
848
|
if (!httpErrorStatusCodes || httpErrorStatusCodes.length === 0) {
|
|
849
|
+
console.log(`[Monitor] shouldReportHttpError: no httpErrorStatusCodes configured, status=${status}, returning false`);
|
|
848
850
|
return false;
|
|
849
851
|
}
|
|
850
852
|
// 只检查状态码是否在配置的列表中
|
|
851
853
|
const shouldReport = httpErrorStatusCodes.includes(status);
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
}
|
|
854
|
+
// 临时强制输出调试日志
|
|
855
|
+
console.log(`[Monitor] HTTP status ${status} shouldReport: ${shouldReport}, configured codes:`, httpErrorStatusCodes);
|
|
855
856
|
return shouldReport;
|
|
856
857
|
}
|
|
857
858
|
/**
|
|
@@ -1117,13 +1118,16 @@ function interceptFetch() {
|
|
|
1117
1118
|
},
|
|
1118
1119
|
});
|
|
1119
1120
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1121
|
+
// 网络错误也遵守 httpErrorStatusCodes 配置
|
|
1122
|
+
if (shouldReportHttpError(0)) {
|
|
1123
|
+
reportHttpError({
|
|
1124
|
+
method,
|
|
1125
|
+
url,
|
|
1126
|
+
status: 0,
|
|
1127
|
+
duration,
|
|
1128
|
+
requestBody,
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1127
1131
|
throw error;
|
|
1128
1132
|
}
|
|
1129
1133
|
};
|
|
@@ -1934,8 +1938,6 @@ function createUseMonitorError(React) {
|
|
|
1934
1938
|
* 前端监控 SDK
|
|
1935
1939
|
* @description 错误监控、性能监控、行为监控
|
|
1936
1940
|
*/
|
|
1937
|
-
// SDK 版本
|
|
1938
|
-
const SDK_VERSION = '1.0.0';
|
|
1939
1941
|
/**
|
|
1940
1942
|
* 监控 SDK 主类
|
|
1941
1943
|
*/
|
|
@@ -2013,7 +2015,7 @@ class MonitorSDK {
|
|
|
2013
2015
|
// 初始化配置管理器
|
|
2014
2016
|
config.init({
|
|
2015
2017
|
...finalConfig,
|
|
2016
|
-
version: finalConfig.version ||
|
|
2018
|
+
version: finalConfig.version || version,
|
|
2017
2019
|
}, true);
|
|
2018
2020
|
this.ready = true;
|
|
2019
2021
|
this.loading = false;
|
|
@@ -2190,7 +2192,7 @@ class MonitorSDK {
|
|
|
2190
2192
|
* 获取 SDK 版本
|
|
2191
2193
|
*/
|
|
2192
2194
|
getVersion() {
|
|
2193
|
-
return
|
|
2195
|
+
return version;
|
|
2194
2196
|
}
|
|
2195
2197
|
}
|
|
2196
2198
|
// 导出单例
|