@cloudcare/browser-core 1.2.2 → 1.2.4
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/cjs/configuration/configuration.js +2 -1
- package/cjs/helper/boundedBuffer.js +8 -6
- package/esm/configuration/configuration.js +2 -1
- package/esm/helper/boundedBuffer.js +7 -6
- package/package.json +2 -2
- package/src/configuration/configuration.js +26 -6
- package/src/helper/boundedBuffer.js +8 -6
|
@@ -49,7 +49,8 @@ function validateAndBuildConfiguration(initConfiguration) {
|
|
|
49
49
|
* Logs intake limit
|
|
50
50
|
*/
|
|
51
51
|
batchMessagesLimit: 50,
|
|
52
|
-
messageBytesLimit: 256 * _tools.ONE_KIBI_BYTE
|
|
52
|
+
messageBytesLimit: 256 * _tools.ONE_KIBI_BYTE,
|
|
53
|
+
resourceUrlLimit: 5 * _tools.ONE_KIBI_BYTE
|
|
53
54
|
}, (0, _transportConfiguration.computeTransportConfiguration)(initConfiguration));
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -7,21 +7,23 @@ exports.BoundedBuffer = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _tools = require("./tools");
|
|
9
9
|
|
|
10
|
+
var BUFFER_LIMIT = 500;
|
|
11
|
+
|
|
10
12
|
var _BoundedBuffer = function _BoundedBuffer() {
|
|
11
13
|
this.buffer = [];
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
_BoundedBuffer.prototype = {
|
|
15
|
-
add: function add(
|
|
16
|
-
var length = this.buffer.push(
|
|
17
|
+
add: function add(callback) {
|
|
18
|
+
var length = this.buffer.push(callback);
|
|
17
19
|
|
|
18
|
-
if (length >
|
|
20
|
+
if (length > BUFFER_LIMIT) {
|
|
19
21
|
this.buffer.splice(0, 1);
|
|
20
22
|
}
|
|
21
23
|
},
|
|
22
|
-
drain: function drain(
|
|
23
|
-
(0, _tools.each)(this.buffer, function (
|
|
24
|
-
|
|
24
|
+
drain: function drain() {
|
|
25
|
+
(0, _tools.each)(this.buffer, function (callback) {
|
|
26
|
+
callback();
|
|
25
27
|
});
|
|
26
28
|
this.buffer.length = 0;
|
|
27
29
|
}
|
|
@@ -35,7 +35,8 @@ export function validateAndBuildConfiguration(initConfiguration) {
|
|
|
35
35
|
* Logs intake limit
|
|
36
36
|
*/
|
|
37
37
|
batchMessagesLimit: 50,
|
|
38
|
-
messageBytesLimit: 256 * ONE_KIBI_BYTE
|
|
38
|
+
messageBytesLimit: 256 * ONE_KIBI_BYTE,
|
|
39
|
+
resourceUrlLimit: 5 * ONE_KIBI_BYTE
|
|
39
40
|
}, computeTransportConfiguration(initConfiguration));
|
|
40
41
|
}
|
|
41
42
|
export function buildCookieOptions(initConfiguration) {
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { each } from './tools';
|
|
2
|
+
var BUFFER_LIMIT = 500;
|
|
2
3
|
|
|
3
4
|
var _BoundedBuffer = function _BoundedBuffer() {
|
|
4
5
|
this.buffer = [];
|
|
5
6
|
};
|
|
6
7
|
|
|
7
8
|
_BoundedBuffer.prototype = {
|
|
8
|
-
add: function add(
|
|
9
|
-
var length = this.buffer.push(
|
|
9
|
+
add: function add(callback) {
|
|
10
|
+
var length = this.buffer.push(callback);
|
|
10
11
|
|
|
11
|
-
if (length >
|
|
12
|
+
if (length > BUFFER_LIMIT) {
|
|
12
13
|
this.buffer.splice(0, 1);
|
|
13
14
|
}
|
|
14
15
|
},
|
|
15
|
-
drain: function drain(
|
|
16
|
-
each(this.buffer, function (
|
|
17
|
-
|
|
16
|
+
drain: function drain() {
|
|
17
|
+
each(this.buffer, function (callback) {
|
|
18
|
+
callback();
|
|
18
19
|
});
|
|
19
20
|
this.buffer.length = 0;
|
|
20
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcare/browser-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"author": "dataflux",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"description": "DataFlux RUM Web 端数据指标监控",
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "cbce52b999d27d4fe7b9ac34931f4d1445aecb4f"
|
|
24
24
|
}
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
import { getCurrentSite } from '../browser/cookie'
|
|
2
2
|
import { catchUserErrors } from '../helper/catchUserErrors'
|
|
3
3
|
import { display } from '../helper/display'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
assign,
|
|
6
|
+
isPercentage,
|
|
7
|
+
ONE_KIBI_BYTE,
|
|
8
|
+
ONE_SECOND,
|
|
9
|
+
isNullUndefinedDefaultValue
|
|
10
|
+
} from '../helper/tools'
|
|
5
11
|
import { computeTransportConfiguration } from './transportConfiguration'
|
|
6
|
-
export function validateAndBuildConfiguration(initConfiguration){
|
|
7
|
-
if (
|
|
12
|
+
export function validateAndBuildConfiguration(initConfiguration) {
|
|
13
|
+
if (
|
|
14
|
+
initConfiguration.sampleRate !== undefined &&
|
|
15
|
+
!isPercentage(initConfiguration.sampleRate)
|
|
16
|
+
) {
|
|
8
17
|
display.error('Sample Rate should be a number between 0 and 100')
|
|
9
18
|
return
|
|
10
19
|
}
|
|
11
20
|
return assign(
|
|
12
21
|
{
|
|
13
22
|
beforeSend:
|
|
14
|
-
initConfiguration.beforeSend &&
|
|
23
|
+
initConfiguration.beforeSend &&
|
|
24
|
+
catchUserErrors(
|
|
25
|
+
initConfiguration.beforeSend,
|
|
26
|
+
'beforeSend threw an error:'
|
|
27
|
+
),
|
|
15
28
|
cookieOptions: buildCookieOptions(initConfiguration),
|
|
16
|
-
sampleRate: isNullUndefinedDefaultValue(
|
|
29
|
+
sampleRate: isNullUndefinedDefaultValue(
|
|
30
|
+
initConfiguration.sampleRate,
|
|
31
|
+
100
|
|
32
|
+
),
|
|
17
33
|
service: initConfiguration.service,
|
|
18
34
|
version: initConfiguration.version,
|
|
19
35
|
env: initConfiguration.env,
|
|
@@ -38,6 +54,7 @@ export function validateAndBuildConfiguration(initConfiguration){
|
|
|
38
54
|
*/
|
|
39
55
|
batchMessagesLimit: 50,
|
|
40
56
|
messageBytesLimit: 256 * ONE_KIBI_BYTE,
|
|
57
|
+
resourceUrlLimit: 5 * ONE_KIBI_BYTE
|
|
41
58
|
},
|
|
42
59
|
computeTransportConfiguration(initConfiguration)
|
|
43
60
|
)
|
|
@@ -57,5 +74,8 @@ export function buildCookieOptions(initConfiguration) {
|
|
|
57
74
|
}
|
|
58
75
|
|
|
59
76
|
function mustUseSecureCookie(initConfiguration) {
|
|
60
|
-
return
|
|
77
|
+
return (
|
|
78
|
+
!!initConfiguration.useSecureSessionCookie ||
|
|
79
|
+
!!initConfiguration.useCrossSiteSessionCookie
|
|
80
|
+
)
|
|
61
81
|
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { each } from './tools'
|
|
2
|
+
var BUFFER_LIMIT = 500
|
|
3
|
+
|
|
2
4
|
var _BoundedBuffer = function () {
|
|
3
5
|
this.buffer = []
|
|
4
6
|
}
|
|
5
7
|
_BoundedBuffer.prototype = {
|
|
6
|
-
add: function (
|
|
7
|
-
var length = this.buffer.push(
|
|
8
|
-
if (length >
|
|
8
|
+
add: function (callback) {
|
|
9
|
+
var length = this.buffer.push(callback)
|
|
10
|
+
if (length > BUFFER_LIMIT) {
|
|
9
11
|
this.buffer.splice(0, 1)
|
|
10
12
|
}
|
|
11
13
|
},
|
|
12
14
|
|
|
13
|
-
drain: function (
|
|
14
|
-
each(this.buffer, function (
|
|
15
|
-
|
|
15
|
+
drain: function () {
|
|
16
|
+
each(this.buffer, function (callback) {
|
|
17
|
+
callback()
|
|
16
18
|
})
|
|
17
19
|
this.buffer.length = 0
|
|
18
20
|
}
|