@arms/rum-core 0.0.29 → 0.0.30

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.
@@ -129,11 +129,21 @@ var Reporter = exports["default"] = /*#__PURE__*/function () {
129
129
  var config = ctx.getConfig();
130
130
  var session = ctx.session;
131
131
  var sessionId = session.getSessionId();
132
- events.forEach(function (event) {
133
- if (event.session_id === sessionId) {
134
- delete event.session_id;
132
+ // events.forEach(event => {
133
+ // if (event.session_id === sessionId) {
134
+ // delete event.session_id;
135
+ // }
136
+ // });
137
+ for (var i = 0; i < events.length; i++) {
138
+ var e = events[i];
139
+ if (e.session_id === sessionId) {
140
+ delete e.session_id;
141
+ } else {
142
+ events.splice(i, 1);
143
+ i--;
135
144
  }
136
- });
145
+ }
146
+ if (events.length === 0) return;
137
147
  var bundle = {
138
148
  app: {
139
149
  id: config.pid,
@@ -25,7 +25,7 @@ export default abstract class Shell implements IShell {
25
25
  /**
26
26
  * 自定义异常上报
27
27
  */
28
- sendException(payload: RumExceptionEvent): void;
28
+ sendException(payload: RumExceptionEvent | Error): void;
29
29
  /**
30
30
  * 自定义资源上报
31
31
  */
@@ -57,8 +57,14 @@ var Shell = exports["default"] = /*#__PURE__*/function () {
57
57
  if (!payload.name || !payload.message) {
58
58
  return;
59
59
  }
60
+ var name = payload.name,
61
+ message = payload.message,
62
+ stack = payload.stack;
60
63
  var data = (0, _extends2["default"])({
61
- times: 1
64
+ times: 1,
65
+ name: name,
66
+ message: message,
67
+ stack: stack
62
68
  }, payload, {
63
69
  event_type: _rumEvent.RumEventType.EXCEPTION,
64
70
  type: 'custom',
@@ -83,13 +83,14 @@ export interface RumExceptionEvent extends RumBaseEvent {
83
83
  column?: number;
84
84
  }
85
85
  export interface RumLongTaskEvent extends RumBaseEvent {
86
- view_name: string;
87
86
  source?: string;
88
87
  type?: string;
89
88
  message?: string;
90
- count: number;
89
+ duration?: number;
90
+ fps?: number;
91
91
  stack?: string;
92
92
  caused_by?: string;
93
+ snapshots: string;
93
94
  }
94
95
  export interface RumActionEvent extends RumBaseEvent {
95
96
  type?: string;
@@ -6,7 +6,6 @@ exports.makeTracingHeaders = makeTracingHeaders;
6
6
  exports.parseTracingOptions = parseTracingOptions;
7
7
  var _match = require("./match");
8
8
  var _is = require("./is");
9
- var _jsBase = require("js-base64");
10
9
  function isTraceOption(option) {
11
10
  return option && (0, _match.isMatchOption)(option.match) && (0, _is.isArray)(option.propagatorTypes);
12
11
  }
@@ -35,14 +34,16 @@ function makeTracingHeaders(traceId, spanId, sampled, propagatorTypes, subOption
35
34
  tracingHeaders['X-B3-Sampled'] = sample;
36
35
  break;
37
36
  case 'sw8':
38
- // https://github.com/apache/skywalking-client-js
39
- var traceIdStr = String((0, _jsBase.encode)(traceId));
40
- var segmentId = String((0, _jsBase.encode)(spanId));
41
- var service = String((0, _jsBase.encode)(subOption.appId));
42
- var instance = String((0, _jsBase.encode)(subOption.appVersion));
43
- var endpoint = String((0, _jsBase.encode)(subOption.viewName));
44
- var peer = String((0, _jsBase.encode)(subOption.host));
45
- tracingHeaders['sw8'] = sample + "-" + traceIdStr + "-" + segmentId + "-" + 0 + "-" + service + "-" + instance + "-" + endpoint + "-" + peer;
37
+ if ((0, _is.isFunction)(btoa)) {
38
+ // https://github.com/apache/skywalking-client-js
39
+ var traceIdStr = btoa(traceId);
40
+ var segmentId = btoa(spanId);
41
+ var service = btoa(subOption.appId);
42
+ var instance = btoa(subOption.appVersion);
43
+ var endpoint = btoa(subOption.viewName);
44
+ var peer = btoa(subOption.host);
45
+ tracingHeaders['sw8'] = sample + "-" + traceIdStr + "-" + segmentId + "-" + 0 + "-" + service + "-" + instance + "-" + endpoint + "-" + peer;
46
+ }
46
47
  break;
47
48
  case 'tracecontext':
48
49
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arms/rum-core",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "description": "arms rum javascript sdk core",
5
5
  "author": "guangli.fj <guangli.fj@alibaba-inc.com>",
6
6
  "license": "ISC",
@@ -22,8 +22,7 @@
22
22
  "test": "node ./__tests__/@arms/core.test.js"
23
23
  },
24
24
  "dependencies": {
25
- "events": "^3.3.0",
26
- "js-base64": "^3.7.7"
25
+ "events": "^3.3.0"
27
26
  },
28
27
  "devDependencies": {
29
28
  "@babel/runtime": "^7.24.5",