o11y 248.10.0 → 248.11.0
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/modules/o11y/client/client.js +62 -6
- package/dist/modules/o11y/client/client.js.map +1 -1
- package/dist/modules/o11y/client/console-collector/ConsoleCollector.d.ts +8 -0
- package/dist/modules/o11y/client/shared/PayloadUtility.d.ts +1 -0
- package/dist/modules/o11y/client/shared/SchemaUtil.d.ts +2 -0
- package/dist/modules/o11y/client/version.d.ts +1 -1
- package/dist/modules/o11y/collectors/console-collector/ConsoleCollector.d.ts +8 -0
- package/dist/modules/o11y/collectors/shared/PayloadUtility.d.ts +1 -0
- package/dist/modules/o11y/collectors/shared/SchemaUtil.d.ts +2 -0
- package/dist/modules/o11y/collectors/version.d.ts +1 -1
- package/dist/modules/o11y/core_envelope/console-collector/ConsoleCollector.d.ts +8 -0
- package/dist/modules/o11y/core_envelope/core_envelope.js +1 -1
- package/dist/modules/o11y/core_envelope/core_envelope.js.map +1 -1
- package/dist/modules/o11y/core_envelope/shared/PayloadUtility.d.ts +1 -0
- package/dist/modules/o11y/core_envelope/shared/SchemaUtil.d.ts +2 -0
- package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
- package/dist/modules/o11y/shared/console-collector/ConsoleCollector.d.ts +8 -0
- package/dist/modules/o11y/shared/shared/PayloadUtility.d.ts +1 -0
- package/dist/modules/o11y/shared/shared/SchemaUtil.d.ts +2 -0
- package/dist/modules/o11y/shared/shared.js +23 -0
- package/dist/modules/o11y/shared/shared.js.map +1 -1
- package/dist/modules/o11y/shared/version.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/console-collector/ConsoleCollector.d.ts +8 -0
- package/dist/modules/o11y/simple_collector/shared/PayloadUtility.d.ts +1 -0
- package/dist/modules/o11y/simple_collector/shared/SchemaUtil.d.ts +2 -0
- package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/console-collector/ConsoleCollector.d.ts +8 -0
- package/dist/modules/o11y/web_vitals/shared/PayloadUtility.d.ts +1 -0
- package/dist/modules/o11y/web_vitals/shared/SchemaUtil.d.ts +2 -0
- package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { networkSchema, simpleSchema, errorSchema, activitySchema, instrumentedEventSchema, idleDetectorReportSchema } from 'o11y_schema/sf_instrumentation';
|
|
2
|
-
import { utility, PublicSafety, schemaUtil, maxStringLengthAppLimit,
|
|
1
|
+
import { networkSchema, simpleSchema, payloadDiagsSchema, errorSchema, activitySchema, instrumentedEventSchema, idleDetectorReportSchema } from 'o11y_schema/sf_instrumentation';
|
|
2
|
+
import { utility, PublicSafety, schemaUtil, maxStringLengthAppLimit, payloadUtility, metricsUtility } from 'o11y/shared';
|
|
3
3
|
|
|
4
4
|
class TaskerImpl {
|
|
5
5
|
get isBusy() {
|
|
@@ -1497,7 +1497,16 @@ class InstrumentationImpl {
|
|
|
1497
1497
|
});
|
|
1498
1498
|
}
|
|
1499
1499
|
_logInternal(loggerName, schema, data, timestamp, rootId) {
|
|
1500
|
-
|
|
1500
|
+
const sequence = this._nextGen.addLog(loggerName, schema, data, timestamp, rootId);
|
|
1501
|
+
if (!utility.isProduction) {
|
|
1502
|
+
const extraFields = payloadUtility.getExtraFields(schema, data);
|
|
1503
|
+
if (!utility.isProduction && extraFields.length > 0) {
|
|
1504
|
+
this.error('Extra fields', payloadDiagsSchema, {
|
|
1505
|
+
extras: extraFields
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
return sequence;
|
|
1501
1510
|
}
|
|
1502
1511
|
error(error, userSchemaOrText, userData, options) {
|
|
1503
1512
|
return this._safety.tryCatch(() => {
|
|
@@ -2401,6 +2410,7 @@ class Index {
|
|
|
2401
2410
|
}
|
|
2402
2411
|
const time = utility.time.bind(utility);
|
|
2403
2412
|
|
|
2413
|
+
const lightningLoggerSchemaId = 'sfcore.customCmp.CustomComponentLog';
|
|
2404
2414
|
const bgColorMap = {
|
|
2405
2415
|
Error: 'Crimson',
|
|
2406
2416
|
Activity: 'CadetBlue',
|
|
@@ -2417,29 +2427,75 @@ const defaultColor = 'black';
|
|
|
2417
2427
|
const defaultBgColor = 'Gainsboro';
|
|
2418
2428
|
class ConsoleCollector {
|
|
2419
2429
|
constructor(environment) {
|
|
2430
|
+
this._simpleFilters = new Set();
|
|
2431
|
+
this._regexFilters = [];
|
|
2420
2432
|
if (environment) {
|
|
2421
2433
|
this._log('ConsoleCollector', environment);
|
|
2422
2434
|
}
|
|
2423
2435
|
}
|
|
2424
2436
|
collect(schema, data, logMeta) {
|
|
2437
|
+
const id = schemaUtil.getSchemaId(schema);
|
|
2438
|
+
if (!this._shouldLog(id)) {
|
|
2439
|
+
return;
|
|
2440
|
+
}
|
|
2441
|
+
if (id === lightningLoggerSchemaId) {
|
|
2442
|
+
this._logCustom(data);
|
|
2443
|
+
return;
|
|
2444
|
+
}
|
|
2425
2445
|
let label, color, bgColor;
|
|
2426
|
-
if (schema
|
|
2446
|
+
if (schemaUtil.isInternal(schema)) {
|
|
2427
2447
|
label = schema.name;
|
|
2428
2448
|
color = colorMap[schema.name] || defaultColor;
|
|
2429
2449
|
bgColor = bgColorMap[schema.name] || defaultBgColor;
|
|
2430
2450
|
}
|
|
2431
2451
|
else {
|
|
2432
|
-
label =
|
|
2452
|
+
label = id;
|
|
2433
2453
|
}
|
|
2434
2454
|
this._log(label, data, logMeta, color, bgColor);
|
|
2435
2455
|
}
|
|
2456
|
+
_shouldLog(schemaId) {
|
|
2457
|
+
if (this._simpleFilters.size == 0 && this._regexFilters.length == 0) {
|
|
2458
|
+
return true;
|
|
2459
|
+
}
|
|
2460
|
+
return (this._simpleFilters.has(schemaId) || this._regexFilters.some((r) => r.test(schemaId)));
|
|
2461
|
+
}
|
|
2462
|
+
addFilter(filter) {
|
|
2463
|
+
if (filter instanceof RegExp) {
|
|
2464
|
+
this._regexFilters.push(filter);
|
|
2465
|
+
}
|
|
2466
|
+
else {
|
|
2467
|
+
this._simpleFilters.add(filter);
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
removeFilter(filter) {
|
|
2471
|
+
if (filter instanceof RegExp) {
|
|
2472
|
+
const index = this._regexFilters.findIndex((r) => r.source === filter.source);
|
|
2473
|
+
if (index >= 0) {
|
|
2474
|
+
this._regexFilters.splice(index, 1);
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
else {
|
|
2478
|
+
this._simpleFilters.delete(filter);
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
clearFilters() {
|
|
2482
|
+
this._simpleFilters.clear();
|
|
2483
|
+
this._regexFilters.splice(0, this._regexFilters.length);
|
|
2484
|
+
}
|
|
2485
|
+
getFilters() {
|
|
2486
|
+
const filters = Array.from(this._simpleFilters);
|
|
2487
|
+
return filters.concat(this._regexFilters).sort();
|
|
2488
|
+
}
|
|
2436
2489
|
_log(label, first, second, color = defaultColor, bgColor = defaultBgColor) {
|
|
2437
2490
|
const css = `color:${color};background-color:${bgColor}`;
|
|
2438
2491
|
console.log(`%cO11Y%c ${label}`, 'color:white;background-color:#FF6600;font-weight:bold', css, first || '', second || '');
|
|
2439
2492
|
}
|
|
2493
|
+
_logCustom(data) {
|
|
2494
|
+
console.log('%clightning/logger', 'color:white;background-color:#00a1e0;font-weight:bold', data || '');
|
|
2495
|
+
}
|
|
2440
2496
|
}
|
|
2441
2497
|
|
|
2442
|
-
const version = '248.
|
|
2498
|
+
const version = '248.11.0';
|
|
2443
2499
|
|
|
2444
2500
|
const idleDetector = new IdleDetectorImpl({
|
|
2445
2501
|
logThreshold: 300,
|