@fluidframework/telemetry-utils 1.2.6 → 2.0.0-dev.1.3.0.96595

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.
Files changed (70) hide show
  1. package/.mocharc.js +12 -0
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +2 -7
  4. package/dist/config.js.map +1 -1
  5. package/dist/errorLogging.d.ts +10 -1
  6. package/dist/errorLogging.d.ts.map +1 -1
  7. package/dist/errorLogging.js +75 -31
  8. package/dist/errorLogging.js.map +1 -1
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/logger.d.ts +1 -6
  14. package/dist/logger.d.ts.map +1 -1
  15. package/dist/logger.js +4 -8
  16. package/dist/logger.js.map +1 -1
  17. package/dist/mockLogger.d.ts +2 -0
  18. package/dist/mockLogger.d.ts.map +1 -1
  19. package/dist/mockLogger.js +12 -0
  20. package/dist/mockLogger.js.map +1 -1
  21. package/dist/packageVersion.d.ts +1 -1
  22. package/dist/packageVersion.d.ts.map +1 -1
  23. package/dist/packageVersion.js +1 -1
  24. package/dist/packageVersion.js.map +1 -1
  25. package/dist/sampledTelemetryHelper.d.ts +53 -0
  26. package/dist/sampledTelemetryHelper.d.ts.map +1 -0
  27. package/dist/sampledTelemetryHelper.js +92 -0
  28. package/dist/sampledTelemetryHelper.js.map +1 -0
  29. package/dist/thresholdCounter.d.ts +1 -1
  30. package/dist/thresholdCounter.js +1 -1
  31. package/dist/thresholdCounter.js.map +1 -1
  32. package/lib/config.d.ts.map +1 -1
  33. package/lib/config.js +2 -7
  34. package/lib/config.js.map +1 -1
  35. package/lib/errorLogging.d.ts +10 -1
  36. package/lib/errorLogging.d.ts.map +1 -1
  37. package/lib/errorLogging.js +74 -30
  38. package/lib/errorLogging.js.map +1 -1
  39. package/lib/index.d.ts +1 -0
  40. package/lib/index.d.ts.map +1 -1
  41. package/lib/index.js +1 -0
  42. package/lib/index.js.map +1 -1
  43. package/lib/logger.d.ts +1 -6
  44. package/lib/logger.d.ts.map +1 -1
  45. package/lib/logger.js +4 -8
  46. package/lib/logger.js.map +1 -1
  47. package/lib/mockLogger.d.ts +2 -0
  48. package/lib/mockLogger.d.ts.map +1 -1
  49. package/lib/mockLogger.js +12 -0
  50. package/lib/mockLogger.js.map +1 -1
  51. package/lib/packageVersion.d.ts +1 -1
  52. package/lib/packageVersion.d.ts.map +1 -1
  53. package/lib/packageVersion.js +1 -1
  54. package/lib/packageVersion.js.map +1 -1
  55. package/lib/sampledTelemetryHelper.d.ts +53 -0
  56. package/lib/sampledTelemetryHelper.d.ts.map +1 -0
  57. package/lib/sampledTelemetryHelper.js +88 -0
  58. package/lib/sampledTelemetryHelper.js.map +1 -0
  59. package/lib/thresholdCounter.d.ts +1 -1
  60. package/lib/thresholdCounter.js +1 -1
  61. package/lib/thresholdCounter.js.map +1 -1
  62. package/package.json +21 -10
  63. package/src/config.ts +2 -4
  64. package/src/errorLogging.ts +77 -30
  65. package/src/index.ts +1 -0
  66. package/src/logger.ts +4 -8
  67. package/src/mockLogger.ts +13 -0
  68. package/src/packageVersion.ts +1 -1
  69. package/src/sampledTelemetryHelper.ts +142 -0
  70. package/src/thresholdCounter.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAcH,+DAAoF;AACpF,qCAIkB;AAClB,iDAIwB;AAExB;;;GAGG;AACH,IAAY,gBAUX;AAVD,WAAY,gBAAgB;IACxB;;;OAGG;IACH,+CAA2B,CAAA;IAC3B,4FAA4F;IAC5F,iDAA6B,CAAA;IAC7B,8EAA8E;IAC9E,yCAAqB,CAAA;AACzB,CAAC,EAVW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAU3B;AAYD;;;;GAIG;AACH,MAAsB,eAAe;IAyDjC,YACuB,SAAk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;IACM,eAAe,CAAC,SAAiB,EAAE,KAAU;QAChD,IAAI,CAAC,WAAW,CAAC,4BAA4B,EAAE,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;IACM,YAAY,CAAC,KAA2B,EAAE,SAAc;QAC3D,IAAI,CAAC,WAAW,CAAC,yBAAyB,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC;IACM,WAAW,CAAC,SAAkB,EAAE,KAA4B;QAC/D,IAAI,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;IAClD,CAAC;IACM,UAAU,CAAC,SAAkB,EAAE,KAA4B;QAC9D,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;IACjD,CAAC;IAEO,WAAW,CAAC,OAAe,EAAE,KAA4B,EAAE,GAAS;QACxE,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAChC,KAAa,CAAC,KAAK,GAAG,KAAK,CAAC;QAC5B,KAAa,CAAC,KAAK,GAAG,KAAK,CAAC;QAC7B,8CAA8C;QAC9C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,KAAK,CAAC;IAChB,CAAC;CACJ;AAhCA,8CAgCA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ITelemetryBaseEvent,\n ITelemetryBaseLogger,\n ITelemetryErrorEvent,\n ITelemetryGenericEvent,\n ITelemetryLogger,\n ITelemetryPerformanceEvent,\n ITelemetryProperties,\n TelemetryEventPropertyType,\n ITaggedTelemetryPropertyType,\n TelemetryEventCategory,\n} from \"@fluidframework/common-definitions\";\nimport { BaseTelemetryNullLogger, performance } from \"@fluidframework/common-utils\";\nimport {\n CachedConfigProvider,\n loggerIsMonitoringContext,\n mixinMonitoringContext,\n} from \"./config\";\nimport {\n isILoggingError,\n extractLogSafeErrorProperties,\n generateStack,\n} from \"./errorLogging\";\n\n/**\n * Broad classifications to be applied to individual properties as they're prepared to be logged to telemetry.\n * Please do not modify existing entries for backwards compatibility.\n */\nexport enum TelemetryDataTag {\n /**\n * Data containing terms from code packages that may have been dynamically loaded\n * @deprecated 1.0, will be removed in next release (see issue #6603). Use `TelemetryDataTag.CodeArtifact` instead.\n */\n PackageData = \"PackageData\",\n /** Data containing terms or IDs from code packages that may have been dynamically loaded */\n CodeArtifact = \"CodeArtifact\",\n /** Personal data of a variety of classifications that pertains to the user */\n UserData = \"UserData\",\n}\n\nexport type TelemetryEventPropertyTypes = TelemetryEventPropertyType | ITaggedTelemetryPropertyType;\n\nexport interface ITelemetryLoggerPropertyBag {\n [index: string]: TelemetryEventPropertyTypes | (() => TelemetryEventPropertyTypes);\n}\nexport interface ITelemetryLoggerPropertyBags{\n all?: ITelemetryLoggerPropertyBag;\n error?: ITelemetryLoggerPropertyBag;\n}\n\n/**\n * TelemetryLogger class contains various helper telemetry methods,\n * encoding in one place schemas for various types of Fluid telemetry events.\n * Creates sub-logger that appends properties to all events\n */\nexport abstract class TelemetryLogger implements ITelemetryLogger {\n public static readonly eventNamespaceSeparator = \":\";\n\n public static formatTick(tick: number): number {\n return Math.floor(tick);\n }\n\n /**\n * Attempts to parse number from string.\n * If fails,returns original string.\n * Used to make telemetry data typed (and support math operations, like comparison),\n * in places where we do expect numbers (like contentsize/duration property in http header)\n */\n public static numberFromString(str: string | null | undefined): string | number | undefined {\n if (str === undefined || str === null) {\n return undefined;\n }\n const num = Number(str);\n return Number.isNaN(num) ? str : num;\n }\n\n public static sanitizePkgName(name: string) {\n return name.replace(\"@\", \"\").replace(\"/\", \"-\");\n }\n\n /**\n * Take an unknown error object and add the appropriate info from it to the event. Message and stack will be copied\n * over from the error object, along with other telemetry properties if it's an ILoggingError.\n * @param event - Event being logged\n * @param error - Error to extract info from\n * @param fetchStack - Whether to fetch the current callstack if error.stack is undefined\n */\n public static prepareErrorObject(event: ITelemetryBaseEvent, error: any, fetchStack: boolean) {\n const { message, errorType, stack } = extractLogSafeErrorProperties(error, true /* sanitizeStack */);\n // First, copy over error message, stack, and errorType directly (overwrite if present on event)\n event.stack = stack;\n event.error = message; // Note that the error message goes on the 'error' field\n event.errorType = errorType;\n\n if (isILoggingError(error)) {\n // Add any other telemetry properties from the LoggingError\n const telemetryProp = error.getTelemetryProperties();\n for (const key of Object.keys(telemetryProp)) {\n if (event[key] !== undefined) {\n // Don't overwrite existing properties on the event\n continue;\n }\n event[key] = telemetryProp[key];\n }\n }\n\n // Collect stack if we were not able to extract it from error\n if (event.stack === undefined && fetchStack) {\n event.stack = generateStack();\n }\n }\n\n public constructor(\n protected readonly namespace?: string,\n protected readonly properties?: ITelemetryLoggerPropertyBags) {\n }\n\n /**\n * Send an event with the logger\n *\n * @param event - the event to send\n */\n public abstract send(event: ITelemetryBaseEvent): void;\n\n /**\n * Send a telemetry event with the logger\n *\n * @param event - the event to send\n * @param error - optional error object to log\n */\n public sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any) {\n this.sendTelemetryEventCore({ ...event, category: event.category ?? \"generic\" }, error);\n }\n\n /**\n * Send a telemetry event with the logger\n *\n * @param event - the event to send\n * @param error - optional error object to log\n */\n protected sendTelemetryEventCore(\n event: ITelemetryGenericEvent & { category: TelemetryEventCategory; },\n error?: any) {\n const newEvent = { ...event };\n if (error !== undefined) {\n TelemetryLogger.prepareErrorObject(newEvent, error, false);\n }\n\n // Will include Nan & Infinity, but probably we do not care\n if (typeof newEvent.duration === \"number\") {\n newEvent.duration = TelemetryLogger.formatTick(newEvent.duration);\n }\n\n this.send(newEvent);\n }\n\n /**\n * Send an error telemetry event with the logger\n *\n * @param event - the event to send\n * @param error - optional error object to log\n */\n public sendErrorEvent(event: ITelemetryErrorEvent, error?: any) {\n this.sendTelemetryEventCore({\n // ensure the error field has some value,\n // this can and will be overridden by event, or error\n error: event.eventName,\n ...event,\n category: \"error\",\n }, error);\n }\n\n /**\n * Send a performance telemetry event with the logger\n *\n * @param event - Event to send\n * @param error - optional error object to log\n */\n public sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void {\n const perfEvent = {\n ...event,\n category: event.category ?? \"performance\",\n };\n\n this.sendTelemetryEventCore(perfEvent, error);\n }\n\n protected prepareEvent(event: ITelemetryBaseEvent): ITelemetryBaseEvent {\n const includeErrorProps = event.category === \"error\" || event.error !== undefined;\n const newEvent: ITelemetryBaseEvent = {\n ...event,\n };\n if (this.namespace !== undefined) {\n newEvent.eventName = `${this.namespace}${TelemetryLogger.eventNamespaceSeparator}${newEvent.eventName}`;\n }\n if (this.properties) {\n const properties: (undefined | ITelemetryLoggerPropertyBag)[] = [];\n properties.push(this.properties.all);\n if (includeErrorProps) {\n properties.push(this.properties.error);\n }\n for (const props of properties) {\n if (props !== undefined) {\n for (const key of Object.keys(props)) {\n if (event[key] !== undefined) {\n continue;\n }\n const getterOrValue = props[key];\n // If this throws, hopefully it is handled elsewhere\n const value = typeof getterOrValue === \"function\" ? getterOrValue() : getterOrValue;\n if (value !== undefined) {\n newEvent[key] = value;\n }\n }\n }\n }\n }\n return newEvent;\n }\n}\n\n/**\n * @deprecated 0.56, remove TaggedLoggerAdapter once its usage is removed from\n * container-runtime. Issue: #8191\n * TaggedLoggerAdapter class can add tag handling to your logger.\n */\n export class TaggedLoggerAdapter implements ITelemetryBaseLogger {\n public constructor(\n private readonly logger: ITelemetryBaseLogger) {\n }\n\n public send(eventWithTagsMaybe: ITelemetryBaseEvent) {\n const newEvent: ITelemetryBaseEvent = {\n category: eventWithTagsMaybe.category,\n eventName: eventWithTagsMaybe.eventName,\n };\n for (const key of Object.keys(eventWithTagsMaybe)) {\n const taggableProp = eventWithTagsMaybe[key];\n const { value, tag } = (typeof taggableProp === \"object\")\n ? taggableProp\n : { value: taggableProp, tag: undefined };\n switch (tag) {\n case undefined:\n // No tag means we can log plainly\n newEvent[key] = value;\n break;\n case TelemetryDataTag.PackageData:\n // For Microsoft applications, PackageData is safe for now\n // (we don't load 3P code in 1P apps)\n newEvent[key] = value;\n break;\n case TelemetryDataTag.UserData:\n // Strip out anything tagged explicitly as PII.\n // Alternate strategy would be to hash these props\n newEvent[key] = \"REDACTED (UserData)\";\n break;\n default:\n // If we encounter a tag we don't recognize\n // then we must assume we should scrub.\n newEvent[key] = \"REDACTED (unknown tag)\";\n break;\n }\n }\n this.logger.send(newEvent);\n }\n}\n\n/**\n * ChildLogger class contains various helper telemetry methods,\n * encoding in one place schemas for various types of Fluid telemetry events.\n * Creates sub-logger that appends properties to all events\n */\nexport class ChildLogger extends TelemetryLogger {\n /**\n * Create child logger\n * @param baseLogger - Base logger to use to output events. If undefined, proper child logger\n * is created, but it does not sends telemetry events anywhere.\n * @param namespace - Telemetry event name prefix to add to all events\n * @param properties - Base properties to add to all events\n * @param propertyGetters - Getters to add additional properties to all events\n */\n public static create(\n baseLogger?: ITelemetryBaseLogger,\n namespace?: string,\n properties?: ITelemetryLoggerPropertyBags): TelemetryLogger {\n // if we are creating a child of a child, rather than nest, which will increase\n // the callstack overhead, just generate a new logger that includes everything from the previous\n if (baseLogger instanceof ChildLogger) {\n const combinedProperties: ITelemetryLoggerPropertyBags = {};\n for (const extendedProps of [baseLogger.properties, properties]) {\n if (extendedProps !== undefined) {\n if (extendedProps.all !== undefined) {\n combinedProperties.all = {\n ... combinedProperties.all,\n ... extendedProps.all,\n };\n }\n if (extendedProps.error !== undefined) {\n combinedProperties.error = {\n ... combinedProperties.error,\n ... extendedProps.error,\n };\n }\n }\n }\n\n const combinedNamespace = baseLogger.namespace === undefined\n ? namespace\n : namespace === undefined\n ? baseLogger.namespace\n : `${baseLogger.namespace}${TelemetryLogger.eventNamespaceSeparator}${namespace}`;\n\n return new ChildLogger(\n baseLogger.baseLogger,\n combinedNamespace,\n combinedProperties,\n );\n }\n\n return new ChildLogger(\n baseLogger ? baseLogger : new BaseTelemetryNullLogger(),\n namespace,\n properties);\n }\n\n private constructor(\n protected readonly baseLogger: ITelemetryBaseLogger,\n namespace: string | undefined,\n properties: ITelemetryLoggerPropertyBags | undefined,\n ) {\n super(namespace, properties);\n\n // propagate the monitoring context\n if (loggerIsMonitoringContext(baseLogger)) {\n mixinMonitoringContext(\n this,\n new CachedConfigProvider(baseLogger.config));\n }\n }\n\n /**\n * Send an event with the logger\n *\n * @param event - the event to send\n */\n public send(event: ITelemetryBaseEvent): void {\n this.baseLogger.send(this.prepareEvent(event));\n }\n}\n\n/**\n * Multi-sink logger\n * Takes multiple ITelemetryBaseLogger objects (sinks) and logs all events into each sink\n * Implements ITelemetryBaseLogger (through static create() method)\n */\nexport class MultiSinkLogger extends TelemetryLogger {\n protected loggers: ITelemetryBaseLogger[] = [];\n\n /**\n * Create multiple sink logger (i.e. logger that sends events to multiple sinks)\n * @param namespace - Telemetry event name prefix to add to all events\n * @param properties - Base properties to add to all events\n * @param propertyGetters - Getters to add additional properties to all events\n */\n constructor(\n namespace?: string,\n properties?: ITelemetryLoggerPropertyBags) {\n super(namespace, properties);\n }\n\n /**\n * Add logger to send all events to\n * @param logger - Logger to add\n */\n public addLogger(logger?: ITelemetryBaseLogger) {\n if (logger !== undefined && logger !== null) {\n this.loggers.push(logger);\n }\n }\n\n /**\n * Send an event to the loggers\n *\n * @param event - the event to send to all the registered logger\n */\n public send(event: ITelemetryBaseEvent): void {\n const newEvent = this.prepareEvent(event);\n this.loggers.forEach((logger: ITelemetryBaseLogger) => {\n logger.send(newEvent);\n });\n }\n}\n\n/**\n * Describes what events PerformanceEvent should log\n * By default, all events are logged, but client can override this behavior\n * For example, there is rarely a need to record start event, as we really after\n * success / failure tracking, including duration (on success).\n */\nexport interface IPerformanceEventMarkers {\n start?: true;\n end?: true;\n cancel?: \"generic\" | \"error\"; // tells wether to issue \"generic\" or \"error\" category cancel event\n}\n\n/**\n * Helper class to log performance events\n */\nexport class PerformanceEvent {\n public static start(logger: ITelemetryLogger, event: ITelemetryGenericEvent, markers?: IPerformanceEventMarkers) {\n return new PerformanceEvent(logger, event, markers);\n }\n\n public static timedExec<T>(\n logger: ITelemetryLogger,\n event: ITelemetryGenericEvent,\n callback: (event: PerformanceEvent) => T,\n markers?: IPerformanceEventMarkers,\n ) {\n const perfEvent = PerformanceEvent.start(logger, event, markers);\n try {\n const ret = callback(perfEvent);\n perfEvent.autoEnd();\n return ret;\n } catch (error) {\n perfEvent.cancel(undefined, error);\n throw error;\n }\n }\n\n public static async timedExecAsync<T>(\n logger: ITelemetryLogger,\n event: ITelemetryGenericEvent,\n callback: (event: PerformanceEvent) => Promise<T>,\n markers?: IPerformanceEventMarkers,\n ) {\n const perfEvent = PerformanceEvent.start(logger, event, markers);\n try {\n const ret = await callback(perfEvent);\n perfEvent.autoEnd();\n return ret;\n } catch (error) {\n perfEvent.cancel(undefined, error);\n throw error;\n }\n }\n\n public get duration() { return performance.now() - this.startTime; }\n\n private event?: ITelemetryGenericEvent;\n private readonly startTime = performance.now();\n private startMark?: string;\n\n protected constructor(\n private readonly logger: ITelemetryLogger,\n event: ITelemetryGenericEvent,\n private readonly markers: IPerformanceEventMarkers = { end: true, cancel: \"generic\" },\n ) {\n this.event = { ...event };\n if (this.markers.start) {\n this.reportEvent(\"start\");\n }\n\n if (typeof window === \"object\" && window != null && window.performance) {\n this.startMark = `${event.eventName}-start`;\n window.performance.mark(this.startMark);\n }\n }\n\n public reportProgress(props?: ITelemetryProperties, eventNameSuffix: string = \"update\"): void {\n this.reportEvent(eventNameSuffix, props);\n }\n\n private autoEnd() {\n // Event might have been cancelled or ended in the callback\n if (this.event && this.markers.end) {\n this.reportEvent(\"end\");\n }\n this.performanceEndMark();\n this.event = undefined;\n }\n\n public end(props?: ITelemetryProperties): void {\n this.reportEvent(\"end\", props);\n this.performanceEndMark();\n this.event = undefined;\n }\n\n private performanceEndMark() {\n if (this.startMark && this.event) {\n const endMark = `${this.event.eventName}-end`;\n window.performance.mark(endMark);\n window.performance.measure(`${this.event.eventName}`, this.startMark, endMark);\n this.startMark = undefined;\n }\n }\n\n public cancel(props?: ITelemetryProperties, error?: any): void {\n if (this.markers.cancel !== undefined) {\n this.reportEvent(\"cancel\", { category: this.markers.cancel, ...props }, error);\n }\n this.event = undefined;\n }\n\n /**\n * Report the event, if it hasn't already been reported.\n */\n public reportEvent(eventNameSuffix: string, props?: ITelemetryProperties, error?: any) {\n // There are strange sequences involving multiple Promise chains\n // where the event can be cancelled and then later a callback is invoked\n // and the caller attempts to end directly, e.g. issue #3936. Just return.\n if (!this.event) {\n return;\n }\n\n const event: ITelemetryPerformanceEvent = { ...this.event, ...props };\n event.eventName = `${event.eventName}_${eventNameSuffix}`;\n if (eventNameSuffix !== \"start\") {\n event.duration = this.duration;\n }\n\n this.logger.sendPerformanceEvent(event, error);\n }\n}\n\n/**\n * Logger that is useful for UT\n * It can be used in places where logger instance is required, but events should be not send over.\n */\n export class TelemetryUTLogger implements ITelemetryLogger {\n public send(event: ITelemetryBaseEvent): void {\n }\n public sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any) {\n }\n public sendErrorEvent(event: ITelemetryErrorEvent, error?: any) {\n this.reportError(\"errorEvent in UT logger!\", event, error);\n }\n public sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void {\n }\n public logGenericError(eventName: string, error: any) {\n this.reportError(`genericError in UT logger!`, { eventName }, error);\n }\n public logException(event: ITelemetryErrorEvent, exception: any): void {\n this.reportError(\"exception in UT logger!\", event, exception);\n }\n public debugAssert(condition: boolean, event?: ITelemetryErrorEvent): void {\n this.reportError(\"debugAssert in UT logger!\");\n }\n public shipAssert(condition: boolean, event?: ITelemetryErrorEvent): void {\n this.reportError(\"shipAssert in UT logger!\");\n }\n\n private reportError(message: string, event?: ITelemetryErrorEvent, err?: any) {\n const error = new Error(message);\n (error as any).error = error;\n (error as any).event = event;\n // report to console as exception can be eaten\n console.error(message);\n console.error(error);\n throw error;\n }\n}\n"]}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA;;;GA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;IACnD,CAAC;CACJ;AAnHD,4CAmHC;AAED;;;GAGG;AACF,MAAa,iBAAiB;IACpB,IAAI,CAAC,KAA0B;IACtC,CAAC;IACM,kBAAkB,CAAC,KAA6B,EAAE,KAAW;IACpE,CAAC;IACM,cAAc,CAAC,KAA2B,EAAE,KAAW;QAC1D,IAAI,CAAC,WAAW,CAAC,0BAA0B,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC;IACM,oBAAoB,CAAC,KAAiC,EAAE,KAAW;IAC1E,CAAC;IACM,eAAe,CAAC,SAAiB,EAAE,KAAU;QAChD,IAAI,CAAC,WAAW,CAAC,4BAA4B,EAAE,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;IACM,YAAY,CAAC,KAA2B,EAAE,SAAc;QAC3D,IAAI,CAAC,WAAW,CAAC,yBAAyB,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC;IACM,WAAW,CAAC,SAAkB,EAAE,KAA4B;QAC/D,IAAI,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;IAClD,CAAC;IACM,UAAU,CAAC,SAAkB,EAAE,KAA4B;QAC9D,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;IACjD,CAAC;IAEO,WAAW,CAAC,OAAe,EAAE,KAA4B,EAAE,GAAS;QACxE,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAChC,KAAa,CAAC,KAAK,GAAG,KAAK,CAAC;QAC5B,KAAa,CAAC,KAAK,GAAG,KAAK,CAAC;QAC7B,8CAA8C;QAC9C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,KAAK,CAAC;IAChB,CAAC;CACJ;AAhCA,8CAgCA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ITelemetryBaseEvent,\n ITelemetryBaseLogger,\n ITelemetryErrorEvent,\n ITelemetryGenericEvent,\n ITelemetryLogger,\n ITelemetryPerformanceEvent,\n ITelemetryProperties,\n TelemetryEventPropertyType,\n ITaggedTelemetryPropertyType,\n TelemetryEventCategory,\n} from \"@fluidframework/common-definitions\";\nimport { BaseTelemetryNullLogger, performance } from \"@fluidframework/common-utils\";\nimport {\n CachedConfigProvider,\n loggerIsMonitoringContext,\n mixinMonitoringContext,\n} from \"./config\";\nimport {\n isILoggingError,\n extractLogSafeErrorProperties,\n generateStack,\n} from \"./errorLogging\";\n\n/**\n * Broad classifications to be applied to individual properties as they're prepared to be logged to telemetry.\n * Please do not modify existing entries for backwards compatibility.\n */\nexport enum TelemetryDataTag {\n /** Data containing terms or IDs from code packages that may have been dynamically loaded */\n CodeArtifact = \"CodeArtifact\",\n /** Personal data of a variety of classifications that pertains to the user */\n UserData = \"UserData\",\n}\n\nexport type TelemetryEventPropertyTypes = TelemetryEventPropertyType | ITaggedTelemetryPropertyType;\n\nexport interface ITelemetryLoggerPropertyBag {\n [index: string]: TelemetryEventPropertyTypes | (() => TelemetryEventPropertyTypes);\n}\nexport interface ITelemetryLoggerPropertyBags{\n all?: ITelemetryLoggerPropertyBag;\n error?: ITelemetryLoggerPropertyBag;\n}\n\n/**\n * TelemetryLogger class contains various helper telemetry methods,\n * encoding in one place schemas for various types of Fluid telemetry events.\n * Creates sub-logger that appends properties to all events\n */\nexport abstract class TelemetryLogger implements ITelemetryLogger {\n public static readonly eventNamespaceSeparator = \":\";\n\n public static formatTick(tick: number): number {\n return Math.floor(tick);\n }\n\n /**\n * Attempts to parse number from string.\n * If fails,returns original string.\n * Used to make telemetry data typed (and support math operations, like comparison),\n * in places where we do expect numbers (like contentsize/duration property in http header)\n */\n public static numberFromString(str: string | null | undefined): string | number | undefined {\n if (str === undefined || str === null) {\n return undefined;\n }\n const num = Number(str);\n return Number.isNaN(num) ? str : num;\n }\n\n public static sanitizePkgName(name: string) {\n return name.replace(\"@\", \"\").replace(\"/\", \"-\");\n }\n\n /**\n * Take an unknown error object and add the appropriate info from it to the event. Message and stack will be copied\n * over from the error object, along with other telemetry properties if it's an ILoggingError.\n * @param event - Event being logged\n * @param error - Error to extract info from\n * @param fetchStack - Whether to fetch the current callstack if error.stack is undefined\n */\n public static prepareErrorObject(event: ITelemetryBaseEvent, error: any, fetchStack: boolean) {\n const { message, errorType, stack } = extractLogSafeErrorProperties(error, true /* sanitizeStack */);\n // First, copy over error message, stack, and errorType directly (overwrite if present on event)\n event.stack = stack;\n event.error = message; // Note that the error message goes on the 'error' field\n event.errorType = errorType;\n\n if (isILoggingError(error)) {\n // Add any other telemetry properties from the LoggingError\n const telemetryProp = error.getTelemetryProperties();\n for (const key of Object.keys(telemetryProp)) {\n if (event[key] !== undefined) {\n // Don't overwrite existing properties on the event\n continue;\n }\n event[key] = telemetryProp[key];\n }\n }\n\n // Collect stack if we were not able to extract it from error\n if (event.stack === undefined && fetchStack) {\n event.stack = generateStack();\n }\n }\n\n public constructor(\n protected readonly namespace?: string,\n protected readonly properties?: ITelemetryLoggerPropertyBags) {\n }\n\n /**\n * Send an event with the logger\n *\n * @param event - the event to send\n */\n public abstract send(event: ITelemetryBaseEvent): void;\n\n /**\n * Send a telemetry event with the logger\n *\n * @param event - the event to send\n * @param error - optional error object to log\n */\n public sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any) {\n this.sendTelemetryEventCore({ ...event, category: event.category ?? \"generic\" }, error);\n }\n\n /**\n * Send a telemetry event with the logger\n *\n * @param event - the event to send\n * @param error - optional error object to log\n */\n protected sendTelemetryEventCore(\n event: ITelemetryGenericEvent & { category: TelemetryEventCategory; },\n error?: any) {\n const newEvent = { ...event };\n if (error !== undefined) {\n TelemetryLogger.prepareErrorObject(newEvent, error, false);\n }\n\n // Will include Nan & Infinity, but probably we do not care\n if (typeof newEvent.duration === \"number\") {\n newEvent.duration = TelemetryLogger.formatTick(newEvent.duration);\n }\n\n this.send(newEvent);\n }\n\n /**\n * Send an error telemetry event with the logger\n *\n * @param event - the event to send\n * @param error - optional error object to log\n */\n public sendErrorEvent(event: ITelemetryErrorEvent, error?: any) {\n this.sendTelemetryEventCore({\n // ensure the error field has some value,\n // this can and will be overridden by event, or error\n error: event.eventName,\n ...event,\n category: \"error\",\n }, error);\n }\n\n /**\n * Send a performance telemetry event with the logger\n *\n * @param event - Event to send\n * @param error - optional error object to log\n */\n public sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void {\n const perfEvent = {\n ...event,\n category: event.category ?? \"performance\",\n };\n\n this.sendTelemetryEventCore(perfEvent, error);\n }\n\n protected prepareEvent(event: ITelemetryBaseEvent): ITelemetryBaseEvent {\n const includeErrorProps = event.category === \"error\" || event.error !== undefined;\n const newEvent: ITelemetryBaseEvent = {\n ...event,\n };\n if (this.namespace !== undefined) {\n newEvent.eventName = `${this.namespace}${TelemetryLogger.eventNamespaceSeparator}${newEvent.eventName}`;\n }\n if (this.properties) {\n const properties: (undefined | ITelemetryLoggerPropertyBag)[] = [];\n properties.push(this.properties.all);\n if (includeErrorProps) {\n properties.push(this.properties.error);\n }\n for (const props of properties) {\n if (props !== undefined) {\n for (const key of Object.keys(props)) {\n if (event[key] !== undefined) {\n continue;\n }\n const getterOrValue = props[key];\n // If this throws, hopefully it is handled elsewhere\n const value = typeof getterOrValue === \"function\" ? getterOrValue() : getterOrValue;\n if (value !== undefined) {\n newEvent[key] = value;\n }\n }\n }\n }\n }\n return newEvent;\n }\n}\n\n/**\n * @deprecated 0.56, remove TaggedLoggerAdapter once its usage is removed from\n * container-runtime. Issue: #8191\n * TaggedLoggerAdapter class can add tag handling to your logger.\n */\n export class TaggedLoggerAdapter implements ITelemetryBaseLogger {\n public constructor(\n private readonly logger: ITelemetryBaseLogger) {\n }\n\n public send(eventWithTagsMaybe: ITelemetryBaseEvent) {\n const newEvent: ITelemetryBaseEvent = {\n category: eventWithTagsMaybe.category,\n eventName: eventWithTagsMaybe.eventName,\n };\n for (const key of Object.keys(eventWithTagsMaybe)) {\n const taggableProp = eventWithTagsMaybe[key];\n const { value, tag } = (typeof taggableProp === \"object\")\n ? taggableProp\n : { value: taggableProp, tag: undefined };\n switch (tag) {\n case undefined:\n // No tag means we can log plainly\n newEvent[key] = value;\n break;\n case \"PackageData\": // For back-compat\n case TelemetryDataTag.CodeArtifact:\n // For Microsoft applications, CodeArtifact is safe for now\n // (we don't load 3P code in 1P apps)\n newEvent[key] = value;\n break;\n case TelemetryDataTag.UserData:\n // Strip out anything tagged explicitly as PII.\n // Alternate strategy would be to hash these props\n newEvent[key] = \"REDACTED (UserData)\";\n break;\n default:\n // If we encounter a tag we don't recognize\n // then we must assume we should scrub.\n newEvent[key] = \"REDACTED (unknown tag)\";\n break;\n }\n }\n this.logger.send(newEvent);\n }\n}\n\n/**\n * ChildLogger class contains various helper telemetry methods,\n * encoding in one place schemas for various types of Fluid telemetry events.\n * Creates sub-logger that appends properties to all events\n */\nexport class ChildLogger extends TelemetryLogger {\n /**\n * Create child logger\n * @param baseLogger - Base logger to use to output events. If undefined, proper child logger\n * is created, but it does not send telemetry events anywhere.\n * @param namespace - Telemetry event name prefix to add to all events\n * @param properties - Base properties to add to all events\n * @param propertyGetters - Getters to add additional properties to all events\n */\n public static create(\n baseLogger?: ITelemetryBaseLogger,\n namespace?: string,\n properties?: ITelemetryLoggerPropertyBags): TelemetryLogger {\n // if we are creating a child of a child, rather than nest, which will increase\n // the callstack overhead, just generate a new logger that includes everything from the previous\n if (baseLogger instanceof ChildLogger) {\n const combinedProperties: ITelemetryLoggerPropertyBags = {};\n for (const extendedProps of [baseLogger.properties, properties]) {\n if (extendedProps !== undefined) {\n if (extendedProps.all !== undefined) {\n combinedProperties.all = {\n ... combinedProperties.all,\n ... extendedProps.all,\n };\n }\n if (extendedProps.error !== undefined) {\n combinedProperties.error = {\n ... combinedProperties.error,\n ... extendedProps.error,\n };\n }\n }\n }\n\n const combinedNamespace = baseLogger.namespace === undefined\n ? namespace\n : namespace === undefined\n ? baseLogger.namespace\n : `${baseLogger.namespace}${TelemetryLogger.eventNamespaceSeparator}${namespace}`;\n\n return new ChildLogger(\n baseLogger.baseLogger,\n combinedNamespace,\n combinedProperties,\n );\n }\n\n return new ChildLogger(\n baseLogger ? baseLogger : new BaseTelemetryNullLogger(),\n namespace,\n properties);\n }\n\n private constructor(\n protected readonly baseLogger: ITelemetryBaseLogger,\n namespace: string | undefined,\n properties: ITelemetryLoggerPropertyBags | undefined,\n ) {\n super(namespace, properties);\n\n // propagate the monitoring context\n if (loggerIsMonitoringContext(baseLogger)) {\n mixinMonitoringContext(\n this,\n new CachedConfigProvider(baseLogger.config));\n }\n }\n\n /**\n * Send an event with the logger\n *\n * @param event - the event to send\n */\n public send(event: ITelemetryBaseEvent): void {\n this.baseLogger.send(this.prepareEvent(event));\n }\n}\n\n/**\n * Multi-sink logger\n * Takes multiple ITelemetryBaseLogger objects (sinks) and logs all events into each sink\n * Implements ITelemetryBaseLogger (through static create() method)\n */\nexport class MultiSinkLogger extends TelemetryLogger {\n protected loggers: ITelemetryBaseLogger[] = [];\n\n /**\n * Create multiple sink logger (i.e. logger that sends events to multiple sinks)\n * @param namespace - Telemetry event name prefix to add to all events\n * @param properties - Base properties to add to all events\n * @param propertyGetters - Getters to add additional properties to all events\n */\n constructor(\n namespace?: string,\n properties?: ITelemetryLoggerPropertyBags) {\n super(namespace, properties);\n }\n\n /**\n * Add logger to send all events to\n * @param logger - Logger to add\n */\n public addLogger(logger?: ITelemetryBaseLogger) {\n if (logger !== undefined && logger !== null) {\n this.loggers.push(logger);\n }\n }\n\n /**\n * Send an event to the loggers\n *\n * @param event - the event to send to all the registered logger\n */\n public send(event: ITelemetryBaseEvent): void {\n const newEvent = this.prepareEvent(event);\n this.loggers.forEach((logger: ITelemetryBaseLogger) => {\n logger.send(newEvent);\n });\n }\n}\n\n/**\n * Describes what events PerformanceEvent should log\n * By default, all events are logged, but client can override this behavior\n * For example, there is rarely a need to record start event, as we really after\n * success / failure tracking, including duration (on success).\n */\nexport interface IPerformanceEventMarkers {\n start?: true;\n end?: true;\n cancel?: \"generic\" | \"error\"; // tells wether to issue \"generic\" or \"error\" category cancel event\n}\n\n/**\n * Helper class to log performance events\n */\nexport class PerformanceEvent {\n public static start(logger: ITelemetryLogger, event: ITelemetryGenericEvent, markers?: IPerformanceEventMarkers) {\n return new PerformanceEvent(logger, event, markers);\n }\n\n public static timedExec<T>(\n logger: ITelemetryLogger,\n event: ITelemetryGenericEvent,\n callback: (event: PerformanceEvent) => T,\n markers?: IPerformanceEventMarkers,\n ) {\n const perfEvent = PerformanceEvent.start(logger, event, markers);\n try {\n const ret = callback(perfEvent);\n perfEvent.autoEnd();\n return ret;\n } catch (error) {\n perfEvent.cancel(undefined, error);\n throw error;\n }\n }\n\n public static async timedExecAsync<T>(\n logger: ITelemetryLogger,\n event: ITelemetryGenericEvent,\n callback: (event: PerformanceEvent) => Promise<T>,\n markers?: IPerformanceEventMarkers,\n ) {\n const perfEvent = PerformanceEvent.start(logger, event, markers);\n try {\n const ret = await callback(perfEvent);\n perfEvent.autoEnd();\n return ret;\n } catch (error) {\n perfEvent.cancel(undefined, error);\n throw error;\n }\n }\n\n public get duration() { return performance.now() - this.startTime; }\n\n private event?: ITelemetryGenericEvent;\n private readonly startTime = performance.now();\n private startMark?: string;\n\n protected constructor(\n private readonly logger: ITelemetryLogger,\n event: ITelemetryGenericEvent,\n private readonly markers: IPerformanceEventMarkers = { end: true, cancel: \"generic\" },\n ) {\n this.event = { ...event };\n if (this.markers.start) {\n this.reportEvent(\"start\");\n }\n\n if (typeof window === \"object\" && window != null && window.performance) {\n this.startMark = `${event.eventName}-start`;\n window.performance.mark(this.startMark);\n }\n }\n\n public reportProgress(props?: ITelemetryProperties, eventNameSuffix: string = \"update\"): void {\n this.reportEvent(eventNameSuffix, props);\n }\n\n private autoEnd() {\n // Event might have been cancelled or ended in the callback\n if (this.event && this.markers.end) {\n this.reportEvent(\"end\");\n }\n this.performanceEndMark();\n this.event = undefined;\n }\n\n public end(props?: ITelemetryProperties): void {\n this.reportEvent(\"end\", props);\n this.performanceEndMark();\n this.event = undefined;\n }\n\n private performanceEndMark() {\n if (this.startMark && this.event) {\n const endMark = `${this.event.eventName}-end`;\n window.performance.mark(endMark);\n window.performance.measure(`${this.event.eventName}`, this.startMark, endMark);\n this.startMark = undefined;\n }\n }\n\n public cancel(props?: ITelemetryProperties, error?: any): void {\n if (this.markers.cancel !== undefined) {\n this.reportEvent(\"cancel\", { category: this.markers.cancel, ...props }, error);\n }\n this.event = undefined;\n }\n\n /**\n * Report the event, if it hasn't already been reported.\n */\n public reportEvent(eventNameSuffix: string, props?: ITelemetryProperties, error?: any) {\n // There are strange sequences involving multiple Promise chains\n // where the event can be cancelled and then later a callback is invoked\n // and the caller attempts to end directly, e.g. issue #3936. Just return.\n if (!this.event) {\n return;\n }\n\n const event: ITelemetryPerformanceEvent = { ...this.event, ...props };\n event.eventName = `${event.eventName}_${eventNameSuffix}`;\n if (eventNameSuffix !== \"start\") {\n event.duration = this.duration;\n }\n\n this.logger.sendPerformanceEvent(event, error);\n }\n}\n\n/**\n * Logger that is useful for UT\n * It can be used in places where logger instance is required, but events should be not send over.\n */\n export class TelemetryUTLogger implements ITelemetryLogger {\n public send(event: ITelemetryBaseEvent): void {\n }\n public sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any) {\n }\n public sendErrorEvent(event: ITelemetryErrorEvent, error?: any) {\n this.reportError(\"errorEvent in UT logger!\", event, error);\n }\n public sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void {\n }\n public logGenericError(eventName: string, error: any) {\n this.reportError(`genericError in UT logger!`, { eventName }, error);\n }\n public logException(event: ITelemetryErrorEvent, exception: any): void {\n this.reportError(\"exception in UT logger!\", event, exception);\n }\n public debugAssert(condition: boolean, event?: ITelemetryErrorEvent): void {\n this.reportError(\"debugAssert in UT logger!\");\n }\n public shipAssert(condition: boolean, event?: ITelemetryErrorEvent): void {\n this.reportError(\"shipAssert in UT logger!\");\n }\n\n private reportError(message: string, event?: ITelemetryErrorEvent, err?: any) {\n const error = new Error(message);\n (error as any).error = error;\n (error as any).event = event;\n // report to console as exception can be eaten\n console.error(message);\n console.error(error);\n throw error;\n }\n}\n"]}
@@ -34,6 +34,8 @@ export declare class MockLogger extends TelemetryLogger implements ITelemetryLog
34
34
  matchAnyEvent(expectedEvents: Omit<ITelemetryBaseEvent, "category">[]): boolean;
35
35
  /** Asserts that matchAnyEvent is true, and prints the actual/expected output if not */
36
36
  assertMatchAny(expectedEvents: Omit<ITelemetryBaseEvent, "category">[], message?: string): void;
37
+ /** Asserts that matchAnyEvent is false for the given events, and prints the actual/expected output if not */
38
+ assertMatchNone(disallowedEvents: Omit<ITelemetryBaseEvent, "category">[], message?: string): void;
37
39
  private getMatchedEventsCount;
38
40
  /**
39
41
  * Ensure the expected event is a strict subset of the actual event
@@ -1 +1 @@
1
- {"version":3,"file":"mockLogger.d.ts","sourceRoot":"","sources":["../src/mockLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C;;;GAGG;AACH,qBAAa,UAAW,SAAQ,eAAgB,YAAW,gBAAgB;IACvE,MAAM,EAAE,mBAAmB,EAAE,CAAM;;IAInC,KAAK;IAIL,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAItC;;;;;;OAMG;IACH,WAAW,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,OAAO;IAO7E,qFAAqF;IACrF,WAAW,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM;IAYrF;;;;;;;OAOG;IACH,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,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IACH,OAAO,CAAC,MAAM,CAAC,WAAW;CAI7B"}
@@ -66,6 +66,18 @@ ${JSON.stringify(actualEvents)}`);
66
66
  expected:
67
67
  ${JSON.stringify(expectedEvents)}
68
68
 
69
+ actual:
70
+ ${JSON.stringify(actualEvents)}`);
71
+ }
72
+ }
73
+ /** Asserts that matchAnyEvent is false for the given events, and prints the actual/expected output if not */
74
+ assertMatchNone(disallowedEvents, message) {
75
+ const actualEvents = this.events;
76
+ if (this.matchAnyEvent(disallowedEvents)) {
77
+ throw new Error(`${message}
78
+ disallowed events:
79
+ ${JSON.stringify(disallowedEvents)}
80
+
69
81
  actual:
70
82
  ${JSON.stringify(actualEvents)}`);
71
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mockLogger.js","sourceRoot":"","sources":["../src/mockLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qCAA2C;AAE3C;;;GAGG;AACH,MAAa,UAAW,SAAQ,wBAAe;IAG3C;QAAgB,KAAK,EAAE,CAAC;QAFxB,WAAM,GAA0B,EAAE,CAAC;IAEV,CAAC;IAE1B,KAAK;QACD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,KAA0B;QAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,cAAuD;QAC/D,MAAM,yBAAyB,GAAG,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC;QAC7E,2DAA2D;QAC3D,MAAM,2BAA2B,GAAG,cAAc,CAAC,MAAM,GAAG,yBAAyB,CAAC;QACtF,OAAO,2BAA2B,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,qFAAqF;IACrF,WAAW,CAAC,cAAuD,EAAE,OAAgB;QACjF,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;QACjC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,C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AO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;CACJ;AA3FD,gCA2FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger, ITelemetryBaseEvent } from \"@fluidframework/common-definitions\";\nimport { TelemetryLogger } from \"./logger\";\n\n/**\n * The MockLogger records events sent to it, and then can walk back over those events\n * searching for a set of expected events to match against the logged events.\n */\nexport class MockLogger extends TelemetryLogger implements ITelemetryLogger {\n events: ITelemetryBaseEvent[] = [];\n\n constructor() { super(); }\n\n clear() {\n this.events = [];\n }\n\n send(event: ITelemetryBaseEvent): void {\n this.events.push(event);\n }\n\n /**\n * Search events logged since the last time matchEvents was called, looking for the given expected\n * events in order.\n * @param expectedEvents - events in order that are expected to appear in the recorded log.\n * These event objects may be subsets of the logged events.\n * Note: category is ommitted from the type because it's usually uninteresting and tedious to type.\n */\n matchEvents(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[]): boolean {\n const matchedExpectedEventCount = this.getMatchedEventsCount(expectedEvents);\n // How many expected events were left over? Hopefully none.\n const unmatchedExpectedEventCount = expectedEvents.length - matchedExpectedEventCount;\n return unmatchedExpectedEventCount === 0;\n }\n\n /** Asserts that matchEvents is true, and prints the actual/expected output if not */\n assertMatch(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[], message?: string) {\n const actualEvents = this.events;\n if (!this.matchEvents(expectedEvents)) {\n throw new Error(`${message}\nexpected:\n${JSON.stringify(expectedEvents)}\n\nactual:\n${JSON.stringify(actualEvents)}`);\n }\n }\n\n /**\n * Search events logged since the last time matchEvents was called, looking for any of the given\n * expected events.\n * @param expectedEvents - events that are expected to appear in the recorded log.\n * These event objects may be subsets of the logged events.\n * Note: category is ommitted from the type because it's usually uninteresting and tedious to type.\n * @returns if any of the expected events is found.\n */\n matchAnyEvent(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[]): boolean {\n const matchedExpectedEventCount = this.getMatchedEventsCount(expectedEvents);\n return matchedExpectedEventCount > 0;\n }\n\n /** Asserts that matchAnyEvent is true, and prints the actual/expected output if not */\n assertMatchAny(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[], message?: string) {\n const actualEvents = this.events;\n if (!this.matchAnyEvent(expectedEvents)) {\n throw new Error(`${message}\nexpected:\n${JSON.stringify(expectedEvents)}\n\nactual:\n${JSON.stringify(actualEvents)}`);\n }\n }\n\n private getMatchedEventsCount(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[]): number {\n let iExpectedEvent = 0;\n this.events.forEach((event) => {\n if (iExpectedEvent < expectedEvents.length &&\n MockLogger.eventsMatch(event, expectedEvents[iExpectedEvent])\n ) {\n // We found the next expected event; increment\n ++iExpectedEvent;\n }\n });\n\n // Remove the events so far; next call will just compare subsequent events from here\n this.events = [];\n\n // Return the count of matched events.\n return iExpectedEvent;\n }\n\n /**\n * Ensure the expected event is a strict subset of the actual event\n */\n private static eventsMatch(actual: ITelemetryBaseEvent, expected: Omit<ITelemetryBaseEvent, \"category\">): boolean {\n const masked = { ...actual, ...expected };\n return JSON.stringify(masked) === JSON.stringify(actual);\n }\n}\n"]}
1
+ {"version":3,"file":"mockLogger.js","sourceRoot":"","sources":["../src/mockLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qCAA2C;AAE3C;;;GAGG;AACH,MAAa,UAAW,SAAQ,wBAAe;IAG3C;QAAgB,KAAK,EAAE,CAAC;QAFxB,WAAM,GAA0B,EAAE,CAAC;IAEV,CAAC;IAE1B,KAAK;QACD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,KAA0B;QAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,cAAuD;QAC/D,MAAM,yBA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AS,CAAC,gBAAgB,CAAC;;;EAGhC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;SACrB;IACT,CAAC;IAEO,qBAAqB,CAAC,cAAuD;QACjF,IAAI,cAAc,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC1B,IAAI,cAAc,GAAG,cAAc,CAAC,MAAM;gBACtC,UAAU,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC,EAC/D;gBACE,8CAA8C;gBAC9C,EAAE,cAAc,CAAC;aACpB;QACL,CAAC,CAAC,CAAC;QAEH,oFAAoF;QACpF,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QAEjB,sCAAsC;QACtC,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,WAAW,CAAC,MAA2B,EAAE,QAA+C;QACnG,MAAM,MAAM,mCAAQ,MAAM,GAAK,QAAQ,CAAE,CAAC;QAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;CACJ;AAxGD,gCAwGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger, ITelemetryBaseEvent } from \"@fluidframework/common-definitions\";\nimport { TelemetryLogger } from \"./logger\";\n\n/**\n * The MockLogger records events sent to it, and then can walk back over those events\n * searching for a set of expected events to match against the logged events.\n */\nexport class MockLogger extends TelemetryLogger implements ITelemetryLogger {\n events: ITelemetryBaseEvent[] = [];\n\n constructor() { super(); }\n\n clear() {\n this.events = [];\n }\n\n send(event: ITelemetryBaseEvent): void {\n this.events.push(event);\n }\n\n /**\n * Search events logged since the last time matchEvents was called, looking for the given expected\n * events in order.\n * @param expectedEvents - events in order that are expected to appear in the recorded log.\n * These event objects may be subsets of the logged events.\n * Note: category is ommitted from the type because it's usually uninteresting and tedious to type.\n */\n matchEvents(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[]): boolean {\n const matchedExpectedEventCount = this.getMatchedEventsCount(expectedEvents);\n // How many expected events were left over? Hopefully none.\n const unmatchedExpectedEventCount = expectedEvents.length - matchedExpectedEventCount;\n return unmatchedExpectedEventCount === 0;\n }\n\n /** Asserts that matchEvents is true, and prints the actual/expected output if not */\n assertMatch(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[], message?: string) {\n const actualEvents = this.events;\n if (!this.matchEvents(expectedEvents)) {\n throw new Error(`${message}\nexpected:\n${JSON.stringify(expectedEvents)}\n\nactual:\n${JSON.stringify(actualEvents)}`);\n }\n }\n\n /**\n * Search events logged since the last time matchEvents was called, looking for any of the given\n * expected events.\n * @param expectedEvents - events that are expected to appear in the recorded log.\n * These event objects may be subsets of the logged events.\n * Note: category is ommitted from the type because it's usually uninteresting and tedious to type.\n * @returns if any of the expected events is found.\n */\n matchAnyEvent(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[]): boolean {\n const matchedExpectedEventCount = this.getMatchedEventsCount(expectedEvents);\n return matchedExpectedEventCount > 0;\n }\n\n /** Asserts that matchAnyEvent is true, and prints the actual/expected output if not */\n assertMatchAny(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[], message?: string) {\n const actualEvents = this.events;\n if (!this.matchAnyEvent(expectedEvents)) {\n throw new Error(`${message}\nexpected:\n${JSON.stringify(expectedEvents)}\n\nactual:\n${JSON.stringify(actualEvents)}`);\n }\n }\n\n /** Asserts that matchAnyEvent is false for the given events, and prints the actual/expected output if not */\n assertMatchNone(disallowedEvents: Omit<ITelemetryBaseEvent, \"category\">[], message?: string) {\n const actualEvents = this.events;\n if (this.matchAnyEvent(disallowedEvents)) {\n throw new Error(`${message}\ndisallowed events:\n${JSON.stringify(disallowedEvents)}\n\nactual:\n${JSON.stringify(actualEvents)}`);\n }\n }\n\n private getMatchedEventsCount(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[]): number {\n let iExpectedEvent = 0;\n this.events.forEach((event) => {\n if (iExpectedEvent < expectedEvents.length &&\n MockLogger.eventsMatch(event, expectedEvents[iExpectedEvent])\n ) {\n // We found the next expected event; increment\n ++iExpectedEvent;\n }\n });\n\n // Remove the events so far; next call will just compare subsequent events from here\n this.events = [];\n\n // Return the count of matched events.\n return iExpectedEvent;\n }\n\n /**\n * Ensure the expected event is a strict subset of the actual event\n */\n private static eventsMatch(actual: ITelemetryBaseEvent, expected: Omit<ITelemetryBaseEvent, \"category\">): boolean {\n const masked = { ...actual, ...expected };\n return JSON.stringify(masked) === JSON.stringify(actual);\n }\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/telemetry-utils";
8
- export declare const pkgVersion = "1.2.6";
8
+ export declare const pkgVersion = "2.0.0-dev.1.3.0.96595";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,oCAAoC,CAAC;AACzD,eAAO,MAAM,UAAU,UAAU,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,oCAAoC,CAAC;AACzD,eAAO,MAAM,UAAU,0BAA0B,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/telemetry-utils";
11
- exports.pkgVersion = "1.2.6";
11
+ exports.pkgVersion = "2.0.0-dev.1.3.0.96595";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,iCAAiC,CAAC;AAC5C,QAAA,UAAU,GAAG,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/telemetry-utils\";\nexport const pkgVersion = \"1.2.6\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,iCAAiC,CAAC;AAC5C,QAAA,UAAU,GAAG,uBAAuB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/telemetry-utils\";\nexport const pkgVersion = \"2.0.0-dev.1.3.0.96595\";\n"]}
@@ -0,0 +1,53 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { IDisposable, ITelemetryGenericEvent, ITelemetryLogger, ITelemetryProperties } from "@fluidframework/common-definitions";
6
+ /**
7
+ * Helper class that executes a specified code block and writes an
8
+ * {@link @fluidframework/common-definitions#ITelemetryPerformanceEvent} to a specified logger every time a specified
9
+ * number of executions is reached (or when the class is disposed). The `duration` field in the telemetry event is
10
+ * the duration of the latest execution (sample) of the specified function. See the documentation of the
11
+ * `includeAggregateMetrics` parameter for additional details that can be included.
12
+ */
13
+ export declare class SampledTelemetryHelper implements IDisposable {
14
+ private readonly eventBase;
15
+ private readonly logger;
16
+ private readonly sampleThreshold;
17
+ private readonly includeAggregateMetrics;
18
+ private readonly perBucketProperties;
19
+ disposed: boolean;
20
+ private readonly measurementsMap;
21
+ /**
22
+ * @param eventBase -
23
+ * Custom properties to include in the telemetry performance event when it is written.
24
+ * @param logger -
25
+ * The logger to use to write the telemetry performance event.
26
+ * @param sampleThreshold -
27
+ * Telemetry performance events will be generated every time we hit this many executions of the code block.
28
+ * @param includeAggregateMetrics -
29
+ * If set to `true`, the telemetry performance event will include aggregated metrics (total duration, min duration,
30
+ * max duration) for all the executions in between generated events.
31
+ * @param perBucketProperties -
32
+ * Map of strings that represent different buckets (which can be specified when calling the 'measure' method), to
33
+ * properties which should be added to the telemetry event for that bucket. If a bucket being measured does not
34
+ * have an entry in this map, no additional properties will be added to its telemetry events. The following keys are
35
+ * reserved for use by this class: "duration", "count", "totalDuration", "minDuration", "maxDuration". If any of
36
+ * them is specified as a key in one of the ITelemetryProperties objects in this map, that key-value pair will be
37
+ * ignored.
38
+ */
39
+ constructor(eventBase: ITelemetryGenericEvent, logger: ITelemetryLogger, sampleThreshold: number, includeAggregateMetrics?: boolean, perBucketProperties?: Map<string, ITelemetryProperties>);
40
+ /**
41
+ * @param codeToMeasure -
42
+ * The code to be executed and measured.
43
+ * @param bucket -
44
+ * A key to track executions of the code block separately. Each different value of this parameter has a separate
45
+ * set of executions and metrics tracked by the class. If no such distinction needs to be made, do not provide a
46
+ * value.
47
+ * @returns Whatever the passed-in code block returns.
48
+ */
49
+ measure<T>(codeToMeasure: () => T, bucket?: string): T;
50
+ private flushBucket;
51
+ dispose(error?: Error | undefined): void;
52
+ }
53
+ //# sourceMappingURL=sampledTelemetryHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sampledTelemetryHelper.d.ts","sourceRoot":"","sources":["../src/sampledTelemetryHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,WAAW,EACX,sBAAsB,EACtB,gBAAgB,EAEhB,oBAAoB,EACvB,MAAM,oCAAoC,CAAC;AAkC5C;;;;;;GAMG;AACF,qBAAa,sBAAuB,YAAW,WAAW;IAwBnD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IACxC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IA3BxC,QAAQ,EAAE,OAAO,CAAS;IAE1B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAmC;IAEnE;;;;;;;;;;;;;;;;;OAiBG;gBAEkB,SAAS,EAAE,sBAAsB,EACjC,MAAM,EAAE,gBAAgB,EACxB,eAAe,EAAE,MAAM,EACvB,uBAAuB,GAAE,OAAe,EACxC,mBAAmB,oCAA0C;IAGlF;;;;;;;;OAQG;IACI,OAAO,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,MAAM,GAAE,MAAW,GAAG,CAAC;IA0BjE,OAAO,CAAC,WAAW;IAoBZ,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI;CAGlD"}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.SampledTelemetryHelper = void 0;
8
+ const common_utils_1 = require("@fluidframework/common-utils");
9
+ /**
10
+ * Helper class that executes a specified code block and writes an
11
+ * {@link @fluidframework/common-definitions#ITelemetryPerformanceEvent} to a specified logger every time a specified
12
+ * number of executions is reached (or when the class is disposed). The `duration` field in the telemetry event is
13
+ * the duration of the latest execution (sample) of the specified function. See the documentation of the
14
+ * `includeAggregateMetrics` parameter for additional details that can be included.
15
+ */
16
+ class SampledTelemetryHelper {
17
+ /**
18
+ * @param eventBase -
19
+ * Custom properties to include in the telemetry performance event when it is written.
20
+ * @param logger -
21
+ * The logger to use to write the telemetry performance event.
22
+ * @param sampleThreshold -
23
+ * Telemetry performance events will be generated every time we hit this many executions of the code block.
24
+ * @param includeAggregateMetrics -
25
+ * If set to `true`, the telemetry performance event will include aggregated metrics (total duration, min duration,
26
+ * max duration) for all the executions in between generated events.
27
+ * @param perBucketProperties -
28
+ * Map of strings that represent different buckets (which can be specified when calling the 'measure' method), to
29
+ * properties which should be added to the telemetry event for that bucket. If a bucket being measured does not
30
+ * have an entry in this map, no additional properties will be added to its telemetry events. The following keys are
31
+ * reserved for use by this class: "duration", "count", "totalDuration", "minDuration", "maxDuration". If any of
32
+ * them is specified as a key in one of the ITelemetryProperties objects in this map, that key-value pair will be
33
+ * ignored.
34
+ */
35
+ constructor(eventBase, logger, sampleThreshold, includeAggregateMetrics = false, perBucketProperties = new Map()) {
36
+ this.eventBase = eventBase;
37
+ this.logger = logger;
38
+ this.sampleThreshold = sampleThreshold;
39
+ this.includeAggregateMetrics = includeAggregateMetrics;
40
+ this.perBucketProperties = perBucketProperties;
41
+ this.disposed = false;
42
+ this.measurementsMap = new Map();
43
+ }
44
+ /**
45
+ * @param codeToMeasure -
46
+ * The code to be executed and measured.
47
+ * @param bucket -
48
+ * A key to track executions of the code block separately. Each different value of this parameter has a separate
49
+ * set of executions and metrics tracked by the class. If no such distinction needs to be made, do not provide a
50
+ * value.
51
+ * @returns Whatever the passed-in code block returns.
52
+ */
53
+ measure(codeToMeasure, bucket = "") {
54
+ var _a, _b, _c;
55
+ const start = common_utils_1.performance.now();
56
+ const returnValue = codeToMeasure();
57
+ const duration = common_utils_1.performance.now() - start;
58
+ let m = this.measurementsMap.get(bucket);
59
+ if (m === undefined) {
60
+ m = { count: 0, duration: -1 };
61
+ this.measurementsMap.set(bucket, m);
62
+ }
63
+ m.count++;
64
+ m.duration = duration;
65
+ if (this.includeAggregateMetrics) {
66
+ m.totalDuration = ((_a = m.totalDuration) !== null && _a !== void 0 ? _a : 0) + duration;
67
+ m.minDuration = Math.min((_b = m.minDuration) !== null && _b !== void 0 ? _b : duration, duration);
68
+ m.maxDuration = Math.max((_c = m.maxDuration) !== null && _c !== void 0 ? _c : 0, duration);
69
+ }
70
+ if (m.count >= this.sampleThreshold) {
71
+ this.flushBucket(bucket);
72
+ }
73
+ return returnValue;
74
+ }
75
+ flushBucket(bucket) {
76
+ const measurements = this.measurementsMap.get(bucket);
77
+ if (measurements === undefined) {
78
+ return;
79
+ }
80
+ if (measurements.count !== 0) {
81
+ const bucketProperties = this.perBucketProperties.get(bucket);
82
+ const telemetryEvent = Object.assign(Object.assign(Object.assign({}, this.eventBase), bucketProperties), measurements);
83
+ this.logger.sendPerformanceEvent(telemetryEvent);
84
+ this.measurementsMap.delete(bucket);
85
+ }
86
+ }
87
+ dispose(error) {
88
+ this.measurementsMap.forEach((_, k) => this.flushBucket(k));
89
+ }
90
+ }
91
+ exports.SampledTelemetryHelper = SampledTelemetryHelper;
92
+ //# sourceMappingURL=sampledTelemetryHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sampledTelemetryHelper.js","sourceRoot":"","sources":["../src/sampledTelemetryHelper.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,+DAA2D;AAiC3D;;;;;;GAMG;AACF,MAAa,sBAAsB;IAKhC;;;;;;;;;;;;;;;;;OAiBG;IACH,YACqB,SAAiC,EACjC,MAAwB,EACxB,eAAuB,EACvB,0BAAmC,KAAK,EACxC,sBAAsB,IAAI,GAAG,EAAgC;QAJ7D,cAAS,GAAT,SAAS,CAAwB;QACjC,WAAM,GAAN,MAAM,CAAkB;QACxB,oBAAe,GAAf,eAAe,CAAQ;QACvB,4BAAuB,GAAvB,uBAAuB,CAAiB;QACxC,wBAAmB,GAAnB,mBAAmB,CAA0C;QA3BlF,aAAQ,GAAY,KAAK,CAAC;QAET,oBAAe,GAAG,IAAI,GAAG,EAAwB,CAAC;IA0BnE,CAAC;IAED;;;;;;;;OAQG;IACI,OAAO,CAAI,aAAs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SACV;QAED,IAAI,YAAY,CAAC,KAAK,KAAK,CAAC,EAAE;YAC1B,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAE9D,MAAM,cAAc,iDACb,IAAI,CAAC,SAAS,GACd,gBAAgB,GAChB,YAAY,CAClB,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;YACjD,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SACvC;IACL,CAAC;IAEM,OAAO,CAAC,KAAyB;QACpC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;CACJ;AAzFA,wDAyFA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDisposable,\n ITelemetryGenericEvent,\n ITelemetryLogger,\n ITelemetryPerformanceEvent,\n ITelemetryProperties,\n} from \"@fluidframework/common-definitions\";\nimport { performance } from \"@fluidframework/common-utils\";\n\ninterface Measurements {\n // The names of the properties in this interface are the ones that will get stamped in the\n // telemetry event, changes should be considered carefully. The optional properties should\n // only be populated if 'includeAggregateMetrics' is true.\n\n /**\n * The duration of the latest execution.\n */\n duration: number;\n\n /**\n * The number of executions since the last time an event was generated.\n */\n count: number;\n\n /**\n * Total duration across all the executions since the last event was generated.\n */\n totalDuration?: number;\n\n /**\n * Min duration across all the executions since the last event was generated.\n */\n minDuration?: number;\n\n /**\n * Max duration across all the executions since the last event was generated.\n */\n maxDuration?: number;\n}\n\n/**\n * Helper class that executes a specified code block and writes an\n * {@link @fluidframework/common-definitions#ITelemetryPerformanceEvent} to a specified logger every time a specified\n * number of executions is reached (or when the class is disposed). The `duration` field in the telemetry event is\n * the duration of the latest execution (sample) of the specified function. See the documentation of the\n * `includeAggregateMetrics` parameter for additional details that can be included.\n */\n export class SampledTelemetryHelper implements IDisposable {\n disposed: boolean = false;\n\n private readonly measurementsMap = new Map<string, Measurements>();\n\n /**\n * @param eventBase -\n * Custom properties to include in the telemetry performance event when it is written.\n * @param logger -\n * The logger to use to write the telemetry performance event.\n * @param sampleThreshold -\n * Telemetry performance events will be generated every time we hit this many executions of the code block.\n * @param includeAggregateMetrics -\n * If set to `true`, the telemetry performance event will include aggregated metrics (total duration, min duration,\n * max duration) for all the executions in between generated events.\n * @param perBucketProperties -\n * Map of strings that represent different buckets (which can be specified when calling the 'measure' method), to\n * properties which should be added to the telemetry event for that bucket. If a bucket being measured does not\n * have an entry in this map, no additional properties will be added to its telemetry events. The following keys are\n * reserved for use by this class: \"duration\", \"count\", \"totalDuration\", \"minDuration\", \"maxDuration\". If any of\n * them is specified as a key in one of the ITelemetryProperties objects in this map, that key-value pair will be\n * ignored.\n */\n public constructor(\n private readonly eventBase: ITelemetryGenericEvent,\n private readonly logger: ITelemetryLogger,\n private readonly sampleThreshold: number,\n private readonly includeAggregateMetrics: boolean = false,\n private readonly perBucketProperties = new Map<string, ITelemetryProperties>()) {\n }\n\n /**\n * @param codeToMeasure -\n * The code to be executed and measured.\n * @param bucket -\n * A key to track executions of the code block separately. Each different value of this parameter has a separate\n * set of executions and metrics tracked by the class. If no such distinction needs to be made, do not provide a\n * value.\n * @returns Whatever the passed-in code block returns.\n */\n public measure<T>(codeToMeasure: () => T, bucket: string = \"\"): T {\n const start = performance.now();\n const returnValue = codeToMeasure();\n const duration = performance.now() - start;\n\n let m = this.measurementsMap.get(bucket);\n if (m === undefined) {\n m = { count: 0, duration: -1 };\n this.measurementsMap.set(bucket, m);\n }\n m.count++;\n m.duration = duration;\n\n if (this.includeAggregateMetrics) {\n m.totalDuration = (m.totalDuration ?? 0) + duration;\n m.minDuration = Math.min(m.minDuration ?? duration, duration);\n m.maxDuration = Math.max(m.maxDuration ?? 0, duration);\n }\n\n if (m.count >= this.sampleThreshold) {\n this.flushBucket(bucket);\n }\n\n return returnValue;\n }\n\n private flushBucket(bucket: string) {\n const measurements = this.measurementsMap.get(bucket);\n if (measurements === undefined) {\n return;\n }\n\n if (measurements.count !== 0) {\n const bucketProperties = this.perBucketProperties.get(bucket);\n\n const telemetryEvent: ITelemetryPerformanceEvent = {\n ...this.eventBase,\n ...bucketProperties, // If the bucket doesn't exist and this is undefined, things work as expected\n ...measurements,\n };\n\n this.logger.sendPerformanceEvent(telemetryEvent);\n this.measurementsMap.delete(bucket);\n }\n }\n\n public dispose(error?: Error | undefined): void {\n this.measurementsMap.forEach((_, k) => this.flushBucket(k));\n }\n}\n"]}
@@ -17,7 +17,7 @@ export declare class ThresholdCounter {
17
17
  */
18
18
  send(eventName: string, value: number): void;
19
19
  /**
20
- * Sends the value if it's above the treshold
20
+ * Sends the value if it's above the threshold
21
21
  * and a multiple of the threshold.
22
22
  *
23
23
  * To be used in scenarios where we'd like to record a
@@ -28,7 +28,7 @@ class ThresholdCounter {
28
28
  });
29
29
  }
30
30
  /**
31
- * Sends the value if it's above the treshold
31
+ * Sends the value if it's above the threshold
32
32
  * and a multiple of the threshold.
33
33
  *
34
34
  * To be used in scenarios where we'd like to record a
@@ -1 +1 @@
1
- {"version":3,"file":"thresholdCounter.js","sourceRoot":"","sources":["../src/thresholdCounter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;GAGG;AACH,MAAa,gBAAgB;IACzB,YACqB,SAAiB,EACjB,MAAwB,EACjC,oBAAoB,SAAS;QAFpB,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAkB;QACjC,sBAAiB,GAAjB,iBAAiB,CAAY;IACtC,CAAC;IAEJ;;OAEG;IACI,IAAI,CAAC,SAAiB,EAAE,KAAa;QACxC,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE;YACxB,OAAO;SACV;QACD,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;YAC7B,SAAS;YACT,KAAK;SACR,CAAC,CAAC;IACP,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAC,SAAiB,EAAE,KAAa;QAClD,IAAI,KAAK,KAAK,IAAI,CAAC,iBAAiB,EAAE;YAClC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBAC7B,SAAS;gBACT,KAAK;aACR,CAAC,CAAC;YACH,sCAAsC;YACtC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;SACvD;IACL,CAAC;CACJ;AArCD,4CAqCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\n\n/**\n * Utility counter which will send event only if the provided value\n * is above a configured threshold\n */\nexport class ThresholdCounter {\n public constructor(\n private readonly threshold: number,\n private readonly logger: ITelemetryLogger,\n private thresholdMultiple = threshold,\n ) {}\n\n /**\n * Sends the value if it's above the treshold.\n */\n public send(eventName: string, value: number) {\n if (value < this.threshold) {\n return;\n }\n this.logger.sendPerformanceEvent({\n eventName,\n value,\n });\n }\n\n /**\n * Sends the value if it's above the treshold\n * and a multiple of the threshold.\n *\n * To be used in scenarios where we'd like to record a\n * threshold violation while reducing telemetry noise.\n */\n public sendIfMultiple(eventName: string, value: number) {\n if (value === this.thresholdMultiple) {\n this.logger.sendPerformanceEvent({\n eventName,\n value,\n });\n // reduce number of \"multiple\" events.\n this.thresholdMultiple = this.thresholdMultiple * 2;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"thresholdCounter.js","sourceRoot":"","sources":["../src/thresholdCounter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;GAGG;AACH,MAAa,gBAAgB;IACzB,YACqB,SAAiB,EACjB,MAAwB,EACjC,oBAAoB,SAAS;QAFpB,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAkB;QACjC,sBAAiB,GAAjB,iBAAiB,CAAY;IACtC,CAAC;IAEJ;;OAEG;IACI,IAAI,CAAC,SAAiB,EAAE,KAAa;QACxC,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE;YACxB,OAAO;SACV;QACD,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;YAC7B,SAAS;YACT,KAAK;SACR,CAAC,CAAC;IACP,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAC,SAAiB,EAAE,KAAa;QAClD,IAAI,KAAK,KAAK,IAAI,CAAC,iBAAiB,EAAE;YAClC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBAC7B,SAAS;gBACT,KAAK;aACR,CAAC,CAAC;YACH,sCAAsC;YACtC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;SACvD;IACL,CAAC;CACJ;AArCD,4CAqCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\n\n/**\n * Utility counter which will send event only if the provided value\n * is above a configured threshold\n */\nexport class ThresholdCounter {\n public constructor(\n private readonly threshold: number,\n private readonly logger: ITelemetryLogger,\n private thresholdMultiple = threshold,\n ) {}\n\n /**\n * Sends the value if it's above the treshold.\n */\n public send(eventName: string, value: number) {\n if (value < this.threshold) {\n return;\n }\n this.logger.sendPerformanceEvent({\n eventName,\n value,\n });\n }\n\n /**\n * Sends the value if it's above the threshold\n * and a multiple of the threshold.\n *\n * To be used in scenarios where we'd like to record a\n * threshold violation while reducing telemetry noise.\n */\n public sendIfMultiple(eventName: string, value: number) {\n if (value === this.thresholdMultiple) {\n this.logger.sendPerformanceEvent({\n eventName,\n value,\n });\n // reduce number of \"multiple\" events.\n this.thresholdMultiple = this.thresholdMultiple * 2;\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src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;IAG3C,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,SAAS;IAGpD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;IAGlD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;IAIlD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;IAIvC,OAAO,CAAC,aAAa;CAcxB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAC9B,CAAC,SAAS,oBAAoB,GAAG,gBAAgB;IAEjD,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,CAAC,CAAC;CACb;AAED,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,oBAAoB,GAAG,gBAAgB,EACvF,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAG3C;AAED,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,oBAAoB,GAAG,gBAAgB,EACvF,MAAM,EAAE,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAKnC;AAED,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,oBAAoB,GAAG,gBAAgB,EACpF,MAAM,EAAE,CAAC,EAAE,GAAI,OAAO,EAAE,CAAC,mBAAmB,GAAG,SAAS,CAAC,EAAE,wBAgB9D"}
package/lib/config.js CHANGED
@@ -94,14 +94,9 @@ function stronglyTypedParse(input) {
94
94
  }
95
95
  return defaultReturn;
96
96
  }
97
- /** Referencing the `sessionStorage` variable can throw in some environments such as Node */
97
+ /** `sessionStorage` is undefined in some environments such as Node */
98
98
  const safeSessionStorage = () => {
99
- try {
100
- return sessionStorage !== null ? sessionStorage : undefined;
101
- }
102
- catch (_a) {
103
- return undefined;
104
- }
99
+ return globalThis.sessionStorage;
105
100
  };
106
101
  /**
107
102
  * Implementation of {@link IConfigProvider} which contains nested {@link IConfigProviderBase} instances
package/lib/config.js.map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AI,yBAAyB,CAAI,MAAM,CAAC,EAAE;QACtC,OAAO,MAAM,CAAC;KACjB;IACD,OAAO,sBAAsB,CAAI,MAAM,EAAE,4BAA4B,CAAC,KAAK,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,sBAAsB,CAClC,MAAS,EAAE,GAAI,OAA4C;IAC3D,IAAI,yBAAyB,CAAI,MAAM,CAAC,EAAE;QACtC,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;KAC7D;IACD;;;;;;;OAOG;IACH,MAAM,EAAE,GAAsC,MAAM,CAAC;IACrD,EAAE,CAAC,MAAM,GAAG,IAAI,oBAAoB,CAAC,GAAG,OAAO,CAAC,CAAC;IACjD,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC;IACnB,OAAO,EAA0B,CAAC;AACtC,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAY;IACtC,MAAM,WAAW,GAAG,GAA+C,CAAC;IACpE,OAAO,OAAO,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,YAAY,CAAC,KAAK,UAAU,CAAC;AAC7D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ITelemetryBaseLogger, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { Lazy } from \"@fluidframework/common-utils\";\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 */\nexport interface IConfigProviderBase {\n getRawConfig(name: string): ConfigTypes;\n}\n\n/**\n * Explicitly typed interface for reading configurations\n */\n export interface IConfigProvider extends IConfigProviderBase {\n getBoolean(name: string): boolean | undefined;\n getNumber(name: string): number | undefined;\n getString(name: string): string | undefined;\n getBooleanArray(name: string): boolean[] | undefined;\n getNumberArray(name: string): number[] | undefined;\n getStringArray(name: string): string[] | undefined;\n }\n/**\n * Creates a base configuration provider based on `sessionStorage`\n *\n * @returns A lazy initialized base configuration provider with `sessionStorage` as the underlying config store\n */\nexport const sessionStorageConfigProvider =\n new Lazy<IConfigProviderBase>(() => inMemoryConfigProvider(safeSessionStorage()));\n\nconst NullConfigProvider: IConfigProviderBase = {\n getRawConfig: () => undefined,\n};\n\n/**\n * Creates a base configuration provider based on the supplied `Storage` instance\n *\n * @param storage - instance of `Storage` to be used as storage media for the config\n * @returns A base configuration provider with\n * the supplied `Storage` instance as the underlying config store\n */\nexport const inMemoryConfigProvider =\n (storage: Storage | undefined): IConfigProviderBase => {\n if (storage !== undefined && storage !== null) {\n return new CachedConfigProvider({\n getRawConfig: (name: string) => {\n try {\n return stronglyTypedParse(storage.getItem(name) ?? undefined)?.raw;\n } catch { }\n return undefined;\n },\n });\n }\n return NullConfigProvider;\n};\n\ninterface ConfigTypeStringToType {\n number: number;\n string: string;\n boolean: boolean;\n [\"number[]\"]: number[];\n [\"string[]\"]: string[];\n [\"boolean[]\"]: boolean[];\n}\n\ntype PrimitiveTypeStrings = \"number\" | \"string\" | \"boolean\";\n\nfunction isPrimitiveType(type: string): type is PrimitiveTypeStrings {\n switch (type) {\n case \"boolean\":\n case \"number\":\n case \"string\":\n return true;\n default:\n return false;\n }\n}\n\ninterface StronglyTypedValue extends Partial<ConfigTypeStringToType> {\n raw: ConfigTypes;\n}\n/**\n * Takes any supported config type, and returns the value with a strong type. If the type of\n * the config is not a supported type undefined will be returned.\n * The user of this function should cache the result to avoid duplicated work.\n *\n * Strings will be attempted to be parsed and coerced into a strong config type.\n * if it is not possible to parsed and coerce a string to a strong config type the original string\n * will be return with a string type for the consumer to handle further if necessary.\n */\nfunction stronglyTypedParse(input: ConfigTypes): StronglyTypedValue | undefined {\n let output: ConfigTypes = input;\n let defaultReturn: Pick<StronglyTypedValue, \"raw\" | \"string\"> | undefined;\n // we do special handling for strings to try and coerce\n // them into a config type if we can. This makes it easy\n // for config sources like sessionStorage which only\n // holds strings\n if (typeof input === \"string\") {\n try {\n output = JSON.parse(input);\n // we succeeded in parsing, but we don't support parsing\n // for any object as we can't do it type safely\n // so in this case, the default return will be string\n // rather than undefined, and the consumer\n // can parse, as we don't want to provide\n // a false sense of security by just\n // casting.\n defaultReturn = { raw: input, string: input };\n } catch { }\n }\n\n if (output === undefined) {\n return defaultReturn;\n }\n\n const outputType = typeof output;\n if (isPrimitiveType(outputType)) {\n return { ...defaultReturn, raw: input, [outputType]: output };\n }\n\n if (Array.isArray(output)) {\n const firstType = typeof output[0];\n // ensure the first elements is a primitive type\n if (!isPrimitiveType(firstType)) {\n return defaultReturn;\n }\n // ensue all the elements types are homogeneous\n // aka they all have the same type as the first\n for (const v of output) {\n if (typeof v !== firstType) {\n return defaultReturn;\n }\n }\n return { ...defaultReturn, raw: input, [`${firstType}[]`]: output };\n }\n\n return defaultReturn;\n}\n\n/** Referencing the `sessionStorage` variable can throw in some environments such as Node */\nconst safeSessionStorage = (): Storage | undefined => {\n try {\n return sessionStorage !== null ? sessionStorage : undefined;\n } catch { return undefined; }\n};\n\n/**\n * Implementation of {@link IConfigProvider} which contains nested {@link IConfigProviderBase} instances\n */\nexport class CachedConfigProvider implements IConfigProvider {\n private readonly configCache = new Map<string, StronglyTypedValue>();\n private readonly orderedBaseProviders: (IConfigProviderBase | undefined)[];\n\n constructor(\n ... orderedBaseProviders: (IConfigProviderBase | undefined)[]\n ) {\n this.orderedBaseProviders = [];\n const knownProviders = new Set<IConfigProviderBase>();\n const candidateProviders = [...orderedBaseProviders];\n while (candidateProviders.length > 0) {\n const baseProvider = candidateProviders.shift()!;\n if (baseProvider !== undefined\n && isConfigProviderBase(baseProvider)\n && !knownProviders.has(baseProvider)\n ) {\n knownProviders.add(baseProvider);\n if (baseProvider instanceof CachedConfigProvider) {\n candidateProviders.push(...baseProvider.orderedBaseProviders);\n } else {\n this.orderedBaseProviders.push(baseProvider);\n }\n }\n }\n }\n getBoolean(name: string): boolean | undefined {\n return this.getCacheEntry(name)?.boolean;\n }\n getNumber(name: string): number | undefined {\n return this.getCacheEntry(name)?.number;\n }\n getString(name: string): string | undefined {\n return this.getCacheEntry(name)?.string;\n }\n getBooleanArray(name: string): boolean[] | undefined {\n return this.getCacheEntry(name)?.[\"boolean[]\"];\n }\n getNumberArray(name: string): number[] | undefined {\n return this.getCacheEntry(name)?.[\"number[]\"];\n }\n getStringArray(name: string): string[] | undefined {\n return this.getCacheEntry(name)?.[\"string[]\"];\n }\n\n getRawConfig(name: string): ConfigTypes {\n return this.getCacheEntry(name)?.raw;\n }\n\n private getCacheEntry(name: string): StronglyTypedValue | undefined {\n if (!this.configCache.has(name)) {\n for (const provider of this.orderedBaseProviders) {\n const parsed = stronglyTypedParse(provider?.getRawConfig(name));\n if (parsed !== undefined) {\n this.configCache.set(name, parsed);\n return parsed;\n }\n }\n // configs are immutable, if the first lookup returned no results, all lookups should\n this.configCache.set(name, { raw: undefined });\n }\n return this.configCache.get(name);\n }\n}\n\n/**\n * A type containing both a telemetry logger and a configuration provider\n */\nexport interface MonitoringContext<\n L extends ITelemetryBaseLogger = ITelemetryLogger,\n> {\n config: IConfigProvider;\n logger: L;\n}\n\nexport function loggerIsMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLogger>(\n obj: L): obj is L & MonitoringContext<L> {\n const maybeConfig = obj as Partial<MonitoringContext<L>> | undefined;\n return isConfigProviderBase(maybeConfig?.config) && maybeConfig?.logger !== undefined;\n}\n\nexport function loggerToMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLogger>(\n logger: L): MonitoringContext<L> {\n if (loggerIsMonitoringContext<L>(logger)) {\n return logger;\n }\n return mixinMonitoringContext<L>(logger, sessionStorageConfigProvider.value);\n}\n\nexport function mixinMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLogger>(\n logger: L, ... configs: (IConfigProviderBase | undefined)[]) {\n if (loggerIsMonitoringContext<L>(logger)) {\n throw new Error(\"Logger is already a monitoring context\");\n }\n /**\n * this is the tricky bit we use for now to smuggle monitoring context around.\n * To the logger we mixin both config and itself, so mc.logger === logger as it is self-referential.\n * We then expose it as a Monitoring context, so via types we hide the outer logger methods.\n * To layers that expect just a logger we can pass mc.logger, but this is still a MonitoringContext\n * so if a deeper layer then converts that logger to a monitoring context it can find the smuggled properties\n * of the MonitoringContext and get the config provider.\n */\n const mc: L & Partial<MonitoringContext<L>> = logger;\n mc.config = new CachedConfigProvider(...configs);\n mc.logger = logger;\n return mc as MonitoringContext<L>;\n}\n\nfunction isConfigProviderBase(obj: unknown): obj is IConfigProviderBase {\n const maybeConfig = obj as Partial<IConfigProviderBase> | undefined;\n return typeof (maybeConfig?.getRawConfig) === \"function\";\n}\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAsBpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GACrC,IAAI,IAAI,CAAsB,GAAG,EAAE,CAAC,sBAAsB,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;AAEtF,MAAM,kBAAkB,GAAwB;IAC5C,YAAY,EAAE,GAAG,EAAE,CAAC,SAAS;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAC/B,CAAC,OAA4B,EAAuB,EAAE;IACtD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE;QAC3C,OAAO,IAAI,oBAAoB,CAAC;YAC5B,YAAY,EAAE,CAAC,IAAY,EAAE,EAAE;;gBAC3B,IAAI;oBACA,OAAO,MAAA,kBAAkB,CAAC,MAAA,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,mCAAI,SAAS,CAAC,0CAAE,GAAG,CAAC;iBACtE;gBAAC,WAAM,GAAG;gBACX,OAAO,SAAS,CAAC;YACrB,CAAC;SACJ,CAAC,CAAC;KACN;IACD,OAAO,kBAAkB,CAAC;AAC9B,CAAC,CAAC;AAaF,SAAS,eAAe,CAAC,IAAY;IACjC,QAAQ,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;IACN,MAAM,WAAW,GAAG,GAAgD,CAAC;IACrE,OAAO,oBAAoB,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,CAAC,IAAI,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,MAAK,SAAS,CAAC;AAC1F,CAAC;AAED,MAAM,UAAU,yBAAyB,CACrC,MAAS;IACT,IAAI,yBAAyB,CAAI,MAAM,CAAC,EAAE;QACtC,OAAO,MAAM,CAAC;KACjB;IACD,OAAO,sBAAsB,CAAI,MAAM,EAAE,4BAA4B,CAAC,KAAK,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,sBAAsB,CAClC,MAAS,EAAE,GAAI,OAA4C;IAC3D,IAAI,yBAAyB,CAAI,MAAM,CAAC,EAAE;QACtC,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;KAC7D;IACD;;;;;;;OAOG;IACH,MAAM,EAAE,GAAsC,MAAM,CAAC;IACrD,EAAE,CAAC,MAAM,GAAG,IAAI,oBAAoB,CAAC,GAAG,OAAO,CAAC,CAAC;IACjD,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC;IACnB,OAAO,EAA0B,CAAC;AACtC,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAY;IACtC,MAAM,WAAW,GAAG,GAA+C,CAAC;IACpE,OAAO,OAAO,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,YAAY,CAAC,KAAK,UAAU,CAAC;AAC7D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ITelemetryBaseLogger, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { Lazy } from \"@fluidframework/common-utils\";\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 */\nexport interface IConfigProviderBase {\n getRawConfig(name: string): ConfigTypes;\n}\n\n/**\n * Explicitly typed interface for reading configurations\n */\n export interface IConfigProvider extends IConfigProviderBase {\n getBoolean(name: string): boolean | undefined;\n getNumber(name: string): number | undefined;\n getString(name: string): string | undefined;\n getBooleanArray(name: string): boolean[] | undefined;\n getNumberArray(name: string): number[] | undefined;\n getStringArray(name: string): string[] | undefined;\n }\n/**\n * Creates a base configuration provider based on `sessionStorage`\n *\n * @returns A lazy initialized base configuration provider with `sessionStorage` as the underlying config store\n */\nexport const sessionStorageConfigProvider =\n new Lazy<IConfigProviderBase>(() => inMemoryConfigProvider(safeSessionStorage()));\n\nconst NullConfigProvider: IConfigProviderBase = {\n getRawConfig: () => undefined,\n};\n\n/**\n * Creates a base configuration provider based on the supplied `Storage` instance\n *\n * @param storage - instance of `Storage` to be used as storage media for the config\n * @returns A base configuration provider with\n * the supplied `Storage` instance as the underlying config store\n */\nexport const inMemoryConfigProvider =\n (storage: Storage | undefined): IConfigProviderBase => {\n if (storage !== undefined && storage !== null) {\n return new CachedConfigProvider({\n getRawConfig: (name: string) => {\n try {\n return stronglyTypedParse(storage.getItem(name) ?? undefined)?.raw;\n } catch { }\n return undefined;\n },\n });\n }\n return NullConfigProvider;\n};\n\ninterface ConfigTypeStringToType {\n number: number;\n string: string;\n boolean: boolean;\n [\"number[]\"]: number[];\n [\"string[]\"]: string[];\n [\"boolean[]\"]: boolean[];\n}\n\ntype PrimitiveTypeStrings = \"number\" | \"string\" | \"boolean\";\n\nfunction isPrimitiveType(type: string): type is PrimitiveTypeStrings {\n switch (type) {\n case \"boolean\":\n case \"number\":\n case \"string\":\n return true;\n default:\n return false;\n }\n}\n\ninterface StronglyTypedValue extends Partial<ConfigTypeStringToType> {\n raw: ConfigTypes;\n}\n/**\n * Takes any supported config type, and returns the value with a strong type. If the type of\n * the config is not a supported type undefined will be returned.\n * The user of this function should cache the result to avoid duplicated work.\n *\n * Strings will be attempted to be parsed and coerced into a strong config type.\n * if it is not possible to parsed and coerce a string to a strong config type the original string\n * will be return with a string type for the consumer to handle further if necessary.\n */\nfunction stronglyTypedParse(input: ConfigTypes): StronglyTypedValue | undefined {\n let output: ConfigTypes = input;\n let defaultReturn: Pick<StronglyTypedValue, \"raw\" | \"string\"> | undefined;\n // we do special handling for strings to try and coerce\n // them into a config type if we can. This makes it easy\n // for config sources like sessionStorage which only\n // holds strings\n if (typeof input === \"string\") {\n try {\n output = JSON.parse(input);\n // we succeeded in parsing, but we don't support parsing\n // for any object as we can't do it type safely\n // so in this case, the default return will be string\n // rather than undefined, and the consumer\n // can parse, as we don't want to provide\n // a false sense of security by just\n // casting.\n defaultReturn = { raw: input, string: input };\n } catch { }\n }\n\n if (output === undefined) {\n return defaultReturn;\n }\n\n const outputType = typeof output;\n if (isPrimitiveType(outputType)) {\n return { ...defaultReturn, raw: input, [outputType]: output };\n }\n\n if (Array.isArray(output)) {\n const firstType = typeof output[0];\n // ensure the first elements is a primitive type\n if (!isPrimitiveType(firstType)) {\n return defaultReturn;\n }\n // ensue all the elements types are homogeneous\n // aka they all have the same type as the first\n for (const v of output) {\n if (typeof v !== firstType) {\n return defaultReturn;\n }\n }\n return { ...defaultReturn, raw: input, [`${firstType}[]`]: output };\n }\n\n return defaultReturn;\n}\n\n/** `sessionStorage` is undefined in some environments such as Node */\nconst safeSessionStorage = (): Storage | undefined => {\n return globalThis.sessionStorage;\n};\n\n/**\n * Implementation of {@link IConfigProvider} which contains nested {@link IConfigProviderBase} instances\n */\nexport class CachedConfigProvider implements IConfigProvider {\n private readonly configCache = new Map<string, StronglyTypedValue>();\n private readonly orderedBaseProviders: (IConfigProviderBase | undefined)[];\n\n constructor(\n ... orderedBaseProviders: (IConfigProviderBase | undefined)[]\n ) {\n this.orderedBaseProviders = [];\n const knownProviders = new Set<IConfigProviderBase>();\n const candidateProviders = [...orderedBaseProviders];\n while (candidateProviders.length > 0) {\n const baseProvider = candidateProviders.shift()!;\n if (baseProvider !== undefined\n && isConfigProviderBase(baseProvider)\n && !knownProviders.has(baseProvider)\n ) {\n knownProviders.add(baseProvider);\n if (baseProvider instanceof CachedConfigProvider) {\n candidateProviders.push(...baseProvider.orderedBaseProviders);\n } else {\n this.orderedBaseProviders.push(baseProvider);\n }\n }\n }\n }\n getBoolean(name: string): boolean | undefined {\n return this.getCacheEntry(name)?.boolean;\n }\n getNumber(name: string): number | undefined {\n return this.getCacheEntry(name)?.number;\n }\n getString(name: string): string | undefined {\n return this.getCacheEntry(name)?.string;\n }\n getBooleanArray(name: string): boolean[] | undefined {\n return this.getCacheEntry(name)?.[\"boolean[]\"];\n }\n getNumberArray(name: string): number[] | undefined {\n return this.getCacheEntry(name)?.[\"number[]\"];\n }\n getStringArray(name: string): string[] | undefined {\n return this.getCacheEntry(name)?.[\"string[]\"];\n }\n\n getRawConfig(name: string): ConfigTypes {\n return this.getCacheEntry(name)?.raw;\n }\n\n private getCacheEntry(name: string): StronglyTypedValue | undefined {\n if (!this.configCache.has(name)) {\n for (const provider of this.orderedBaseProviders) {\n const parsed = stronglyTypedParse(provider?.getRawConfig(name));\n if (parsed !== undefined) {\n this.configCache.set(name, parsed);\n return parsed;\n }\n }\n // configs are immutable, if the first lookup returned no results, all lookups should\n this.configCache.set(name, { raw: undefined });\n }\n return this.configCache.get(name);\n }\n}\n\n/**\n * A type containing both a telemetry logger and a configuration provider\n */\nexport interface MonitoringContext<\n L extends ITelemetryBaseLogger = ITelemetryLogger,\n> {\n config: IConfigProvider;\n logger: L;\n}\n\nexport function loggerIsMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLogger>(\n obj: L): obj is L & MonitoringContext<L> {\n const maybeConfig = obj as Partial<MonitoringContext<L>> | undefined;\n return isConfigProviderBase(maybeConfig?.config) && maybeConfig?.logger !== undefined;\n}\n\nexport function loggerToMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLogger>(\n logger: L): MonitoringContext<L> {\n if (loggerIsMonitoringContext<L>(logger)) {\n return logger;\n }\n return mixinMonitoringContext<L>(logger, sessionStorageConfigProvider.value);\n}\n\nexport function mixinMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLogger>(\n logger: L, ... configs: (IConfigProviderBase | undefined)[]) {\n if (loggerIsMonitoringContext<L>(logger)) {\n throw new Error(\"Logger is already a monitoring context\");\n }\n /**\n * this is the tricky bit we use for now to smuggle monitoring context around.\n * To the logger we mixin both config and itself, so mc.logger === logger as it is self-referential.\n * We then expose it as a Monitoring context, so via types we hide the outer logger methods.\n * To layers that expect just a logger we can pass mc.logger, but this is still a MonitoringContext\n * so if a deeper layer then converts that logger to a monitoring context it can find the smuggled properties\n * of the MonitoringContext and get the config provider.\n */\n const mc: L & Partial<MonitoringContext<L>> = logger;\n mc.config = new CachedConfigProvider(...configs);\n mc.logger = logger;\n return mc as MonitoringContext<L>;\n}\n\nfunction isConfigProviderBase(obj: unknown): obj is IConfigProviderBase {\n const maybeConfig = obj as Partial<IConfigProviderBase> | undefined;\n return typeof (maybeConfig?.getRawConfig) === \"function\";\n}\n"]}
@@ -47,7 +47,8 @@ export declare function wrapError<T extends LoggingError>(innerError: unknown, n
47
47
  export declare function wrapErrorAndLog<T extends LoggingError>(innerError: unknown, newErrorFn: (message: string) => T, logger: ITelemetryLogger): T;
48
48
  /**
49
49
  * True for any error object that is an (optionally normalized) external error
50
- * False for any error we created and raised within the FF codebase, or wrapped in a well-known error type
50
+ * False for any error we created and raised within the FF codebase via LoggingError base class,
51
+ * or wrapped in a well-known error type
51
52
  */
52
53
  export declare function isExternalError(e: any): boolean;
53
54
  /**
@@ -83,6 +84,12 @@ export declare class LoggingError extends Error implements ILoggingError, Omit<I
83
84
  * @param omitPropsFromLogging - properties by name to omit from telemetry props
84
85
  */
85
86
  constructor(message: string, props?: ITelemetryProperties, omitPropsFromLogging?: Set<string>);
87
+ /**
88
+ * Determines if a given object is an instance of a LoggingError
89
+ * @param object - any object
90
+ * @returns - true if the object is an instance of a LoggingError, false if not.
91
+ */
92
+ static typeCheck(object: unknown): object is LoggingError;
86
93
  /**
87
94
  * Add additional properties to be logged
88
95
  */
@@ -92,4 +99,6 @@ export declare class LoggingError extends Error implements ILoggingError, Omit<I
92
99
  */
93
100
  getTelemetryProperties(): ITelemetryProperties;
94
101
  }
102
+ /** The Error class used when normalizing an external error */
103
+ export declare const NORMALIZED_ERROR_TYPE = "genericError";
95
104
  //# sourceMappingURL=errorLogging.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errorLogging.d.ts","sourceRoot":"","sources":["../src/errorLogging.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,aAAa,EACb,4BAA4B,EAC5B,gBAAgB,EAChB,oBAAoB,EACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAEH,eAAe,EAGlB,MAAM,kBAAkB,CAAC;AAO1B,sEAAsE;AACtE,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO;aAiBhD,MAAM;;;EAkBrC;AAED,6CAA6C;AAC7C,eAAO,MAAM,eAAe,MAAO,GAAG,uBAAwE,CAAC;AAW/G,6EAA6E;AAC7E,MAAM,WAAW,sBAAsB;IACnC,4CAA4C;IAC5C,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAYD;;;;;GAKG;AACH,wBAAgB,cAAc,CAC1B,KAAK,EAAE,OAAO,EACd,WAAW,GAAE,sBAA2B,GACzC,eAAe,CAwCjB;AAID;;;;;;;;GAQG;AACF,wBAAgB,sBAAsB,IAAI,KAAK,CAgB/C;AAED,wBAAgB,aAAa,IAAI,MAAM,GAAG,SAAS,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,YAAY,EAC5C,UAAU,EAAE,OAAO,EACnB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,CAAC,GACnC,CAAC,CAgCH;AAED,sGAAsG;AACtG,wBAAgB,eAAe,CAAC,CAAC,SAAS,YAAY,EAClD,UAAU,EAAE,OAAO,EACnB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,CAAC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