@arms/rum-core
Advanced tools
Comparing version 0.0.25-beta.8 to 0.0.25-beta.9
import { IClient, IConfiguration } from "../types/client"; | ||
import { RumEvent, RumExceptionEvent } from "../types/rum-event"; | ||
import { RumCustomEvent, RumEvent, RumExceptionEvent, RumResourceEvent } from "../types/rum-event"; | ||
import { IShell } from "../types/shell"; | ||
@@ -24,3 +24,3 @@ export default abstract class Shell implements IShell { | ||
*/ | ||
sendCustom(payload: RumEvent): void; | ||
sendCustom(payload: RumCustomEvent): void; | ||
/** | ||
@@ -30,2 +30,6 @@ * 自定义异常上报 | ||
sendException(payload: RumExceptionEvent): void; | ||
/** | ||
* 自定义资源上报 | ||
*/ | ||
sendResource(payload: RumResourceEvent): void; | ||
} |
@@ -8,7 +8,8 @@ "use strict"; | ||
var _rumEvent = require("../types/rum-event"); | ||
var _rumCore = require("@arms/rum-core"); | ||
var _client = _interopRequireDefault(require("../model/client")); | ||
var _is = require("../utils/is"); | ||
var Shell = exports["default"] = /*#__PURE__*/function () { | ||
function Shell(config) { | ||
this.client = void 0; | ||
this.client = new _rumCore.Client(); | ||
this.client = new _client["default"](); | ||
if (config && this.init) { | ||
@@ -69,3 +70,17 @@ this.init(config); | ||
}; | ||
/** | ||
* 自定义资源上报 | ||
*/ | ||
_proto.sendResource = function sendResource(payload) { | ||
if (!payload.name || !payload.type || !(0, _is.isNumber)(payload.duration)) { | ||
return; | ||
} | ||
var data = (0, _extends2["default"])({ | ||
times: 1 | ||
}, payload, { | ||
event_type: _rumEvent.RumEventType.RESOURCE | ||
}); | ||
this.sendEvent(data); | ||
}; | ||
return Shell; | ||
}(); |
@@ -101,7 +101,14 @@ import { ICollector } from './collector'; | ||
*/ | ||
collectors?: any; | ||
collectors?: { | ||
[key: string]: unknown; | ||
}; | ||
/** | ||
* 事件过滤器配置 | ||
*/ | ||
filters?: { | ||
[key: string]: MatchOption | MatchOption[]; | ||
view?: MatchOption | MatchOption[]; | ||
resource?: MatchOption | MatchOption[]; | ||
exception?: MatchOption | MatchOption[]; | ||
}; | ||
[key: string]: any; | ||
} |
@@ -24,2 +24,3 @@ export declare enum RumEventType { | ||
view?: IViewData; | ||
snapshots?: string; | ||
[key: string]: BaseObjectValue; | ||
@@ -47,10 +48,9 @@ } | ||
name?: string; | ||
type: string; | ||
type?: string; | ||
method?: string; | ||
status_code?: number; | ||
status_code?: number | string; | ||
message?: string; | ||
success: 0 | 1; | ||
provider_type?: string; | ||
success?: -1 | 0 | 1; | ||
trace_id?: string; | ||
duration: number; | ||
duration?: number; | ||
size?: number; | ||
@@ -63,8 +63,9 @@ connect_duration?: number; | ||
download_duration?: number; | ||
url: string; | ||
url?: string; | ||
timing_data?: string; | ||
tracing_data?: string; | ||
} | ||
export interface RumExceptionEvent extends RumBaseEvent { | ||
source?: string; | ||
type?: 'crash' | 'cutsom' | 'error' | 'blank'; | ||
type?: 'crash' | 'custom' | 'error' | 'blank'; | ||
name?: string; | ||
@@ -91,3 +92,2 @@ message?: string; | ||
duration?: number; | ||
snapshots?: string; | ||
} | ||
@@ -94,0 +94,0 @@ export interface RumCustomEvent extends RumBaseEvent { |
{ | ||
"name": "@arms/rum-core", | ||
"version": "0.0.25-beta.8", | ||
"version": "0.0.25-beta.9", | ||
"description": "arms rum javascript sdk core", | ||
@@ -5,0 +5,0 @@ "author": "guangli.fj <guangli.fj@alibaba-inc.com>", |
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
45056
1371