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.cjs.js
CHANGED
|
@@ -427,11 +427,11 @@ if (typeof window !== 'undefined') {
|
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
+
var version = "1.1.17";
|
|
431
|
+
|
|
430
432
|
/**
|
|
431
433
|
* 数据上报管理
|
|
432
434
|
*/
|
|
433
|
-
// SDK 版本
|
|
434
|
-
const SDK_VERSION$1 = '1.0.0';
|
|
435
435
|
/**
|
|
436
436
|
* 上报器类
|
|
437
437
|
*/
|
|
@@ -568,7 +568,7 @@ class Reporter {
|
|
|
568
568
|
pageUrl: getPageUrl(),
|
|
569
569
|
timestamp: Date.now(),
|
|
570
570
|
userAgent: getUserAgent(),
|
|
571
|
-
sdkVersion: cfg.version ||
|
|
571
|
+
sdkVersion: cfg.version || version,
|
|
572
572
|
};
|
|
573
573
|
}
|
|
574
574
|
/**
|
|
@@ -843,19 +843,20 @@ function shouldReportHttpError(status) {
|
|
|
843
843
|
// 获取配置的状态码列表
|
|
844
844
|
if (!config.isInitialized()) {
|
|
845
845
|
// 配置未初始化时,不上报
|
|
846
|
+
console.log(`[Monitor] shouldReportHttpError: config not initialized, status=${status}, returning false`);
|
|
846
847
|
return false;
|
|
847
848
|
}
|
|
848
849
|
const cfg = config.get();
|
|
849
850
|
const httpErrorStatusCodes = cfg.error?.httpErrorStatusCodes;
|
|
850
851
|
// 如果未配置状态码列表或为空数组,则不上报任何HTTP错误
|
|
851
852
|
if (!httpErrorStatusCodes || httpErrorStatusCodes.length === 0) {
|
|
853
|
+
console.log(`[Monitor] shouldReportHttpError: no httpErrorStatusCodes configured, status=${status}, returning false`);
|
|
852
854
|
return false;
|
|
853
855
|
}
|
|
854
856
|
// 只检查状态码是否在配置的列表中
|
|
855
857
|
const shouldReport = httpErrorStatusCodes.includes(status);
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
}
|
|
858
|
+
// 临时强制输出调试日志
|
|
859
|
+
console.log(`[Monitor] HTTP status ${status} shouldReport: ${shouldReport}, configured codes:`, httpErrorStatusCodes);
|
|
859
860
|
return shouldReport;
|
|
860
861
|
}
|
|
861
862
|
/**
|
|
@@ -1121,13 +1122,16 @@ function interceptFetch() {
|
|
|
1121
1122
|
},
|
|
1122
1123
|
});
|
|
1123
1124
|
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1125
|
+
// 网络错误也遵守 httpErrorStatusCodes 配置
|
|
1126
|
+
if (shouldReportHttpError(0)) {
|
|
1127
|
+
reportHttpError({
|
|
1128
|
+
method,
|
|
1129
|
+
url,
|
|
1130
|
+
status: 0,
|
|
1131
|
+
duration,
|
|
1132
|
+
requestBody,
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1131
1135
|
throw error;
|
|
1132
1136
|
}
|
|
1133
1137
|
};
|
|
@@ -1938,8 +1942,6 @@ function createUseMonitorError(React) {
|
|
|
1938
1942
|
* 前端监控 SDK
|
|
1939
1943
|
* @description 错误监控、性能监控、行为监控
|
|
1940
1944
|
*/
|
|
1941
|
-
// SDK 版本
|
|
1942
|
-
const SDK_VERSION = '1.0.0';
|
|
1943
1945
|
/**
|
|
1944
1946
|
* 监控 SDK 主类
|
|
1945
1947
|
*/
|
|
@@ -2017,7 +2019,7 @@ class MonitorSDK {
|
|
|
2017
2019
|
// 初始化配置管理器
|
|
2018
2020
|
config.init({
|
|
2019
2021
|
...finalConfig,
|
|
2020
|
-
version: finalConfig.version ||
|
|
2022
|
+
version: finalConfig.version || version,
|
|
2021
2023
|
}, true);
|
|
2022
2024
|
this.ready = true;
|
|
2023
2025
|
this.loading = false;
|
|
@@ -2194,7 +2196,7 @@ class MonitorSDK {
|
|
|
2194
2196
|
* 获取 SDK 版本
|
|
2195
2197
|
*/
|
|
2196
2198
|
getVersion() {
|
|
2197
|
-
return
|
|
2199
|
+
return version;
|
|
2198
2200
|
}
|
|
2199
2201
|
}
|
|
2200
2202
|
// 导出单例
|