@fluidframework/telemetry-utils 2.0.0-internal.7.3.0 → 2.0.0-internal.8.0.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/CHANGELOG.md +19 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +3 -3
- package/api-report/telemetry-utils.api.md +64 -57
- package/dist/config.d.ts +37 -10
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +30 -0
- package/dist/config.js.map +1 -1
- package/dist/error.d.ts +12 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +18 -1
- package/dist/error.js.map +1 -1
- package/dist/errorLogging.d.ts +7 -2
- package/dist/errorLogging.d.ts.map +1 -1
- package/dist/errorLogging.js +7 -2
- package/dist/errorLogging.js.map +1 -1
- package/dist/eventEmitterWithErrorHandling.d.ts +6 -0
- package/dist/eventEmitterWithErrorHandling.d.ts.map +1 -1
- package/dist/eventEmitterWithErrorHandling.js +6 -0
- package/dist/eventEmitterWithErrorHandling.js.map +1 -1
- package/dist/events.d.ts +15 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +16 -0
- package/dist/events.js.map +1 -1
- package/dist/fluidErrorBase.d.ts +8 -0
- package/dist/fluidErrorBase.d.ts.map +1 -1
- package/dist/fluidErrorBase.js +6 -0
- package/dist/fluidErrorBase.js.map +1 -1
- package/dist/index.d.ts +20 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +117 -17
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +82 -12
- package/dist/logger.js.map +1 -1
- package/dist/mockLogger.d.ts +2 -0
- package/dist/mockLogger.d.ts.map +1 -1
- package/dist/mockLogger.js +2 -0
- package/dist/mockLogger.js.map +1 -1
- package/dist/sampledTelemetryHelper.d.ts +7 -3
- package/dist/sampledTelemetryHelper.d.ts.map +1 -1
- package/dist/sampledTelemetryHelper.js +7 -3
- package/dist/sampledTelemetryHelper.js.map +1 -1
- package/dist/telemetry-utils-alpha.d.ts +270 -0
- package/dist/telemetry-utils-beta.d.ts +205 -0
- package/dist/telemetry-utils-public.d.ts +205 -0
- package/dist/telemetry-utils-untrimmed.d.ts +1123 -0
- package/dist/telemetryTypes.d.ts +27 -8
- package/dist/telemetryTypes.d.ts.map +1 -1
- package/dist/telemetryTypes.js.map +1 -1
- package/dist/thresholdCounter.d.ts +3 -2
- package/dist/thresholdCounter.d.ts.map +1 -1
- package/dist/thresholdCounter.js +3 -2
- package/dist/thresholdCounter.js.map +1 -1
- package/dist/utils.d.ts +6 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +6 -0
- package/dist/utils.js.map +1 -1
- package/lib/config.d.ts +37 -10
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +30 -0
- package/lib/config.js.map +1 -1
- package/lib/error.d.ts +12 -0
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +16 -0
- package/lib/error.js.map +1 -1
- package/lib/errorLogging.d.ts +7 -2
- package/lib/errorLogging.d.ts.map +1 -1
- package/lib/errorLogging.js +7 -2
- package/lib/errorLogging.js.map +1 -1
- package/lib/eventEmitterWithErrorHandling.d.ts +6 -0
- package/lib/eventEmitterWithErrorHandling.d.ts.map +1 -1
- package/lib/eventEmitterWithErrorHandling.js +6 -0
- package/lib/eventEmitterWithErrorHandling.js.map +1 -1
- package/lib/events.d.ts +15 -0
- package/lib/events.d.ts.map +1 -1
- package/lib/events.js +16 -0
- package/lib/events.js.map +1 -1
- package/lib/fluidErrorBase.d.ts +8 -0
- package/lib/fluidErrorBase.d.ts.map +1 -1
- package/lib/fluidErrorBase.js +6 -0
- package/lib/fluidErrorBase.js.map +1 -1
- package/lib/index.d.ts +20 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +117 -17
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +82 -12
- package/lib/logger.js.map +1 -1
- package/lib/mockLogger.d.ts +2 -0
- package/lib/mockLogger.d.ts.map +1 -1
- package/lib/mockLogger.js +2 -0
- package/lib/mockLogger.js.map +1 -1
- package/lib/sampledTelemetryHelper.d.ts +7 -3
- package/lib/sampledTelemetryHelper.d.ts.map +1 -1
- package/lib/sampledTelemetryHelper.js +7 -3
- package/lib/sampledTelemetryHelper.js.map +1 -1
- package/lib/telemetry-utils-alpha.d.ts +270 -0
- package/lib/telemetry-utils-beta.d.ts +205 -0
- package/lib/telemetry-utils-public.d.ts +205 -0
- package/lib/telemetry-utils-untrimmed.d.ts +1123 -0
- package/lib/telemetryTypes.d.ts +27 -8
- package/lib/telemetryTypes.d.ts.map +1 -1
- package/lib/telemetryTypes.js.map +1 -1
- package/lib/thresholdCounter.d.ts +3 -2
- package/lib/thresholdCounter.d.ts.map +1 -1
- package/lib/thresholdCounter.js +3 -2
- package/lib/thresholdCounter.js.map +1 -1
- package/lib/utils.d.ts +6 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +6 -0
- package/lib/utils.js.map +1 -1
- package/package.json +29 -10
- package/src/config.ts +41 -12
- package/src/error.ts +21 -0
- package/src/errorLogging.ts +7 -2
- package/src/eventEmitterWithErrorHandling.ts +6 -0
- package/src/events.ts +18 -0
- package/src/fluidErrorBase.ts +8 -0
- package/src/index.ts +21 -2
- package/src/logger.ts +125 -17
- package/src/mockLogger.ts +2 -0
- package/src/sampledTelemetryHelper.ts +7 -3
- package/src/telemetryTypes.ts +27 -8
- package/src/thresholdCounter.ts +3 -2
- package/src/utils.ts +6 -0
|
@@ -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;;;AAoEH,MAAM,yBAAyB,GAAG,CAAC,CAAU,EAAW,EAAE,CACzD,OAAQ,CAA8B,EAAE,sBAAsB,KAAK,UAAU;IAC7E,OAAQ,CAA8B,EAAE,sBAAsB,KAAK,UAAU,CAAC;AAE/E;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAAC,CAAU,EAAoC,EAAE,CAClF,OAAQ,CAA0C,EAAE,eAAe,KAAK,QAAQ,CAAC;AADrE,QAAA,kBAAkB,sBACmD;AAElF;;;;GAIG;AACH,SAAgB,YAAY,CAAC,KAAc;IAC1C,OAAO,CACN,OAAQ,KAAkC,EAAE,SAAS,KAAK,QAAQ;QAClE,OAAQ,KAAkC,EAAE,OAAO,KAAK,QAAQ;QAChE,IAAA,0BAAkB,EAAC,KAAK,CAAC;QACzB,yBAAyB,CAAC,KAAK,CAAC,CAChC,CAAC;AACH,CAAC;AAPD,oCAOC;AAED;;;;GAIG;AACH,SAAgB,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;AARD,gDAQC","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 *\n * @internal\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 *\n * @internal\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 *\n * @internal\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 *\n * @internal\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/dist/index.d.ts
CHANGED
|
@@ -2,16 +2,33 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { createChildMonitoringContext, MonitoringContext,
|
|
6
|
-
export { DataCorruptionError, DataProcessingError, extractSafePropertiesFromMessage, GenericError, UsageError, } from "./error";
|
|
5
|
+
export { createChildMonitoringContext, MonitoringContext, sessionStorageConfigProvider, mixinMonitoringContext, IConfigProvider, loggerToMonitoringContext, } from "./config";
|
|
6
|
+
export { DataCorruptionError, DataProcessingError, extractSafePropertiesFromMessage, GenericError, UsageError, validatePrecondition, } from "./error";
|
|
7
7
|
export { extractLogSafeErrorProperties, generateErrorWithStack, generateStack, getCircularReplacer, IFluidErrorAnnotations, isExternalError, isILoggingError, isTaggedTelemetryPropertyValue, LoggingError, NORMALIZED_ERROR_TYPE, normalizeError, overwriteStack, wrapError, wrapErrorAndLog, } from "./errorLogging";
|
|
8
8
|
export { EventEmitterWithErrorHandling } from "./eventEmitterWithErrorHandling";
|
|
9
9
|
export { connectedEventName, disconnectedEventName, raiseConnectedEvent, safeRaiseEvent, } from "./events";
|
|
10
10
|
export { hasErrorInstanceId, IFluidErrorBase, isFluidError, isValidLegacyError, } from "./fluidErrorBase";
|
|
11
|
-
export { eventNamespaceSeparator, createChildLogger, createMultiSinkLogger, formatTick, IPerformanceEventMarkers, ITelemetryLoggerPropertyBag, ITelemetryLoggerPropertyBags, numberFromString, PerformanceEvent, TaggedLoggerAdapter, tagData, tagCodeArtifacts, TelemetryDataTag, TelemetryEventPropertyTypes, TelemetryNullLogger, } from "./logger";
|
|
11
|
+
export { eventNamespaceSeparator, createChildLogger, createMultiSinkLogger, formatTick, IPerformanceEventMarkers, ITelemetryLoggerPropertyBag, ITelemetryLoggerPropertyBags, MultiSinkLoggerProperties, numberFromString, PerformanceEvent, TaggedLoggerAdapter, tagData, tagCodeArtifacts, TelemetryDataTag, TelemetryEventPropertyTypes, TelemetryNullLogger, } from "./logger";
|
|
12
12
|
export { MockLogger } from "./mockLogger";
|
|
13
13
|
export { ThresholdCounter } from "./thresholdCounter";
|
|
14
14
|
export { SampledTelemetryHelper } from "./sampledTelemetryHelper";
|
|
15
15
|
export { logIfFalse, createSampledLogger, IEventSampler, ISampledTelemetryLogger } from "./utils";
|
|
16
16
|
export { TelemetryEventPropertyTypeExt, ITelemetryEventExt, ITelemetryGenericEventExt, ITelemetryErrorEventExt, ITelemetryPerformanceEventExt, ITelemetryLoggerExt, ITaggedTelemetryPropertyTypeExt, ITelemetryPropertiesExt, TelemetryEventCategory, } from "./telemetryTypes";
|
|
17
|
+
/**
|
|
18
|
+
* Types supported by {@link IConfigProviderBase}.
|
|
19
|
+
* @deprecated Use ConfigTypes from fluidFramework/core-interfaces
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Base interface for providing configurations to enable/disable/control features.
|
|
26
|
+
*
|
|
27
|
+
* @deprecated Use IConfigProviderBase from fluidFramework/core-interfaces
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export interface IConfigProviderBase {
|
|
32
|
+
getRawConfig(name: string): ConfigTypes;
|
|
33
|
+
}
|
|
17
34
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,4BAA4B,EAC5B,iBAAiB,EACjB,4BAA4B,EAC5B,sBAAsB,EACtB,eAAe,EACf,yBAAyB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,gCAAgC,EAChC,YAAY,EACZ,UAAU,EACV,oBAAoB,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,6BAA6B,EAC7B,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,8BAA8B,EAC9B,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,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,yBAAyB,EACzB,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,mBAAmB,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EACN,6BAA6B,EAC7B,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,EACvB,6BAA6B,EAC7B,mBAAmB,EACnB,+BAA+B,EAC/B,uBAAuB,EACvB,sBAAsB,GACtB,MAAM,kBAAkB,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,SAAS,CAAC;AAElG;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IACnC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;CACxC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSampledLogger = exports.logIfFalse = exports.SampledTelemetryHelper = exports.ThresholdCounter = exports.MockLogger = exports.TelemetryNullLogger = exports.TelemetryDataTag = exports.tagCodeArtifacts = exports.tagData = exports.TaggedLoggerAdapter = exports.PerformanceEvent = exports.numberFromString = exports.formatTick = exports.createMultiSinkLogger = exports.createChildLogger = exports.eventNamespaceSeparator = exports.isValidLegacyError = exports.isFluidError = exports.hasErrorInstanceId = exports.safeRaiseEvent = exports.raiseConnectedEvent = exports.disconnectedEventName = exports.connectedEventName = exports.EventEmitterWithErrorHandling = exports.wrapErrorAndLog = exports.wrapError = exports.overwriteStack = exports.normalizeError = exports.NORMALIZED_ERROR_TYPE = exports.LoggingError = exports.isTaggedTelemetryPropertyValue = exports.isILoggingError = exports.isExternalError = exports.getCircularReplacer = exports.generateStack = exports.generateErrorWithStack = exports.extractLogSafeErrorProperties = exports.UsageError = exports.GenericError = exports.extractSafePropertiesFromMessage = exports.DataProcessingError = exports.DataCorruptionError = exports.loggerToMonitoringContext = exports.mixinMonitoringContext = exports.sessionStorageConfigProvider = exports.createChildMonitoringContext = void 0;
|
|
3
|
+
exports.createSampledLogger = exports.logIfFalse = exports.SampledTelemetryHelper = exports.ThresholdCounter = exports.MockLogger = exports.TelemetryNullLogger = exports.TelemetryDataTag = exports.tagCodeArtifacts = exports.tagData = exports.TaggedLoggerAdapter = exports.PerformanceEvent = exports.numberFromString = exports.formatTick = exports.createMultiSinkLogger = exports.createChildLogger = exports.eventNamespaceSeparator = exports.isValidLegacyError = exports.isFluidError = exports.hasErrorInstanceId = exports.safeRaiseEvent = exports.raiseConnectedEvent = exports.disconnectedEventName = exports.connectedEventName = exports.EventEmitterWithErrorHandling = exports.wrapErrorAndLog = exports.wrapError = exports.overwriteStack = exports.normalizeError = exports.NORMALIZED_ERROR_TYPE = exports.LoggingError = exports.isTaggedTelemetryPropertyValue = exports.isILoggingError = exports.isExternalError = exports.getCircularReplacer = exports.generateStack = exports.generateErrorWithStack = exports.extractLogSafeErrorProperties = exports.validatePrecondition = exports.UsageError = exports.GenericError = exports.extractSafePropertiesFromMessage = exports.DataProcessingError = exports.DataCorruptionError = exports.loggerToMonitoringContext = exports.mixinMonitoringContext = exports.sessionStorageConfigProvider = exports.createChildMonitoringContext = void 0;
|
|
4
4
|
/*!
|
|
5
5
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
6
6
|
* Licensed under the MIT License.
|
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "DataProcessingError", { enumerable: true, get: f
|
|
|
16
16
|
Object.defineProperty(exports, "extractSafePropertiesFromMessage", { enumerable: true, get: function () { return error_1.extractSafePropertiesFromMessage; } });
|
|
17
17
|
Object.defineProperty(exports, "GenericError", { enumerable: true, get: function () { return error_1.GenericError; } });
|
|
18
18
|
Object.defineProperty(exports, "UsageError", { enumerable: true, get: function () { return error_1.UsageError; } });
|
|
19
|
+
Object.defineProperty(exports, "validatePrecondition", { enumerable: true, get: function () { return error_1.validatePrecondition; } });
|
|
19
20
|
var errorLogging_1 = require("./errorLogging");
|
|
20
21
|
Object.defineProperty(exports, "extractLogSafeErrorProperties", { enumerable: true, get: function () { return errorLogging_1.extractLogSafeErrorProperties; } });
|
|
21
22
|
Object.defineProperty(exports, "generateErrorWithStack", { enumerable: true, get: function () { return errorLogging_1.generateErrorWithStack; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,mCAOkB;AANjB,sHAAA,4BAA4B,OAAA;AAE5B,sHAAA,4BAA4B,OAAA;AAC5B,gHAAA,sBAAsB,OAAA;AAEtB,mHAAA,yBAAyB,OAAA;AAE1B,iCAOiB;AANhB,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,yHAAA,gCAAgC,OAAA;AAChC,qGAAA,YAAY,OAAA;AACZ,mGAAA,UAAU,OAAA;AACV,6GAAA,oBAAoB,OAAA;AAErB,+CAewB;AAdvB,6HAAA,6BAA6B,OAAA;AAC7B,sHAAA,sBAAsB,OAAA;AACtB,6GAAA,aAAa,OAAA;AACb,mHAAA,mBAAmB,OAAA;AAEnB,+GAAA,eAAe,OAAA;AACf,+GAAA,eAAe,OAAA;AACf,8HAAA,8BAA8B,OAAA;AAC9B,4GAAA,YAAY,OAAA;AACZ,qHAAA,qBAAqB,OAAA;AACrB,8GAAA,cAAc,OAAA;AACd,8GAAA,cAAc,OAAA;AACd,yGAAA,SAAS,OAAA;AACT,+GAAA,eAAe,OAAA;AAEhB,iFAAgF;AAAvE,8IAAA,6BAA6B,OAAA;AACtC,mCAKkB;AAJjB,4GAAA,kBAAkB,OAAA;AAClB,+GAAA,qBAAqB,OAAA;AACrB,6GAAA,mBAAmB,OAAA;AACnB,wGAAA,cAAc,OAAA;AAEf,mDAK0B;AAJzB,oHAAA,kBAAkB,OAAA;AAElB,8GAAA,YAAY,OAAA;AACZ,oHAAA,kBAAkB,OAAA;AAEnB,mCAiBkB;AAhBjB,iHAAA,uBAAuB,OAAA;AACvB,2GAAA,iBAAiB,OAAA;AACjB,+GAAA,qBAAqB,OAAA;AACrB,oGAAA,UAAU,OAAA;AAKV,0GAAA,gBAAgB,OAAA;AAChB,0GAAA,gBAAgB,OAAA;AAChB,6GAAA,mBAAmB,OAAA;AACnB,iGAAA,OAAO,OAAA;AACP,0GAAA,gBAAgB,OAAA;AAChB,0GAAA,gBAAgB,OAAA;AAEhB,6GAAA,mBAAmB,OAAA;AAEpB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,iCAAkG;AAAzF,mGAAA,UAAU,OAAA;AAAE,4GAAA,mBAAmB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nexport {\n\tcreateChildMonitoringContext,\n\tMonitoringContext,\n\tsessionStorageConfigProvider,\n\tmixinMonitoringContext,\n\tIConfigProvider,\n\tloggerToMonitoringContext,\n} from \"./config\";\nexport {\n\tDataCorruptionError,\n\tDataProcessingError,\n\textractSafePropertiesFromMessage,\n\tGenericError,\n\tUsageError,\n\tvalidatePrecondition,\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\toverwriteStack,\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\tMultiSinkLoggerProperties,\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, createSampledLogger, IEventSampler, ISampledTelemetryLogger } from \"./utils\";\nexport {\n\tTelemetryEventPropertyTypeExt,\n\tITelemetryEventExt,\n\tITelemetryGenericEventExt,\n\tITelemetryErrorEventExt,\n\tITelemetryPerformanceEventExt,\n\tITelemetryLoggerExt,\n\tITaggedTelemetryPropertyTypeExt,\n\tITelemetryPropertiesExt,\n\tTelemetryEventCategory,\n} from \"./telemetryTypes\";\n\n/**\n * Types supported by {@link IConfigProviderBase}.\n * @deprecated Use ConfigTypes from fluidFramework/core-interfaces\n *\n * @internal\n */\nexport type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;\n\n/**\n * Base interface for providing configurations to enable/disable/control features.\n *\n * @deprecated Use IConfigProviderBase from fluidFramework/core-interfaces\n *\n * @internal\n */\nexport interface IConfigProviderBase {\n\tgetRawConfig(name: string): ConfigTypes;\n}\n"]}
|
package/dist/logger.d.ts
CHANGED
|
@@ -13,7 +13,10 @@ export interface PerformanceWithMemory extends IsomorphicPerformance {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Broad classifications to be applied to individual properties as they're prepared to be logged to telemetry.
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
|
+
* @privateRemarks Please do not modify existing entries, to maintain backwards compatibility.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
17
20
|
*/
|
|
18
21
|
export declare enum TelemetryDataTag {
|
|
19
22
|
/**
|
|
@@ -25,22 +28,42 @@ export declare enum TelemetryDataTag {
|
|
|
25
28
|
*/
|
|
26
29
|
UserData = "UserData"
|
|
27
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
28
34
|
export type TelemetryEventPropertyTypes = ITelemetryBaseProperties[string];
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
29
38
|
export interface ITelemetryLoggerPropertyBag {
|
|
30
39
|
[index: string]: TelemetryEventPropertyTypes | (() => TelemetryEventPropertyTypes);
|
|
31
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
32
44
|
export interface ITelemetryLoggerPropertyBags {
|
|
33
45
|
all?: ITelemetryLoggerPropertyBag;
|
|
34
46
|
error?: ITelemetryLoggerPropertyBag;
|
|
35
47
|
}
|
|
36
48
|
/**
|
|
37
49
|
* Attempts to parse number from string.
|
|
38
|
-
* If fails,
|
|
50
|
+
* If it fails, it will return the original string.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
39
53
|
* Used to make telemetry data typed (and support math operations, like comparison),
|
|
40
|
-
* in places where we do expect numbers (like contentsize/duration property in http header)
|
|
54
|
+
* in places where we do expect numbers (like contentsize/duration property in http header).
|
|
55
|
+
*
|
|
56
|
+
* @internal
|
|
41
57
|
*/
|
|
42
58
|
export declare function numberFromString(str: string | null | undefined): string | number | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
43
62
|
export declare function formatTick(tick: number): number;
|
|
63
|
+
/**
|
|
64
|
+
* String used to concatenate the namespace of parent loggers and their child loggers.
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
44
67
|
export declare const eventNamespaceSeparator: ":";
|
|
45
68
|
/**
|
|
46
69
|
* TelemetryLogger class contains various helper telemetry methods,
|
|
@@ -50,6 +73,9 @@ export declare const eventNamespaceSeparator: ":";
|
|
|
50
73
|
export declare abstract class TelemetryLogger implements ITelemetryLoggerExt {
|
|
51
74
|
protected readonly namespace?: string | undefined;
|
|
52
75
|
protected readonly properties?: ITelemetryLoggerPropertyBags | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* {@inheritDoc eventNamespaceSeparator}
|
|
78
|
+
*/
|
|
53
79
|
static readonly eventNamespaceSeparator: ":";
|
|
54
80
|
static sanitizePkgName(name: string): string;
|
|
55
81
|
/**
|
|
@@ -109,6 +135,8 @@ export declare abstract class TelemetryLogger implements ITelemetryLoggerExt {
|
|
|
109
135
|
* @deprecated 0.56, remove TaggedLoggerAdapter once its usage is removed from
|
|
110
136
|
* container-runtime. Issue: #8191
|
|
111
137
|
* TaggedLoggerAdapter class can add tag handling to your logger.
|
|
138
|
+
*
|
|
139
|
+
* @internal
|
|
112
140
|
*/
|
|
113
141
|
export declare class TaggedLoggerAdapter implements ITelemetryBaseLogger {
|
|
114
142
|
private readonly logger;
|
|
@@ -119,11 +147,14 @@ export declare class TaggedLoggerAdapter implements ITelemetryBaseLogger {
|
|
|
119
147
|
send(eventWithTagsMaybe: ITelemetryBaseEvent): void;
|
|
120
148
|
}
|
|
121
149
|
/**
|
|
122
|
-
* Create a child logger based on the provided props object
|
|
123
|
-
* @param props - logger is the base logger the child will log to after it's processing, namespace will be prefixed to all event names, properties are default properties that will be applied events.
|
|
150
|
+
* Create a child logger based on the provided props object.
|
|
124
151
|
*
|
|
125
152
|
* @remarks
|
|
126
153
|
* Passing in no props object (i.e. undefined) will return a logger that is effectively a no-op.
|
|
154
|
+
*
|
|
155
|
+
* @param props - logger is the base logger the child will log to after it's processing, namespace will be prefixed to all event names, properties are default properties that will be applied events.
|
|
156
|
+
*
|
|
157
|
+
* @internal
|
|
127
158
|
*/
|
|
128
159
|
export declare function createChildLogger(props?: {
|
|
129
160
|
logger?: ITelemetryBaseLogger;
|
|
@@ -133,7 +164,7 @@ export declare function createChildLogger(props?: {
|
|
|
133
164
|
/**
|
|
134
165
|
* ChildLogger class contains various helper telemetry methods,
|
|
135
166
|
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
136
|
-
* Creates sub-logger that appends properties to all events
|
|
167
|
+
* Creates sub-logger that appends properties to all events.
|
|
137
168
|
*/
|
|
138
169
|
export declare class ChildLogger extends TelemetryLogger {
|
|
139
170
|
protected readonly baseLogger: ITelemetryBaseLogger;
|
|
@@ -156,16 +187,34 @@ export declare class ChildLogger extends TelemetryLogger {
|
|
|
156
187
|
send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
|
|
157
188
|
}
|
|
158
189
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
190
|
+
* Input properties for {@link createMultiSinkLogger}.
|
|
191
|
+
*
|
|
192
|
+
* @internal
|
|
162
193
|
*/
|
|
163
|
-
export
|
|
194
|
+
export interface MultiSinkLoggerProperties {
|
|
195
|
+
/**
|
|
196
|
+
* Will be prefixed to all event names.
|
|
197
|
+
*/
|
|
164
198
|
namespace?: string;
|
|
199
|
+
/**
|
|
200
|
+
* Default properties that will be applied to all events flowing through this logger.
|
|
201
|
+
*/
|
|
165
202
|
properties?: ITelemetryLoggerPropertyBags;
|
|
203
|
+
/**
|
|
204
|
+
* The base loggers that this logger will forward the logs to, after it processes them.
|
|
205
|
+
*/
|
|
166
206
|
loggers?: (ITelemetryBaseLogger | undefined)[];
|
|
207
|
+
/**
|
|
208
|
+
* If true, the logger will attempt to copy the custom properties (if they are of a known type, i.e. one from this package) of all the base loggers passed to it, to apply them itself to logs that flow through.
|
|
209
|
+
*/
|
|
167
210
|
tryInheritProperties?: true;
|
|
168
|
-
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Create a logger which logs to multiple other loggers based on the provided props object.
|
|
214
|
+
*
|
|
215
|
+
* @internal
|
|
216
|
+
*/
|
|
217
|
+
export declare function createMultiSinkLogger(props: MultiSinkLoggerProperties): ITelemetryLoggerExt;
|
|
169
218
|
/**
|
|
170
219
|
* Multi-sink logger
|
|
171
220
|
* Takes multiple ITelemetryBaseLogger objects (sinks) and logs all events into each sink
|
|
@@ -196,10 +245,15 @@ export declare class MultiSinkLogger extends TelemetryLogger {
|
|
|
196
245
|
send(event: ITelemetryBaseEvent): void;
|
|
197
246
|
}
|
|
198
247
|
/**
|
|
199
|
-
* Describes what events PerformanceEvent should log
|
|
200
|
-
*
|
|
201
|
-
*
|
|
248
|
+
* Describes what events {@link PerformanceEvent} should log.
|
|
249
|
+
*
|
|
250
|
+
* @remarks
|
|
251
|
+
* By default, all events are logged, but the client can override this behavior.
|
|
252
|
+
*
|
|
253
|
+
* For example, there is rarely a need to record a start event, as we're really after
|
|
202
254
|
* success / failure tracking, including duration (on success).
|
|
255
|
+
*
|
|
256
|
+
* @internal
|
|
203
257
|
*/
|
|
204
258
|
export interface IPerformanceEventMarkers {
|
|
205
259
|
start?: true;
|
|
@@ -207,7 +261,9 @@ export interface IPerformanceEventMarkers {
|
|
|
207
261
|
cancel?: "generic" | "error";
|
|
208
262
|
}
|
|
209
263
|
/**
|
|
210
|
-
* Helper class to log performance events
|
|
264
|
+
* Helper class to log performance events.
|
|
265
|
+
*
|
|
266
|
+
* @internal
|
|
211
267
|
*/
|
|
212
268
|
export declare class PerformanceEvent {
|
|
213
269
|
private readonly logger;
|
|
@@ -278,10 +334,13 @@ export declare class PerformanceEvent {
|
|
|
278
334
|
}
|
|
279
335
|
/**
|
|
280
336
|
* Null logger that no-ops for all telemetry events passed to it.
|
|
337
|
+
*
|
|
281
338
|
* @deprecated This will be removed in a future release.
|
|
282
339
|
* For internal use within the FluidFramework codebase, use {@link createChildLogger} with no arguments instead.
|
|
283
340
|
* For external consumers we recommend writing a trivial implementation of {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}
|
|
284
341
|
* where the send() method does nothing and using that.
|
|
342
|
+
*
|
|
343
|
+
* @internal
|
|
285
344
|
*/
|
|
286
345
|
export declare class TelemetryNullLogger implements ITelemetryLoggerExt {
|
|
287
346
|
send(event: ITelemetryBaseEvent): void;
|
|
@@ -299,6 +358,28 @@ export declare class TelemetryNullLogger implements ITelemetryLoggerExt {
|
|
|
299
358
|
* @param x - value passed in to convert to a base property type
|
|
300
359
|
*/
|
|
301
360
|
export declare function convertToBasePropertyType(x: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>): TelemetryEventPropertyType | Tagged<TelemetryEventPropertyType>;
|
|
361
|
+
/**
|
|
362
|
+
* Tags all given `values` with the same `tag`.
|
|
363
|
+
*
|
|
364
|
+
* @param tag - The tag with which all `values` will be annotated.
|
|
365
|
+
* @param values - The values to be tagged.
|
|
366
|
+
*
|
|
367
|
+
* @remarks
|
|
368
|
+
* It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
|
|
369
|
+
* as well as callbacks that return that type.
|
|
370
|
+
*
|
|
371
|
+
* @example Sample usage
|
|
372
|
+
* ```typescript
|
|
373
|
+
* {
|
|
374
|
+
* // ...Other properties being added to a telemetry event
|
|
375
|
+
* ...tagData("someTag", {foo: 1, bar: 2}),
|
|
376
|
+
* // ...
|
|
377
|
+
* }
|
|
378
|
+
* ```
|
|
379
|
+
* This will result in `foo` and `bar` added to the event with their values tagged.
|
|
380
|
+
*
|
|
381
|
+
* @internal
|
|
382
|
+
*/
|
|
302
383
|
export declare const tagData: <T extends TelemetryDataTag, V extends Record<string, import("@fluidframework/core-interfaces").TelemetryEventPropertyType | (() => TelemetryBaseEventPropertyType)>>(tag: T, values: V) => { [P in keyof V]: (V[P] extends () => TelemetryBaseEventPropertyType ? () => {
|
|
303
384
|
value: ReturnType<V[P]>;
|
|
304
385
|
tag: T;
|
|
@@ -307,8 +388,27 @@ export declare const tagData: <T extends TelemetryDataTag, V extends Record<stri
|
|
|
307
388
|
tag: T;
|
|
308
389
|
}) | (V[P] extends undefined ? undefined : never); };
|
|
309
390
|
/**
|
|
310
|
-
*
|
|
311
|
-
*
|
|
391
|
+
* Tags all provided `values` as {@link TelemetryDataTag.CodeArtifact}.
|
|
392
|
+
*
|
|
393
|
+
* @param values - The values to be tagged.
|
|
394
|
+
*
|
|
395
|
+
* @remarks
|
|
396
|
+
* It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
|
|
397
|
+
* as well as callbacks that return that type.
|
|
398
|
+
*
|
|
399
|
+
* @example Sample usage
|
|
400
|
+
* ```typescript
|
|
401
|
+
* {
|
|
402
|
+
* // ...Other properties being added to a telemetry event
|
|
403
|
+
* ...tagCodeArtifacts("someTag", {foo: 1, bar: 2}),
|
|
404
|
+
* // ...
|
|
405
|
+
* }
|
|
406
|
+
* ```
|
|
407
|
+
* This will result in `foo` and `bar` added to the event with their values tagged as {@link TelemetryDataTag.CodeArtifact}.
|
|
408
|
+
*
|
|
409
|
+
* @see {@link tagData}
|
|
410
|
+
*
|
|
411
|
+
* @internal
|
|
312
412
|
*/
|
|
313
413
|
export declare const tagCodeArtifacts: <T extends Record<string, import("@fluidframework/core-interfaces").TelemetryEventPropertyType | (() => TelemetryBaseEventPropertyType)>>(values: T) => { [P in keyof T]: (T[P] extends () => TelemetryBaseEventPropertyType ? () => {
|
|
314
414
|
value: ReturnType<T[P]>;
|
package/dist/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,EAC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;SAG3C,iBAAiB,YAAY;;;SAI7B,iBAAiB,YAAY;oDAG6C,CAAC"}
|
package/dist/logger.js
CHANGED
|
@@ -11,7 +11,10 @@ const config_1 = require("./config");
|
|
|
11
11
|
const errorLogging_1 = require("./errorLogging");
|
|
12
12
|
/**
|
|
13
13
|
* Broad classifications to be applied to individual properties as they're prepared to be logged to telemetry.
|
|
14
|
-
*
|
|
14
|
+
*
|
|
15
|
+
* @privateRemarks Please do not modify existing entries, to maintain backwards compatibility.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
15
18
|
*/
|
|
16
19
|
var TelemetryDataTag;
|
|
17
20
|
(function (TelemetryDataTag) {
|
|
@@ -26,9 +29,13 @@ var TelemetryDataTag;
|
|
|
26
29
|
})(TelemetryDataTag || (exports.TelemetryDataTag = TelemetryDataTag = {}));
|
|
27
30
|
/**
|
|
28
31
|
* Attempts to parse number from string.
|
|
29
|
-
* If fails,
|
|
32
|
+
* If it fails, it will return the original string.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
30
35
|
* Used to make telemetry data typed (and support math operations, like comparison),
|
|
31
|
-
* in places where we do expect numbers (like contentsize/duration property in http header)
|
|
36
|
+
* in places where we do expect numbers (like contentsize/duration property in http header).
|
|
37
|
+
*
|
|
38
|
+
* @internal
|
|
32
39
|
*/
|
|
33
40
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
34
41
|
function numberFromString(str) {
|
|
@@ -39,10 +46,19 @@ function numberFromString(str) {
|
|
|
39
46
|
return Number.isNaN(num) ? str : num;
|
|
40
47
|
}
|
|
41
48
|
exports.numberFromString = numberFromString;
|
|
49
|
+
// TODO: add docs
|
|
50
|
+
// eslint-disable-next-line jsdoc/require-description
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
42
54
|
function formatTick(tick) {
|
|
43
55
|
return Math.floor(tick);
|
|
44
56
|
}
|
|
45
57
|
exports.formatTick = formatTick;
|
|
58
|
+
/**
|
|
59
|
+
* String used to concatenate the namespace of parent loggers and their child loggers.
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
46
62
|
exports.eventNamespaceSeparator = ":";
|
|
47
63
|
/**
|
|
48
64
|
* TelemetryLogger class contains various helper telemetry methods,
|
|
@@ -183,11 +199,16 @@ class TelemetryLogger {
|
|
|
183
199
|
}
|
|
184
200
|
}
|
|
185
201
|
exports.TelemetryLogger = TelemetryLogger;
|
|
202
|
+
/**
|
|
203
|
+
* {@inheritDoc eventNamespaceSeparator}
|
|
204
|
+
*/
|
|
186
205
|
TelemetryLogger.eventNamespaceSeparator = exports.eventNamespaceSeparator;
|
|
187
206
|
/**
|
|
188
207
|
* @deprecated 0.56, remove TaggedLoggerAdapter once its usage is removed from
|
|
189
208
|
* container-runtime. Issue: #8191
|
|
190
209
|
* TaggedLoggerAdapter class can add tag handling to your logger.
|
|
210
|
+
*
|
|
211
|
+
* @internal
|
|
191
212
|
*/
|
|
192
213
|
class TaggedLoggerAdapter {
|
|
193
214
|
constructor(logger) {
|
|
@@ -238,11 +259,14 @@ class TaggedLoggerAdapter {
|
|
|
238
259
|
}
|
|
239
260
|
exports.TaggedLoggerAdapter = TaggedLoggerAdapter;
|
|
240
261
|
/**
|
|
241
|
-
* Create a child logger based on the provided props object
|
|
242
|
-
* @param props - logger is the base logger the child will log to after it's processing, namespace will be prefixed to all event names, properties are default properties that will be applied events.
|
|
262
|
+
* Create a child logger based on the provided props object.
|
|
243
263
|
*
|
|
244
264
|
* @remarks
|
|
245
265
|
* Passing in no props object (i.e. undefined) will return a logger that is effectively a no-op.
|
|
266
|
+
*
|
|
267
|
+
* @param props - logger is the base logger the child will log to after it's processing, namespace will be prefixed to all event names, properties are default properties that will be applied events.
|
|
268
|
+
*
|
|
269
|
+
* @internal
|
|
246
270
|
*/
|
|
247
271
|
function createChildLogger(props) {
|
|
248
272
|
return ChildLogger.create(props?.logger, props?.namespace, props?.properties);
|
|
@@ -251,7 +275,7 @@ exports.createChildLogger = createChildLogger;
|
|
|
251
275
|
/**
|
|
252
276
|
* ChildLogger class contains various helper telemetry methods,
|
|
253
277
|
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
254
|
-
* Creates sub-logger that appends properties to all events
|
|
278
|
+
* Creates sub-logger that appends properties to all events.
|
|
255
279
|
*/
|
|
256
280
|
class ChildLogger extends TelemetryLogger {
|
|
257
281
|
/**
|
|
@@ -326,9 +350,9 @@ class ChildLogger extends TelemetryLogger {
|
|
|
326
350
|
}
|
|
327
351
|
exports.ChildLogger = ChildLogger;
|
|
328
352
|
/**
|
|
329
|
-
* Create a logger which logs to multiple other loggers based on the provided props object
|
|
330
|
-
*
|
|
331
|
-
*
|
|
353
|
+
* Create a logger which logs to multiple other loggers based on the provided props object.
|
|
354
|
+
*
|
|
355
|
+
* @internal
|
|
332
356
|
*/
|
|
333
357
|
function createMultiSinkLogger(props) {
|
|
334
358
|
return new MultiSinkLogger(props.namespace, props.properties, props.loggers?.filter((l) => l !== undefined), props.tryInheritProperties);
|
|
@@ -404,7 +428,9 @@ class MultiSinkLogger extends TelemetryLogger {
|
|
|
404
428
|
}
|
|
405
429
|
exports.MultiSinkLogger = MultiSinkLogger;
|
|
406
430
|
/**
|
|
407
|
-
* Helper class to log performance events
|
|
431
|
+
* Helper class to log performance events.
|
|
432
|
+
*
|
|
433
|
+
* @internal
|
|
408
434
|
*/
|
|
409
435
|
class PerformanceEvent {
|
|
410
436
|
/**
|
|
@@ -568,10 +594,13 @@ exports.PerformanceEvent = PerformanceEvent;
|
|
|
568
594
|
PerformanceEvent.eventHits = new Map();
|
|
569
595
|
/**
|
|
570
596
|
* Null logger that no-ops for all telemetry events passed to it.
|
|
597
|
+
*
|
|
571
598
|
* @deprecated This will be removed in a future release.
|
|
572
599
|
* For internal use within the FluidFramework codebase, use {@link createChildLogger} with no arguments instead.
|
|
573
600
|
* For external consumers we recommend writing a trivial implementation of {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}
|
|
574
601
|
* where the send() method does nothing and using that.
|
|
602
|
+
*
|
|
603
|
+
* @internal
|
|
575
604
|
*/
|
|
576
605
|
class TelemetryNullLogger {
|
|
577
606
|
send(event) { }
|
|
@@ -629,6 +658,28 @@ function convertToBasePropertyTypeUntagged(x) {
|
|
|
629
658
|
}
|
|
630
659
|
}
|
|
631
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* Tags all given `values` with the same `tag`.
|
|
663
|
+
*
|
|
664
|
+
* @param tag - The tag with which all `values` will be annotated.
|
|
665
|
+
* @param values - The values to be tagged.
|
|
666
|
+
*
|
|
667
|
+
* @remarks
|
|
668
|
+
* It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
|
|
669
|
+
* as well as callbacks that return that type.
|
|
670
|
+
*
|
|
671
|
+
* @example Sample usage
|
|
672
|
+
* ```typescript
|
|
673
|
+
* {
|
|
674
|
+
* // ...Other properties being added to a telemetry event
|
|
675
|
+
* ...tagData("someTag", {foo: 1, bar: 2}),
|
|
676
|
+
* // ...
|
|
677
|
+
* }
|
|
678
|
+
* ```
|
|
679
|
+
* This will result in `foo` and `bar` added to the event with their values tagged.
|
|
680
|
+
*
|
|
681
|
+
* @internal
|
|
682
|
+
*/
|
|
632
683
|
const tagData = (tag, values) =>
|
|
633
684
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
634
685
|
Object.entries(values)
|
|
@@ -651,8 +702,27 @@ Object.entries(values)
|
|
|
651
702
|
}, {});
|
|
652
703
|
exports.tagData = tagData;
|
|
653
704
|
/**
|
|
654
|
-
*
|
|
655
|
-
*
|
|
705
|
+
* Tags all provided `values` as {@link TelemetryDataTag.CodeArtifact}.
|
|
706
|
+
*
|
|
707
|
+
* @param values - The values to be tagged.
|
|
708
|
+
*
|
|
709
|
+
* @remarks
|
|
710
|
+
* It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
|
|
711
|
+
* as well as callbacks that return that type.
|
|
712
|
+
*
|
|
713
|
+
* @example Sample usage
|
|
714
|
+
* ```typescript
|
|
715
|
+
* {
|
|
716
|
+
* // ...Other properties being added to a telemetry event
|
|
717
|
+
* ...tagCodeArtifacts("someTag", {foo: 1, bar: 2}),
|
|
718
|
+
* // ...
|
|
719
|
+
* }
|
|
720
|
+
* ```
|
|
721
|
+
* This will result in `foo` and `bar` added to the event with their values tagged as {@link TelemetryDataTag.CodeArtifact}.
|
|
722
|
+
*
|
|
723
|
+
* @see {@link tagData}
|
|
724
|
+
*
|
|
725
|
+
* @internal
|
|
656
726
|
*/
|
|
657
727
|
const tagCodeArtifacts = (values) => (0, exports.tagData)(TelemetryDataTag.CodeArtifact, values);
|
|
658
728
|
exports.tagCodeArtifacts = tagCodeArtifacts;
|