@fluidframework/telemetry-utils 2.0.0-internal.6.1.2 → 2.0.0-internal.6.2.1
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/.eslintrc.js +2 -1
- package/CHANGELOG.md +31 -0
- package/README.md +4 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -4
- package/dist/config.js.map +1 -1
- package/dist/error.d.ts +92 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +133 -0
- package/dist/error.js.map +1 -0
- package/dist/errorLogging.d.ts +27 -11
- package/dist/errorLogging.d.ts.map +1 -1
- package/dist/errorLogging.js +42 -17
- package/dist/errorLogging.js.map +1 -1
- package/dist/eventEmitterWithErrorHandling.d.ts +2 -2
- package/dist/eventEmitterWithErrorHandling.d.ts.map +1 -1
- package/dist/eventEmitterWithErrorHandling.js +4 -1
- package/dist/eventEmitterWithErrorHandling.js.map +1 -1
- package/dist/events.d.ts +1 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js.map +1 -1
- package/dist/fluidErrorBase.d.ts +48 -15
- package/dist/fluidErrorBase.d.ts.map +1 -1
- package/dist/fluidErrorBase.js +18 -11
- package/dist/fluidErrorBase.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +28 -16
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +41 -14
- package/dist/logger.js.map +1 -1
- package/dist/mockLogger.d.ts +14 -5
- package/dist/mockLogger.d.ts.map +1 -1
- package/dist/mockLogger.js +19 -7
- package/dist/mockLogger.js.map +1 -1
- package/dist/sampledTelemetryHelper.d.ts +8 -7
- package/dist/sampledTelemetryHelper.d.ts.map +1 -1
- package/dist/sampledTelemetryHelper.js +10 -8
- package/dist/sampledTelemetryHelper.js.map +1 -1
- package/dist/telemetryTypes.d.ts +8 -4
- package/dist/telemetryTypes.d.ts.map +1 -1
- package/dist/telemetryTypes.js.map +1 -1
- package/dist/thresholdCounter.d.ts.map +1 -1
- package/dist/thresholdCounter.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +9 -4
- package/lib/config.js.map +1 -1
- package/lib/error.d.ts +92 -0
- package/lib/error.d.ts.map +1 -0
- package/lib/error.js +125 -0
- package/lib/error.js.map +1 -0
- package/lib/errorLogging.d.ts +27 -11
- package/lib/errorLogging.d.ts.map +1 -1
- package/lib/errorLogging.js +42 -17
- package/lib/errorLogging.js.map +1 -1
- package/lib/eventEmitterWithErrorHandling.d.ts +2 -2
- package/lib/eventEmitterWithErrorHandling.d.ts.map +1 -1
- package/lib/eventEmitterWithErrorHandling.js +4 -1
- package/lib/eventEmitterWithErrorHandling.js.map +1 -1
- package/lib/events.d.ts +1 -1
- package/lib/events.d.ts.map +1 -1
- package/lib/events.js.map +1 -1
- package/lib/fluidErrorBase.d.ts +48 -15
- package/lib/fluidErrorBase.d.ts.map +1 -1
- package/lib/fluidErrorBase.js +18 -11
- package/lib/fluidErrorBase.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +28 -16
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +41 -14
- package/lib/logger.js.map +1 -1
- package/lib/mockLogger.d.ts +14 -5
- package/lib/mockLogger.d.ts.map +1 -1
- package/lib/mockLogger.js +19 -7
- package/lib/mockLogger.js.map +1 -1
- package/lib/sampledTelemetryHelper.d.ts +8 -7
- package/lib/sampledTelemetryHelper.d.ts.map +1 -1
- package/lib/sampledTelemetryHelper.js +10 -8
- package/lib/sampledTelemetryHelper.js.map +1 -1
- package/lib/telemetryTypes.d.ts +8 -4
- package/lib/telemetryTypes.d.ts.map +1 -1
- package/lib/telemetryTypes.js.map +1 -1
- package/lib/thresholdCounter.d.ts.map +1 -1
- package/lib/thresholdCounter.js.map +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +11 -11
- package/src/config.ts +12 -7
- package/src/error.ts +202 -0
- package/src/errorLogging.ts +78 -38
- package/src/eventEmitterWithErrorHandling.ts +4 -2
- package/src/events.ts +3 -3
- package/src/fluidErrorBase.ts +62 -26
- package/src/index.ts +7 -0
- package/src/logger.ts +109 -35
- package/src/mockLogger.ts +25 -14
- package/src/sampledTelemetryHelper.ts +17 -13
- package/src/telemetryTypes.ts +20 -4
- package/src/thresholdCounter.ts +2 -2
- package/src/utils.ts +1 -1
package/lib/fluidErrorBase.d.ts
CHANGED
|
@@ -4,39 +4,72 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ITelemetryProperties } from "@fluidframework/core-interfaces";
|
|
6
6
|
/**
|
|
7
|
+
* An error emitted by the Fluid Framework.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
*
|
|
7
11
|
* All normalized errors flowing through the Fluid Framework adhere to this readonly interface.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
12
|
+
*
|
|
13
|
+
* It features the members of {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error | Error}
|
|
14
|
+
* made readonly, as well as {@link IFluidErrorBase.errorType} and {@link IFluidErrorBase.errorInstanceId}.
|
|
15
|
+
* It also features getters and setters for telemetry props to be included when the error is logged.
|
|
10
16
|
*/
|
|
11
17
|
export interface IFluidErrorBase extends Error {
|
|
12
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Classification of what type of error this is.
|
|
20
|
+
*
|
|
21
|
+
* @remarks Used programmatically by consumers to interpret the error.
|
|
22
|
+
*/
|
|
13
23
|
readonly errorType: string;
|
|
14
24
|
/**
|
|
15
25
|
* Error's message property, made readonly.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
*
|
|
29
|
+
* Recommendations:
|
|
30
|
+
*
|
|
31
|
+
* Be specific, but also take care when including variable data to consider suitability for aggregation in telemetry.
|
|
32
|
+
* Also avoid including any data that jeopardizes the user's privacy. Add a tagged telemetry property instead.
|
|
18
33
|
*/
|
|
19
34
|
readonly message: string;
|
|
20
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack}.
|
|
37
|
+
*/
|
|
21
38
|
readonly stack?: string;
|
|
22
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name}.
|
|
41
|
+
*/
|
|
23
42
|
readonly name: string;
|
|
24
43
|
/**
|
|
25
44
|
* A Guid identifying this error instance.
|
|
26
|
-
*
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
*
|
|
48
|
+
* Useful in telemetry for deduplicating multiple logging events arising from the same error,
|
|
27
49
|
* or correlating an error with an inner error that caused it, in case of error wrapping.
|
|
28
50
|
*/
|
|
29
51
|
readonly errorInstanceId: string;
|
|
30
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Get the telemetry properties stashed on this error for logging.
|
|
54
|
+
*/
|
|
31
55
|
getTelemetryProperties(): ITelemetryProperties;
|
|
32
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Add telemetry properties to this error which will be logged with the error
|
|
58
|
+
*/
|
|
33
59
|
addTelemetryProperties: (props: ITelemetryProperties) => void;
|
|
34
60
|
}
|
|
35
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Type guard for error data containing the {@link IFluidErrorBase.errorInstanceId} property.
|
|
63
|
+
*/
|
|
64
|
+
export declare const hasErrorInstanceId: (x: unknown) => x is {
|
|
36
65
|
errorInstanceId: string;
|
|
37
66
|
};
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export declare function
|
|
67
|
+
/**
|
|
68
|
+
* Type guard for {@link IFluidErrorBase}.
|
|
69
|
+
*/
|
|
70
|
+
export declare function isFluidError(error: unknown): error is IFluidErrorBase;
|
|
71
|
+
/**
|
|
72
|
+
* Type guard for old standard of valid/known errors.
|
|
73
|
+
*/
|
|
74
|
+
export declare function isValidLegacyError(error: unknown): error is Omit<IFluidErrorBase, "errorInstanceId">;
|
|
42
75
|
//# sourceMappingURL=fluidErrorBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidErrorBase.d.ts","sourceRoot":"","sources":["../src/fluidErrorBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE
|
|
1
|
+
{"version":3,"file":"fluidErrorBase.d.ts","sourceRoot":"","sources":["../src/fluidErrorBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAgB,SAAQ,KAAK;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;;;;OAOG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACH,sBAAsB,IAAI,oBAAoB,CAAC;IAE/C;;OAEG;IACH,sBAAsB,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC9D;AAMD;;GAEG;AACH,eAAO,MAAM,kBAAkB,MAAO,OAAO;qBAA2B,MAAM;CACG,CAAC;AAElF;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAOrE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,OAAO,GACZ,KAAK,IAAI,IAAI,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAMnD"}
|
package/lib/fluidErrorBase.js
CHANGED
|
@@ -4,18 +4,25 @@
|
|
|
4
4
|
*/
|
|
5
5
|
const hasTelemetryPropFunctions = (x) => typeof x?.getTelemetryProperties === "function" &&
|
|
6
6
|
typeof x?.addTelemetryProperties === "function";
|
|
7
|
+
/**
|
|
8
|
+
* Type guard for error data containing the {@link IFluidErrorBase.errorInstanceId} property.
|
|
9
|
+
*/
|
|
7
10
|
export const hasErrorInstanceId = (x) => typeof x?.errorInstanceId === "string";
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Type guard for {@link IFluidErrorBase}.
|
|
13
|
+
*/
|
|
14
|
+
export function isFluidError(error) {
|
|
15
|
+
return (typeof error?.errorType === "string" &&
|
|
16
|
+
typeof error?.message === "string" &&
|
|
17
|
+
hasErrorInstanceId(error) &&
|
|
18
|
+
hasTelemetryPropFunctions(error));
|
|
14
19
|
}
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Type guard for old standard of valid/known errors.
|
|
22
|
+
*/
|
|
23
|
+
export function isValidLegacyError(error) {
|
|
24
|
+
return (typeof error?.errorType === "string" &&
|
|
25
|
+
typeof error?.message === "string" &&
|
|
26
|
+
hasTelemetryPropFunctions(error));
|
|
20
27
|
}
|
|
21
28
|
//# sourceMappingURL=fluidErrorBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidErrorBase.js","sourceRoot":"","sources":["../src/fluidErrorBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"fluidErrorBase.js","sourceRoot":"","sources":["../src/fluidErrorBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkEH,MAAM,yBAAyB,GAAG,CAAC,CAAU,EAAW,EAAE,CACzD,OAAQ,CAA8B,EAAE,sBAAsB,KAAK,UAAU;IAC7E,OAAQ,CAA8B,EAAE,sBAAsB,KAAK,UAAU,CAAC;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAU,EAAoC,EAAE,CAClF,OAAQ,CAA0C,EAAE,eAAe,KAAK,QAAQ,CAAC;AAElF;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IAC1C,OAAO,CACN,OAAQ,KAAkC,EAAE,SAAS,KAAK,QAAQ;QAClE,OAAQ,KAAkC,EAAE,OAAO,KAAK,QAAQ;QAChE,kBAAkB,CAAC,KAAK,CAAC;QACzB,yBAAyB,CAAC,KAAK,CAAC,CAChC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CACjC,KAAc;IAEd,OAAO,CACN,OAAQ,KAAkC,EAAE,SAAS,KAAK,QAAQ;QAClE,OAAQ,KAAkC,EAAE,OAAO,KAAK,QAAQ;QAChE,yBAAyB,CAAC,KAAK,CAAC,CAChC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryProperties } from \"@fluidframework/core-interfaces\";\n\n/**\n * An error emitted by the Fluid Framework.\n *\n * @remarks\n *\n * All normalized errors flowing through the Fluid Framework adhere to this readonly interface.\n *\n * It features the members of {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error | Error}\n * made readonly, as well as {@link IFluidErrorBase.errorType} and {@link IFluidErrorBase.errorInstanceId}.\n * It also features getters and setters for telemetry props to be included when the error is logged.\n */\nexport interface IFluidErrorBase extends Error {\n\t/**\n\t * Classification of what type of error this is.\n\t *\n\t * @remarks Used programmatically by consumers to interpret the error.\n\t */\n\treadonly errorType: string;\n\n\t/**\n\t * Error's message property, made readonly.\n\t *\n\t * @remarks\n\t *\n\t * Recommendations:\n\t *\n\t * Be specific, but also take care when including variable data to consider suitability for aggregation in telemetry.\n\t * Also avoid including any data that jeopardizes the user's privacy. Add a tagged telemetry property instead.\n\t */\n\treadonly message: string;\n\n\t/**\n\t * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack}.\n\t */\n\treadonly stack?: string;\n\n\t/**\n\t * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name}.\n\t */\n\treadonly name: string;\n\n\t/**\n\t * A Guid identifying this error instance.\n\t *\n\t * @remarks\n\t *\n\t * Useful in telemetry for deduplicating multiple logging events arising from the same error,\n\t * or correlating an error with an inner error that caused it, in case of error wrapping.\n\t */\n\treadonly errorInstanceId: string;\n\n\t/**\n\t * Get the telemetry properties stashed on this error for logging.\n\t */\n\tgetTelemetryProperties(): ITelemetryProperties;\n\n\t/**\n\t * Add telemetry properties to this error which will be logged with the error\n\t */\n\taddTelemetryProperties: (props: ITelemetryProperties) => void;\n}\n\nconst hasTelemetryPropFunctions = (x: unknown): boolean =>\n\ttypeof (x as Partial<IFluidErrorBase>)?.getTelemetryProperties === \"function\" &&\n\ttypeof (x as Partial<IFluidErrorBase>)?.addTelemetryProperties === \"function\";\n\n/**\n * Type guard for error data containing the {@link IFluidErrorBase.errorInstanceId} property.\n */\nexport const hasErrorInstanceId = (x: unknown): x is { errorInstanceId: string } =>\n\ttypeof (x as Partial<{ errorInstanceId: string }>)?.errorInstanceId === \"string\";\n\n/**\n * Type guard for {@link IFluidErrorBase}.\n */\nexport function isFluidError(error: unknown): error is IFluidErrorBase {\n\treturn (\n\t\ttypeof (error as Partial<IFluidErrorBase>)?.errorType === \"string\" &&\n\t\ttypeof (error as Partial<IFluidErrorBase>)?.message === \"string\" &&\n\t\thasErrorInstanceId(error) &&\n\t\thasTelemetryPropFunctions(error)\n\t);\n}\n\n/**\n * Type guard for old standard of valid/known errors.\n */\nexport function isValidLegacyError(\n\terror: unknown,\n): error is Omit<IFluidErrorBase, \"errorInstanceId\"> {\n\treturn (\n\t\ttypeof (error as Partial<IFluidErrorBase>)?.errorType === \"string\" &&\n\t\ttypeof (error as Partial<IFluidErrorBase>)?.message === \"string\" &&\n\t\thasTelemetryPropFunctions(error)\n\t);\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { createChildMonitoringContext, MonitoringContext, IConfigProviderBase, sessionStorageConfigProvider, mixinMonitoringContext, IConfigProvider, ConfigTypes, loggerToMonitoringContext, } from "./config";
|
|
6
|
+
export { DataCorruptionError, DataProcessingError, extractSafePropertiesFromMessage, GenericError, UsageError, } from "./error";
|
|
6
7
|
export { extractLogSafeErrorProperties, generateErrorWithStack, generateStack, getCircularReplacer, IFluidErrorAnnotations, isExternalError, isILoggingError, isTaggedTelemetryPropertyValue, LoggingError, NORMALIZED_ERROR_TYPE, normalizeError, wrapError, wrapErrorAndLog, } from "./errorLogging";
|
|
7
8
|
export { EventEmitterWithErrorHandling } from "./eventEmitterWithErrorHandling";
|
|
8
9
|
export { connectedEventName, disconnectedEventName, raiseConnectedEvent, safeRaiseEvent, } from "./events";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,yBAAyB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,6BAA6B,EAC7B,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,8BAA8B,EAC9B,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,eAAe,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACN,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,GACd,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,wBAAwB,EACxB,2BAA2B,EAC3B,4BAA4B,EAC5B,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,2BAA2B,EAC3B,mBAAmB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EACN,6BAA6B,EAC7B,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,EACvB,6BAA6B,EAC7B,mBAAmB,EACnB,+BAA+B,EAC/B,uBAAuB,GACvB,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,yBAAyB,G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under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { createChildMonitoringContext, sessionStorageConfigProvider, mixinMonitoringContext, loggerToMonitoringContext, } from "./config";
|
|
6
|
+
export { DataCorruptionError, DataProcessingError, extractSafePropertiesFromMessage, GenericError, UsageError, } from "./error";
|
|
6
7
|
export { extractLogSafeErrorProperties, generateErrorWithStack, generateStack, getCircularReplacer, isExternalError, isILoggingError, isTaggedTelemetryPropertyValue, LoggingError, NORMALIZED_ERROR_TYPE, normalizeError, wrapError, wrapErrorAndLog, } from "./errorLogging";
|
|
7
8
|
export { EventEmitterWithErrorHandling } from "./eventEmitterWithErrorHandling";
|
|
8
9
|
export { connectedEventName, disconnectedEventName, raiseConnectedEvent, safeRaiseEvent, } from "./events";
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,4BAA4B,EAG5B,4BAA4B,EAC5B,sBAAsB,EAGtB,yBAAyB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,6BAA6B,EAC7B,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EAEnB,eAAe,EACf,eAAe,EACf,8BAA8B,EAC9B,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,eAAe,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACN,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,GACd,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,kBAAkB,EAElB,YAAY,EACZ,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EAIV,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAEhB,mBAAmB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nexport {\n\tcreateChildMonitoringContext,\n\tMonitoringContext,\n\tIConfigProviderBase,\n\tsessionStorageConfigProvider,\n\tmixinMonitoringContext,\n\tIConfigProvider,\n\tConfigTypes,\n\tloggerToMonitoringContext,\n} from \"./config\";\nexport {\n\textractLogSafeErrorProperties,\n\tgenerateErrorWithStack,\n\tgenerateStack,\n\tgetCircularReplacer,\n\tIFluidErrorAnnotations,\n\tisExternalError,\n\tisILoggingError,\n\tisTaggedTelemetryPropertyValue,\n\tLoggingError,\n\tNORMALIZED_ERROR_TYPE,\n\tnormalizeError,\n\twrapError,\n\twrapErrorAndLog,\n} from \"./errorLogging\";\nexport { EventEmitterWithErrorHandling } from \"./eventEmitterWithErrorHandling\";\nexport {\n\tconnectedEventName,\n\tdisconnectedEventName,\n\traiseConnectedEvent,\n\tsafeRaiseEvent,\n} from \"./events\";\nexport {\n\thasErrorInstanceId,\n\tIFluidErrorBase,\n\tisFluidError,\n\tisValidLegacyError,\n} from \"./fluidErrorBase\";\nexport {\n\teventNamespaceSeparator,\n\tcreateChildLogger,\n\tcreateMultiSinkLogger,\n\tformatTick,\n\tIPerformanceEventMarkers,\n\tITelemetryLoggerPropertyBag,\n\tITelemetryLoggerPropertyBags,\n\tnumberFromString,\n\tPerformanceEvent,\n\tTaggedLoggerAdapter,\n\ttagData,\n\ttagCodeArtifacts,\n\tTelemetryDataTag,\n\tTelemetryEventPropertyTypes,\n\tTelemetryNullLogger,\n} from \"./logger\";\nexport { MockLogger } from \"./mockLogger\";\nexport { ThresholdCounter } from \"./thresholdCounter\";\nexport { SampledTelemetryHelper } from \"./sampledTelemetryHelper\";\nexport { logIfFalse } from \"./utils\";\nexport {\n\tTelemetryEventPropertyTypeExt,\n\tITelemetryEventExt,\n\tITelemetryGenericEventExt,\n\tITelemetryErrorEventExt,\n\tITelemetryPerformanceEventExt,\n\tITelemetryLoggerExt,\n\tITaggedTelemetryPropertyTypeExt,\n\tITelemetryPropertiesExt,\n} from \"./telemetryTypes\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,4BAA4B,EAG5B,4BAA4B,EAC5B,sBAAsB,EAGtB,yBAAyB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,gCAAgC,EAChC,YAAY,EACZ,UAAU,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,6BAA6B,EAC7B,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EAEnB,eAAe,EACf,eAAe,EACf,8BAA8B,EAC9B,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,eAAe,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACN,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,GACd,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,kBAAkB,EAElB,YAAY,EACZ,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EAIV,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAEhB,mBAAmB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nexport {\n\tcreateChildMonitoringContext,\n\tMonitoringContext,\n\tIConfigProviderBase,\n\tsessionStorageConfigProvider,\n\tmixinMonitoringContext,\n\tIConfigProvider,\n\tConfigTypes,\n\tloggerToMonitoringContext,\n} from \"./config\";\nexport {\n\tDataCorruptionError,\n\tDataProcessingError,\n\textractSafePropertiesFromMessage,\n\tGenericError,\n\tUsageError,\n} from \"./error\";\nexport {\n\textractLogSafeErrorProperties,\n\tgenerateErrorWithStack,\n\tgenerateStack,\n\tgetCircularReplacer,\n\tIFluidErrorAnnotations,\n\tisExternalError,\n\tisILoggingError,\n\tisTaggedTelemetryPropertyValue,\n\tLoggingError,\n\tNORMALIZED_ERROR_TYPE,\n\tnormalizeError,\n\twrapError,\n\twrapErrorAndLog,\n} from \"./errorLogging\";\nexport { EventEmitterWithErrorHandling } from \"./eventEmitterWithErrorHandling\";\nexport {\n\tconnectedEventName,\n\tdisconnectedEventName,\n\traiseConnectedEvent,\n\tsafeRaiseEvent,\n} from \"./events\";\nexport {\n\thasErrorInstanceId,\n\tIFluidErrorBase,\n\tisFluidError,\n\tisValidLegacyError,\n} from \"./fluidErrorBase\";\nexport {\n\teventNamespaceSeparator,\n\tcreateChildLogger,\n\tcreateMultiSinkLogger,\n\tformatTick,\n\tIPerformanceEventMarkers,\n\tITelemetryLoggerPropertyBag,\n\tITelemetryLoggerPropertyBags,\n\tnumberFromString,\n\tPerformanceEvent,\n\tTaggedLoggerAdapter,\n\ttagData,\n\ttagCodeArtifacts,\n\tTelemetryDataTag,\n\tTelemetryEventPropertyTypes,\n\tTelemetryNullLogger,\n} from \"./logger\";\nexport { MockLogger } from \"./mockLogger\";\nexport { ThresholdCounter } from \"./thresholdCounter\";\nexport { SampledTelemetryHelper } from \"./sampledTelemetryHelper\";\nexport { logIfFalse } from \"./utils\";\nexport {\n\tTelemetryEventPropertyTypeExt,\n\tITelemetryEventExt,\n\tITelemetryGenericEventExt,\n\tITelemetryErrorEventExt,\n\tITelemetryPerformanceEventExt,\n\tITelemetryLoggerExt,\n\tITaggedTelemetryPropertyTypeExt,\n\tITelemetryPropertiesExt,\n} from \"./telemetryTypes\";\n"]}
|
package/lib/logger.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ITelemetryBaseEvent, ITelemetryBaseLogger, ITelemetryErrorEvent, ITelemetryGenericEvent, ITelemetryPerformanceEvent, ITelemetryProperties, TelemetryEventPropertyType, ITaggedTelemetryPropertyType, TelemetryEventCategory } from "@fluidframework/core-interfaces";
|
|
5
|
+
import { ITelemetryBaseEvent, ITelemetryBaseLogger, ITelemetryErrorEvent, ITelemetryGenericEvent, ITelemetryPerformanceEvent, ITelemetryProperties, TelemetryEventPropertyType, ITaggedTelemetryPropertyType, TelemetryEventCategory, LogLevel } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { IsomorphicPerformance } from "@fluidframework/common-utils";
|
|
7
7
|
import { ITaggedTelemetryPropertyTypeExt, ITelemetryGenericEventExt, ITelemetryLoggerExt, ITelemetryPerformanceEventExt, TelemetryEventPropertyTypeExt } from "./telemetryTypes";
|
|
8
8
|
export interface Memory {
|
|
@@ -16,9 +16,13 @@ export interface PerformanceWithMemory extends IsomorphicPerformance {
|
|
|
16
16
|
* Please do not modify existing entries for backwards compatibility.
|
|
17
17
|
*/
|
|
18
18
|
export declare enum TelemetryDataTag {
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Data containing terms or IDs from code packages that may have been dynamically loaded
|
|
21
|
+
*/
|
|
20
22
|
CodeArtifact = "CodeArtifact",
|
|
21
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Personal data of a variety of classifications that pertains to the user
|
|
25
|
+
*/
|
|
22
26
|
UserData = "UserData"
|
|
23
27
|
}
|
|
24
28
|
export declare type TelemetryEventPropertyTypes = TelemetryEventPropertyType | ITaggedTelemetryPropertyType;
|
|
@@ -42,7 +46,6 @@ export declare const eventNamespaceSeparator: ":";
|
|
|
42
46
|
* TelemetryLogger class contains various helper telemetry methods,
|
|
43
47
|
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
44
48
|
* Creates sub-logger that appends properties to all events
|
|
45
|
-
*
|
|
46
49
|
*/
|
|
47
50
|
export declare abstract class TelemetryLogger implements ITelemetryLoggerExt {
|
|
48
51
|
protected readonly namespace?: string | undefined;
|
|
@@ -56,44 +59,49 @@ export declare abstract class TelemetryLogger implements ITelemetryLoggerExt {
|
|
|
56
59
|
* @param error - Error to extract info from
|
|
57
60
|
* @param fetchStack - Whether to fetch the current callstack if error.stack is undefined
|
|
58
61
|
*/
|
|
59
|
-
static prepareErrorObject(event: ITelemetryBaseEvent, error:
|
|
62
|
+
static prepareErrorObject(event: ITelemetryBaseEvent, error: unknown, fetchStack: boolean): void;
|
|
60
63
|
constructor(namespace?: string | undefined, properties?: ITelemetryLoggerPropertyBags | undefined);
|
|
61
64
|
/**
|
|
62
65
|
* Send an event with the logger
|
|
63
66
|
*
|
|
64
67
|
* @param event - the event to send
|
|
65
68
|
*/
|
|
66
|
-
abstract send(event: ITelemetryBaseEvent): void;
|
|
69
|
+
abstract send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
|
|
67
70
|
/**
|
|
68
71
|
* Send a telemetry event with the logger
|
|
69
72
|
*
|
|
70
73
|
* @param event - the event to send
|
|
71
74
|
* @param error - optional error object to log
|
|
75
|
+
* @param logLevel - optional level of the log. It category of event is set as error,
|
|
76
|
+
* then the logLevel will be upgraded to be an error.
|
|
72
77
|
*/
|
|
73
|
-
sendTelemetryEvent(event: ITelemetryGenericEventExt, error?:
|
|
78
|
+
sendTelemetryEvent(event: ITelemetryGenericEventExt, error?: unknown, logLevel?: LogLevel.verbose | LogLevel.default): void;
|
|
74
79
|
/**
|
|
75
80
|
* Send a telemetry event with the logger
|
|
76
81
|
*
|
|
77
82
|
* @param event - the event to send
|
|
78
83
|
* @param error - optional error object to log
|
|
84
|
+
* @param logLevel - optional level of the log.
|
|
79
85
|
*/
|
|
80
86
|
protected sendTelemetryEventCore(event: ITelemetryGenericEventExt & {
|
|
81
87
|
category: TelemetryEventCategory;
|
|
82
|
-
}, error?:
|
|
88
|
+
}, error?: unknown, logLevel?: LogLevel): void;
|
|
83
89
|
/**
|
|
84
90
|
* Send an error telemetry event with the logger
|
|
85
91
|
*
|
|
86
92
|
* @param event - the event to send
|
|
87
93
|
* @param error - optional error object to log
|
|
88
94
|
*/
|
|
89
|
-
sendErrorEvent(event: ITelemetryErrorEvent, error?:
|
|
95
|
+
sendErrorEvent(event: ITelemetryErrorEvent, error?: unknown): void;
|
|
90
96
|
/**
|
|
91
97
|
* Send a performance telemetry event with the logger
|
|
92
98
|
*
|
|
93
99
|
* @param event - Event to send
|
|
94
100
|
* @param error - optional error object to log
|
|
101
|
+
* @param logLevel - optional level of the log. It category of event is set as error,
|
|
102
|
+
* then the logLevel will be upgraded to be an error.
|
|
95
103
|
*/
|
|
96
|
-
sendPerformanceEvent(event: ITelemetryPerformanceEventExt, error?:
|
|
104
|
+
sendPerformanceEvent(event: ITelemetryPerformanceEventExt, error?: unknown, logLevel?: LogLevel.verbose | LogLevel.default): void;
|
|
97
105
|
protected prepareEvent(event: ITelemetryBaseEvent): ITelemetryBaseEvent;
|
|
98
106
|
private extendProperties;
|
|
99
107
|
}
|
|
@@ -105,6 +113,9 @@ export declare abstract class TelemetryLogger implements ITelemetryLoggerExt {
|
|
|
105
113
|
export declare class TaggedLoggerAdapter implements ITelemetryBaseLogger {
|
|
106
114
|
private readonly logger;
|
|
107
115
|
constructor(logger: ITelemetryBaseLogger);
|
|
116
|
+
/**
|
|
117
|
+
* {@inheritDoc @fluidframework/core-interfaces#ITelemetryBaseLogger.send}
|
|
118
|
+
*/
|
|
108
119
|
send(eventWithTagsMaybe: ITelemetryBaseEvent): void;
|
|
109
120
|
}
|
|
110
121
|
/**
|
|
@@ -135,12 +146,13 @@ export declare class ChildLogger extends TelemetryLogger {
|
|
|
135
146
|
*/
|
|
136
147
|
static create(baseLogger?: ITelemetryBaseLogger, namespace?: string, properties?: ITelemetryLoggerPropertyBags): TelemetryLogger;
|
|
137
148
|
private constructor();
|
|
149
|
+
private shouldFilterOutEvent;
|
|
138
150
|
/**
|
|
139
151
|
* Send an event with the logger
|
|
140
152
|
*
|
|
141
153
|
* @param event - the event to send
|
|
142
154
|
*/
|
|
143
|
-
send(event: ITelemetryBaseEvent): void;
|
|
155
|
+
send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
|
|
144
156
|
}
|
|
145
157
|
/**
|
|
146
158
|
* Create a logger which logs to multiple other loggers based on the provided props object
|
|
@@ -210,11 +222,11 @@ export declare class PerformanceEvent {
|
|
|
210
222
|
private autoEnd;
|
|
211
223
|
end(props?: ITelemetryProperties): void;
|
|
212
224
|
private performanceEndMark;
|
|
213
|
-
cancel(props?: ITelemetryProperties, error?:
|
|
225
|
+
cancel(props?: ITelemetryProperties, error?: unknown): void;
|
|
214
226
|
/**
|
|
215
227
|
* Report the event, if it hasn't already been reported.
|
|
216
228
|
*/
|
|
217
|
-
reportEvent(eventNameSuffix: string, props?: ITelemetryProperties, error?:
|
|
229
|
+
reportEvent(eventNameSuffix: string, props?: ITelemetryProperties, error?: unknown): void;
|
|
218
230
|
}
|
|
219
231
|
/**
|
|
220
232
|
* Null logger that no-ops for all telemetry events passed to it.
|
|
@@ -225,9 +237,9 @@ export declare class PerformanceEvent {
|
|
|
225
237
|
*/
|
|
226
238
|
export declare class TelemetryNullLogger implements ITelemetryLoggerExt {
|
|
227
239
|
send(event: ITelemetryBaseEvent): void;
|
|
228
|
-
sendTelemetryEvent(event: ITelemetryGenericEvent, error?:
|
|
229
|
-
sendErrorEvent(event: ITelemetryErrorEvent, error?:
|
|
230
|
-
sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?:
|
|
240
|
+
sendTelemetryEvent(event: ITelemetryGenericEvent, error?: unknown): void;
|
|
241
|
+
sendErrorEvent(event: ITelemetryErrorEvent, error?: unknown): void;
|
|
242
|
+
sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: unknown): void;
|
|
231
243
|
}
|
|
232
244
|
/**
|
|
233
245
|
* Takes in value, and does one of 4 things.
|
package/lib/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,EACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAe,MAAM,8BAA8B,CAAC;AAQlF,OAAO,EACN,+BAA+B,EAE/B,yBAAyB,EACzB,mBAAmB,EACnB,6BAA6B,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,EACtB,QAAQ,EACR,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAe,MAAM,8BAA8B,CAAC;AAQlF,OAAO,EACN,+BAA+B,EAE/B,yBAAyB,EACzB,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AE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAOlE;;OAEG;IACI,WAAW,CACjB,eAAe,EAAE,MAAM,EACvB,KAAK,CAAC,EAAE,oBAAoB,EAC5B,KAAK,CAAC,EAAE,OAAO,GACb,IAAI;CA8BP;AAED;;;;;;GAMG;AACH,qBAAa,mBAAoB,YAAW,mBAAmB;IACvD,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;IACtC,kBAAkB,CAAC,KAAK,EAAE,sBAAsB,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IACxE,cAAc,CAAC,KAAK,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAClE,oBAAoB,CAAC,KAAK,EAAE,0BAA0B,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;CACrF;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACxC,CAAC,EAAE,6BAA6B,GAAG,+BAA+B,GAChE,0BAA0B,GAAG,4BAA4B,CAO3D;AAuBD,eAAO,MAAM,OAAO;;;mDAyBL,CAAC;AAEhB,eAAO,MAAM,gBAAgB;;SAMpB,iBAAiB,YAAY;mDAGa,CAAC"}
|
package/lib/logger.js
CHANGED
|
@@ -11,9 +11,13 @@ import { isILoggingError, extractLogSafeErrorProperties, generateStack, isTagged
|
|
|
11
11
|
*/
|
|
12
12
|
export var TelemetryDataTag;
|
|
13
13
|
(function (TelemetryDataTag) {
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Data containing terms or IDs from code packages that may have been dynamically loaded
|
|
16
|
+
*/
|
|
15
17
|
TelemetryDataTag["CodeArtifact"] = "CodeArtifact";
|
|
16
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Personal data of a variety of classifications that pertains to the user
|
|
20
|
+
*/
|
|
17
21
|
TelemetryDataTag["UserData"] = "UserData";
|
|
18
22
|
})(TelemetryDataTag || (TelemetryDataTag = {}));
|
|
19
23
|
/**
|
|
@@ -22,6 +26,7 @@ export var TelemetryDataTag;
|
|
|
22
26
|
* Used to make telemetry data typed (and support math operations, like comparison),
|
|
23
27
|
* in places where we do expect numbers (like contentsize/duration property in http header)
|
|
24
28
|
*/
|
|
29
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
25
30
|
export function numberFromString(str) {
|
|
26
31
|
if (str === undefined || str === null) {
|
|
27
32
|
return undefined;
|
|
@@ -37,7 +42,6 @@ export const eventNamespaceSeparator = ":";
|
|
|
37
42
|
* TelemetryLogger class contains various helper telemetry methods,
|
|
38
43
|
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
39
44
|
* Creates sub-logger that appends properties to all events
|
|
40
|
-
*
|
|
41
45
|
*/
|
|
42
46
|
export class TelemetryLogger {
|
|
43
47
|
constructor(namespace, properties) {
|
|
@@ -81,17 +85,20 @@ export class TelemetryLogger {
|
|
|
81
85
|
*
|
|
82
86
|
* @param event - the event to send
|
|
83
87
|
* @param error - optional error object to log
|
|
88
|
+
* @param logLevel - optional level of the log. It category of event is set as error,
|
|
89
|
+
* then the logLevel will be upgraded to be an error.
|
|
84
90
|
*/
|
|
85
|
-
sendTelemetryEvent(event, error) {
|
|
86
|
-
this.sendTelemetryEventCore({ ...event, category: event.category ?? "generic" }, error);
|
|
91
|
+
sendTelemetryEvent(event, error, logLevel = 10 /* default */) {
|
|
92
|
+
this.sendTelemetryEventCore({ ...event, category: event.category ?? "generic" }, error, event.category === "error" ? 20 /* error */ : logLevel);
|
|
87
93
|
}
|
|
88
94
|
/**
|
|
89
95
|
* Send a telemetry event with the logger
|
|
90
96
|
*
|
|
91
97
|
* @param event - the event to send
|
|
92
98
|
* @param error - optional error object to log
|
|
99
|
+
* @param logLevel - optional level of the log.
|
|
93
100
|
*/
|
|
94
|
-
sendTelemetryEventCore(event, error) {
|
|
101
|
+
sendTelemetryEventCore(event, error, logLevel) {
|
|
95
102
|
const newEvent = convertToBaseEvent(event);
|
|
96
103
|
if (error !== undefined) {
|
|
97
104
|
TelemetryLogger.prepareErrorObject(newEvent, error, false);
|
|
@@ -100,7 +107,7 @@ export class TelemetryLogger {
|
|
|
100
107
|
if (typeof newEvent.duration === "number") {
|
|
101
108
|
newEvent.duration = formatTick(newEvent.duration);
|
|
102
109
|
}
|
|
103
|
-
this.send(newEvent);
|
|
110
|
+
this.send(newEvent, logLevel);
|
|
104
111
|
}
|
|
105
112
|
/**
|
|
106
113
|
* Send an error telemetry event with the logger
|
|
@@ -115,20 +122,22 @@ export class TelemetryLogger {
|
|
|
115
122
|
error: event.eventName,
|
|
116
123
|
...event,
|
|
117
124
|
category: "error",
|
|
118
|
-
}, error);
|
|
125
|
+
}, error, 20 /* error */);
|
|
119
126
|
}
|
|
120
127
|
/**
|
|
121
128
|
* Send a performance telemetry event with the logger
|
|
122
129
|
*
|
|
123
130
|
* @param event - Event to send
|
|
124
131
|
* @param error - optional error object to log
|
|
132
|
+
* @param logLevel - optional level of the log. It category of event is set as error,
|
|
133
|
+
* then the logLevel will be upgraded to be an error.
|
|
125
134
|
*/
|
|
126
|
-
sendPerformanceEvent(event, error) {
|
|
135
|
+
sendPerformanceEvent(event, error, logLevel = 10 /* default */) {
|
|
127
136
|
const perfEvent = {
|
|
128
137
|
...event,
|
|
129
138
|
category: event.category ?? "performance",
|
|
130
139
|
};
|
|
131
|
-
this.sendTelemetryEventCore(perfEvent, error);
|
|
140
|
+
this.sendTelemetryEventCore(perfEvent, error, perfEvent.category === "error" ? 20 /* error */ : logLevel);
|
|
132
141
|
}
|
|
133
142
|
prepareEvent(event) {
|
|
134
143
|
const includeErrorProps = event.category === "error" || event.error !== undefined;
|
|
@@ -177,6 +186,9 @@ export class TaggedLoggerAdapter {
|
|
|
177
186
|
constructor(logger) {
|
|
178
187
|
this.logger = logger;
|
|
179
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* {@inheritDoc @fluidframework/core-interfaces#ITelemetryBaseLogger.send}
|
|
191
|
+
*/
|
|
180
192
|
send(eventWithTagsMaybe) {
|
|
181
193
|
const newEvent = {
|
|
182
194
|
category: eventWithTagsMaybe.category,
|
|
@@ -278,13 +290,22 @@ export class ChildLogger extends TelemetryLogger {
|
|
|
278
290
|
}
|
|
279
291
|
return new ChildLogger(baseLogger ? baseLogger : { send() { } }, namespace, properties);
|
|
280
292
|
}
|
|
293
|
+
shouldFilterOutEvent(event, logLevel) {
|
|
294
|
+
const eventLogLevel = logLevel ?? 10 /* default */;
|
|
295
|
+
const configLogLevel = this.baseLogger.minLogLevel ?? 10 /* default */;
|
|
296
|
+
// Filter out in case event log level is below what is wanted in config.
|
|
297
|
+
return eventLogLevel < configLogLevel;
|
|
298
|
+
}
|
|
281
299
|
/**
|
|
282
300
|
* Send an event with the logger
|
|
283
301
|
*
|
|
284
302
|
* @param event - the event to send
|
|
285
303
|
*/
|
|
286
|
-
send(event) {
|
|
287
|
-
|
|
304
|
+
send(event, logLevel) {
|
|
305
|
+
if (this.shouldFilterOutEvent(event, logLevel)) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
this.baseLogger.send(this.prepareEvent(event), logLevel);
|
|
288
309
|
}
|
|
289
310
|
}
|
|
290
311
|
/**
|
|
@@ -314,8 +335,11 @@ export class MultiSinkLogger extends TelemetryLogger {
|
|
|
314
335
|
loggers
|
|
315
336
|
.filter((l) => l instanceof TelemetryLogger)
|
|
316
337
|
.map((l) => l.properties ?? {})
|
|
338
|
+
// eslint-disable-next-line unicorn/no-array-for-each
|
|
317
339
|
.forEach((cv) => {
|
|
340
|
+
// eslint-disable-next-line unicorn/no-array-for-each
|
|
318
341
|
Object.keys(cv).forEach((k) => {
|
|
342
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
319
343
|
merge[k] = { ...cv[k], ...merge?.[k] };
|
|
320
344
|
});
|
|
321
345
|
});
|
|
@@ -339,9 +363,9 @@ export class MultiSinkLogger extends TelemetryLogger {
|
|
|
339
363
|
*/
|
|
340
364
|
send(event) {
|
|
341
365
|
const newEvent = this.prepareEvent(event);
|
|
342
|
-
this.loggers
|
|
366
|
+
for (const logger of this.loggers) {
|
|
343
367
|
logger.send(newEvent);
|
|
344
|
-
}
|
|
368
|
+
}
|
|
345
369
|
}
|
|
346
370
|
}
|
|
347
371
|
/**
|
|
@@ -358,6 +382,7 @@ export class PerformanceEvent {
|
|
|
358
382
|
if (this.markers.start) {
|
|
359
383
|
this.reportEvent("start");
|
|
360
384
|
}
|
|
385
|
+
// eslint-disable-next-line unicorn/no-null
|
|
361
386
|
if (typeof window === "object" && window != null && window.performance?.mark) {
|
|
362
387
|
this.startMark = `${event.eventName}-start`;
|
|
363
388
|
window.performance.mark(this.startMark);
|
|
@@ -512,9 +537,11 @@ function convertToBasePropertyTypeUntagged(x) {
|
|
|
512
537
|
}
|
|
513
538
|
export const tagData = (tag, values) => Object.entries(values)
|
|
514
539
|
.filter((e) => e[1] !== undefined)
|
|
540
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
515
541
|
.reduce((pv, cv) => {
|
|
516
542
|
pv[cv[0]] = { tag, value: cv[1] };
|
|
517
543
|
return pv;
|
|
544
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
|
|
518
545
|
}, {});
|
|
519
546
|
export const tagCodeArtifacts = (values) => tagData(TelemetryDataTag.CodeArtifact, values);
|
|
520
547
|
//# sourceMappingURL=logger.js.map
|