@beisen/analysis-pms
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -83,8 +83,10 @@ /******/ (function(modules) { // webpackBootstrap | ||
var _utils = __webpack_require__(4); | ||
var _oldUrl = __webpack_require__(4); | ||
var _oldUrl2 = _interopRequireDefault(_oldUrl); | ||
var _utils = __webpack_require__(5); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// var col = []; //发送的集合 | ||
function perfAnalysis() { | ||
@@ -183,24 +185,21 @@ this._sequence = []; | ||
var logData = Object.assign({}, (0, _utils.getCurrentUserinfo)(), { | ||
cid: 12, | ||
pages: pages ? pages : this._getCurrentPage(), | ||
terminal: (0, _utils.getTerminalType)(), | ||
ts: new Date().getTime(), | ||
col: [{ | ||
cid: 2, | ||
traceId: traceId, | ||
pageCode: pageCode, | ||
label: encodeURIComponent((0, _utils.handleEncode)('[ajax][' + method + ']' + urlAjax)), | ||
time: end - start, | ||
modelInfo: JSON.stringify(dataKey), | ||
actionName: encodeURIComponent((0, _utils.handleEncode)(sourceActionName)), | ||
actionCode: sourceActionCode | ||
}] | ||
cid: 2, | ||
traceId: traceId, | ||
pageCode: pageCode, | ||
label: encodeURIComponent((0, _utils.handleEncode)('[ajax][' + method + ']' + urlAjax)), | ||
time: end - start, | ||
modelInfo: JSON.stringify(dataKey), | ||
actionName: encodeURIComponent((0, _utils.handleEncode)(sourceActionName)), | ||
actionCode: sourceActionCode | ||
}); | ||
this._sendDataToOps({ perfCol: JSON.stringify(logData) }); | ||
this._sendActionToOps(logData); | ||
} | ||
}; | ||
//将splash/ajax/all数据发至运维接口 | ||
perfAnalysis.prototype._sendDataToOps = function (params) { | ||
//将操作日志发送到旧接口,后期会废弃 | ||
perfAnalysis.prototype._sendActionToOps = function (params) { | ||
//启用性能打点开关 | ||
@@ -217,2 +216,21 @@ var _ref = window.BSGlobal || {}, | ||
restParams = restParams.substring(0, restParams.length - 1); //去掉结尾多余的& | ||
var url = _oldUrl2.default[env.toLocaleLowerCase()] + '?' + restParams; | ||
var img = new Image(); | ||
img.src = url; | ||
} | ||
}; | ||
//将splash/ajax/all数据发至运维接口 | ||
perfAnalysis.prototype._sendDataToOps = function (params) { | ||
//启用性能打点开关 | ||
var _ref2 = window.BSGlobal || {}, | ||
IsUseUxPMS = _ref2.IsUseUxPMS, | ||
env = _ref2.env; | ||
// if (!IsUseUxPMS) { | ||
// return; | ||
// } | ||
if (env) { | ||
var restParams = (0, _utils.objToLink)(params); | ||
restParams = restParams.substring(0, restParams.length - 1); //去掉结尾多余的& | ||
var url = _opsUrl2.default[env.toLocaleLowerCase()] + '?' + restParams; | ||
@@ -269,5 +287,5 @@ var img = new Image(); | ||
ts: new Date().getTime(), | ||
col: colArr | ||
col: JSON.stringify(colArr) | ||
}); | ||
this._sendDataToOps({ perfCol: JSON.stringify(logData) }); | ||
this._sendDataToOps({ parameters: JSON.stringify(logData) }); | ||
this._ajaxCol = []; | ||
@@ -290,2 +308,22 @@ }; | ||
var url = { | ||
development: "//dev.opsapi.beisencorp.com/opsapi/AddStaticPerformanceLog", | ||
testing: "//opsapi.italent.link/opsapi/AddStaticPerformanceLog", | ||
production: "//opsapi.beisen.com/opsapi/AddStaticPerformanceLog", | ||
labs: "//labs.opsapi.beisencorp.com/opsapi/AddStaticPerformanceLog", | ||
sandbox: "//opsapi.upaas.in/opsapi/AddStaticPerformanceLog" | ||
}; | ||
exports.default = url; | ||
/***/ }, | ||
/* 4 */ | ||
/***/ function(module, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var url = { | ||
development: "//dev.opsapi.beisencorp.com/opsapi/AddPerformnanceLog", | ||
@@ -301,3 +339,3 @@ testing: "//opsapi.italent.link/opsapi/AddPerformnanceLog", | ||
/***/ }, | ||
/* 4 */ | ||
/* 5 */ | ||
/***/ function(module, exports) { | ||
@@ -335,3 +373,3 @@ | ||
appCode: application, | ||
sessionId: start.getTime ? '' + loginUserInfo.Id + BSGlobal.start.getTime() : 0, | ||
sid: start.getTime ? '' + loginUserInfo.Id + BSGlobal.start.getTime() : 0, | ||
appName: location.host, | ||
@@ -379,15 +417,15 @@ version: appVersion, | ||
var params = { | ||
redirect: Math.ceil(redirectEnd - redirectStart), | ||
dns: Math.ceil(t.domainLookupEnd - t.domainLookupStart), | ||
con: Math.ceil(connectEnd - connectStart), | ||
req: Math.ceil(responseStart - requestStart), | ||
res: Math.ceil(responseEnd - responseStart), | ||
total: Math.ceil(duration) | ||
redirect: parseInt(redirectEnd - redirectStart), | ||
dns: parseInt(domainLookupEnd - domainLookupStart), | ||
con: parseInt(connectEnd - connectStart), | ||
req: parseInt(responseStart - requestStart), | ||
res: parseInt(responseEnd - responseStart), | ||
total: parseInt(duration) | ||
}; | ||
if (sign) { | ||
return Object.assign({}, { | ||
domReady: domContentLoadedEventStart - t.responseEnd, | ||
pageLoad: t.loadEventStart - t.responseEnd, | ||
pageTotal: t.loadEventEnd - t.navigationStart | ||
}, params); | ||
return Object.assign({}, params, { | ||
dready: parseInt(domContentLoadedEventStart - responseEnd), | ||
load: parseInt(loadEventStart - responseEnd), | ||
total: parseInt(loadEventEnd - navigationStart) | ||
}); | ||
} | ||
@@ -404,8 +442,8 @@ return params; | ||
dns = newPerf.dns, | ||
connect = newPerf.connect, | ||
request = newPerf.request, | ||
response = newPerf.response, | ||
domReady = newPerf.domReady, | ||
pageLoaded = newPerf.pageLoaded, | ||
pageTotal = newPerf.pageTotal; | ||
con = newPerf.con, | ||
req = newPerf.req, | ||
res = newPerf.res, | ||
dready = newPerf.dready, | ||
load = newPerf.load, | ||
total = newPerf.total; | ||
@@ -416,8 +454,8 @@ return { | ||
dns: dns, | ||
con: connect, | ||
req: request, | ||
res: response, | ||
dready: domReady, | ||
load: pageLoaded, | ||
total: pageTotal | ||
con: con, | ||
req: req, | ||
res: res, | ||
dready: dready, | ||
load: load, | ||
total: total | ||
}; | ||
@@ -449,6 +487,8 @@ } | ||
var label = name.split('/')[name.split('/').length - 1]; | ||
var perfData = getCommonPerf(entries[i]); | ||
perfArr.push(Object.assign({}, { | ||
cid: typeMapping[entries[i].initiatorType], | ||
label: encodeURIComponent(handleEncode(domName + '/' + label)) | ||
}, getCommonPerf(entries[i]))); | ||
label: encodeURIComponent(handleEncode(domName + '/' + label)), | ||
time: perfData.total | ||
}, perfData)); | ||
count = count + 1; | ||
@@ -455,0 +495,0 @@ } |
@@ -60,7 +60,7 @@ 'use strict'; | ||
terminal: (0, _utils.getTerminalType)(), | ||
col: colArr, | ||
col: JSON.stringify(colArr), | ||
ts: new Date().getTime() | ||
}); | ||
if (env) { | ||
var restLink = (0, _utils.objToLink)({ perfCol: JSON.stringify(logData) }); | ||
var restLink = (0, _utils.objToLink)({ parameters: JSON.stringify(logData) }); | ||
var url = _opsUrl2.default[env.toLocaleLowerCase()] + '?' + restLink; | ||
@@ -67,0 +67,0 @@ var img = new Image(); |
{ | ||
"name": "@beisen\/analysis-pms", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib\/component\/index.js", |
@@ -49,2 +49,3 @@ # iTalentPMS | ||
### 0.4.2 简写发送首屏字段&集合使用新的接口 | ||
### 0.4.1 将首屏和ajax以及资源合并为一个集合发送 | ||
@@ -51,0 +52,0 @@ * css和js资源只处理stnew03.beisen.com和xfile4.tita.com中的 |
const url = { | ||
development: "//dev.opsapi.beisencorp.com/opsapi/AddPerformnanceLog", | ||
testing: "//opsapi.italent.link/opsapi/AddPerformnanceLog", | ||
production: "//opsapi.beisen.com/opsapi/AddPerformnanceLog", | ||
labs: "//labs.opsapi.beisencorp.com/opsapi/AddPerformnanceLog", | ||
sandbox: "//opsapi.upaas.in/opsapi/AddPerformnanceLog" | ||
development: "//dev.opsapi.beisencorp.com/opsapi/AddStaticPerformanceLog", | ||
testing: "//opsapi.italent.link/opsapi/AddStaticPerformanceLog", | ||
production: "//opsapi.beisen.com/opsapi/AddStaticPerformanceLog", | ||
labs: "//labs.opsapi.beisencorp.com/opsapi/AddStaticPerformanceLog", | ||
sandbox: "//opsapi.upaas.in/opsapi/AddStaticPerformanceLog" | ||
} | ||
@@ -9,0 +9,0 @@ |
@@ -9,3 +9,3 @@ // 获取BSGlobal中参数,如用户id、租户id等 | ||
appCode: application, | ||
sessionId: start.getTime ? `${loginUserInfo.Id}${BSGlobal.start.getTime()}` : 0, | ||
sid: start.getTime ? `${loginUserInfo.Id}${BSGlobal.start.getTime()}` : 0, | ||
appName: location.host, | ||
@@ -40,15 +40,15 @@ version: appVersion, | ||
const params = { | ||
redirect: Math.ceil(redirectEnd - redirectStart), | ||
dns: Math.ceil(t.domainLookupEnd - t.domainLookupStart), | ||
con: Math.ceil(connectEnd - connectStart), | ||
req: Math.ceil(responseStart - requestStart), | ||
res: Math.ceil(responseEnd - responseStart), | ||
total: Math.ceil(duration) | ||
redirect: parseInt(redirectEnd - redirectStart), | ||
dns: parseInt(domainLookupEnd - domainLookupStart), | ||
con: parseInt(connectEnd - connectStart), | ||
req: parseInt(responseStart - requestStart), | ||
res: parseInt(responseEnd - responseStart), | ||
total: parseInt(duration) | ||
} | ||
if (sign) { | ||
return Object.assign({}, { | ||
domReady: domContentLoadedEventStart - t.responseEnd, | ||
pageLoad: t.loadEventStart - t.responseEnd, | ||
pageTotal: t.loadEventEnd - t.navigationStart | ||
}, params) | ||
return Object.assign({}, params, { | ||
dready: parseInt(domContentLoadedEventStart - responseEnd), | ||
load: parseInt(loadEventStart - responseEnd), | ||
total: parseInt(loadEventEnd - navigationStart) | ||
}) | ||
@@ -64,3 +64,3 @@ } | ||
let newPerf = getCommonPerf(t, true); | ||
const {redirect, dns, connect, request, response, domReady, pageLoaded, pageTotal } = newPerf | ||
const {redirect, dns, con, req, res, dready, load, total } = newPerf | ||
return { | ||
@@ -70,8 +70,8 @@ ns, | ||
dns, | ||
con: connect, | ||
req: request, | ||
res: response, | ||
dready: domReady, | ||
load: pageLoaded, | ||
total: pageTotal | ||
con, | ||
req, | ||
res, | ||
dready, | ||
load, | ||
total | ||
} | ||
@@ -99,6 +99,8 @@ } | ||
const label = name.split('/')[name.split('/').length - 1] | ||
const perfData = getCommonPerf(entries[i]) | ||
perfArr.push(Object.assign({}, { | ||
cid: typeMapping[entries[i].initiatorType], | ||
label: encodeURIComponent(handleEncode(`${domName}/${label}`)) | ||
}, getCommonPerf(entries[i]))); | ||
label: encodeURIComponent(handleEncode(`${domName}/${label}`)), | ||
time: perfData.total | ||
}, perfData)); | ||
count = count + 1; | ||
@@ -105,0 +107,0 @@ } |
@@ -49,7 +49,7 @@ import opsUrl from '../../src/common/opsUrl' | ||
terminal: getTerminalType(), | ||
col: colArr, | ||
col: JSON.stringify(colArr), | ||
ts: new Date().getTime() | ||
}) | ||
if (env) { | ||
let restLink = objToLink({perfCol: JSON.stringify(logData)}); | ||
let restLink = objToLink({parameters: JSON.stringify(logData)}); | ||
const url = `${opsUrl[env.toLocaleLowerCase()]}?${restLink}`; | ||
@@ -56,0 +56,0 @@ let img = new Image(); |
import opsUrl from './common/opsUrl' | ||
import oldUrl from './common/oldUrl' | ||
import { | ||
@@ -12,4 +13,2 @@ handleEncode, | ||
// var col = []; //发送的集合 | ||
function perfAnalysis() { | ||
@@ -98,22 +97,36 @@ this._sequence = []; | ||
const logData = Object.assign({}, getCurrentUserinfo(), { | ||
cid: 12, | ||
pages: pages ? pages : this._getCurrentPage(), | ||
terminal: getTerminalType(), | ||
ts: new Date().getTime(), | ||
col: [{ | ||
cid: 2, | ||
traceId, | ||
pageCode, | ||
label: encodeURIComponent(handleEncode(`[ajax][${method}]${urlAjax}`)), | ||
time: end - start, | ||
modelInfo: JSON.stringify(dataKey), | ||
actionName: encodeURIComponent(handleEncode(sourceActionName)), | ||
actionCode: sourceActionCode | ||
}] | ||
cid: 2, | ||
traceId, | ||
pageCode, | ||
label: encodeURIComponent(handleEncode(`[ajax][${method}]${urlAjax}`)), | ||
time: end - start, | ||
modelInfo: JSON.stringify(dataKey), | ||
actionName: encodeURIComponent(handleEncode(sourceActionName)), | ||
actionCode: sourceActionCode | ||
}) | ||
this._sendDataToOps({perfCol: JSON.stringify(logData)}); | ||
this._sendActionToOps(logData); | ||
} | ||
}; | ||
//将操作日志发送到旧接口,后期会废弃 | ||
perfAnalysis.prototype._sendActionToOps = function(params) { | ||
//启用性能打点开关 | ||
const { IsUseUxPMS, env } = window.BSGlobal || {} | ||
// if (!IsUseUxPMS) { | ||
// return; | ||
// } | ||
if (env) { | ||
let restParams = objToLink(params); | ||
restParams = restParams.substring(0, restParams.length -1) //去掉结尾多余的& | ||
const url = `${oldUrl[env.toLocaleLowerCase()]}?${restParams}`; | ||
let img = new Image(); | ||
img.src = url; | ||
} | ||
}; | ||
//将splash/ajax/all数据发至运维接口 | ||
@@ -182,5 +195,5 @@ perfAnalysis.prototype._sendDataToOps = function(params) { | ||
ts: new Date().getTime(), | ||
col: colArr | ||
col: JSON.stringify(colArr) | ||
}) | ||
this._sendDataToOps({perfCol: JSON.stringify(logData)}); | ||
this._sendDataToOps({parameters: JSON.stringify(logData)}); | ||
this._ajaxCol = []; | ||
@@ -187,0 +200,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
244306
20
6505
174