@fluidframework/telemetry-utils 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.3.1.0.125672

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 (103) hide show
  1. package/.eslintrc.js +11 -13
  2. package/.mocharc.js +2 -2
  3. package/api-extractor.json +2 -2
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/config.js +3 -3
  6. package/dist/config.js.map +1 -1
  7. package/dist/debugLogger.d.ts.map +1 -1
  8. package/dist/debugLogger.js.map +1 -1
  9. package/dist/errorLogging.d.ts +8 -7
  10. package/dist/errorLogging.d.ts.map +1 -1
  11. package/dist/errorLogging.js +23 -20
  12. package/dist/errorLogging.js.map +1 -1
  13. package/dist/eventEmitterWithErrorHandling.d.ts.map +1 -1
  14. package/dist/eventEmitterWithErrorHandling.js.map +1 -1
  15. package/dist/events.d.ts.map +1 -1
  16. package/dist/events.js.map +1 -1
  17. package/dist/fluidErrorBase.d.ts.map +1 -1
  18. package/dist/fluidErrorBase.js +4 -4
  19. package/dist/fluidErrorBase.js.map +1 -1
  20. package/dist/index.d.ts +3 -2
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/logger.d.ts +15 -4
  24. package/dist/logger.d.ts.map +1 -1
  25. package/dist/logger.js +69 -11
  26. package/dist/logger.js.map +1 -1
  27. package/dist/mockLogger.d.ts +12 -2
  28. package/dist/mockLogger.d.ts.map +1 -1
  29. package/dist/mockLogger.js +24 -2
  30. package/dist/mockLogger.js.map +1 -1
  31. package/dist/packageVersion.d.ts +1 -1
  32. package/dist/packageVersion.js +1 -1
  33. package/dist/packageVersion.js.map +1 -1
  34. package/dist/sampledTelemetryHelper.d.ts.map +1 -1
  35. package/dist/sampledTelemetryHelper.js.map +1 -1
  36. package/dist/telemetryTypes.d.ts +81 -0
  37. package/dist/telemetryTypes.d.ts.map +1 -0
  38. package/dist/telemetryTypes.js +7 -0
  39. package/dist/telemetryTypes.js.map +1 -0
  40. package/dist/thresholdCounter.d.ts.map +1 -1
  41. package/dist/thresholdCounter.js.map +1 -1
  42. package/dist/utils.d.ts.map +1 -1
  43. package/dist/utils.js.map +1 -1
  44. package/lib/config.d.ts.map +1 -1
  45. package/lib/config.js +3 -3
  46. package/lib/config.js.map +1 -1
  47. package/lib/debugLogger.d.ts.map +1 -1
  48. package/lib/debugLogger.js +1 -1
  49. package/lib/debugLogger.js.map +1 -1
  50. package/lib/errorLogging.d.ts +8 -7
  51. package/lib/errorLogging.d.ts.map +1 -1
  52. package/lib/errorLogging.js +23 -20
  53. package/lib/errorLogging.js.map +1 -1
  54. package/lib/eventEmitterWithErrorHandling.d.ts.map +1 -1
  55. package/lib/eventEmitterWithErrorHandling.js.map +1 -1
  56. package/lib/events.d.ts.map +1 -1
  57. package/lib/events.js.map +1 -1
  58. package/lib/fluidErrorBase.d.ts.map +1 -1
  59. package/lib/fluidErrorBase.js +4 -4
  60. package/lib/fluidErrorBase.js.map +1 -1
  61. package/lib/index.d.ts +3 -2
  62. package/lib/index.d.ts.map +1 -1
  63. package/lib/index.js +2 -2
  64. package/lib/index.js.map +1 -1
  65. package/lib/logger.d.ts +15 -4
  66. package/lib/logger.d.ts.map +1 -1
  67. package/lib/logger.js +69 -12
  68. package/lib/logger.js.map +1 -1
  69. package/lib/mockLogger.d.ts +12 -2
  70. package/lib/mockLogger.d.ts.map +1 -1
  71. package/lib/mockLogger.js +24 -2
  72. package/lib/mockLogger.js.map +1 -1
  73. package/lib/packageVersion.d.ts +1 -1
  74. package/lib/packageVersion.js +1 -1
  75. package/lib/packageVersion.js.map +1 -1
  76. package/lib/sampledTelemetryHelper.d.ts.map +1 -1
  77. package/lib/sampledTelemetryHelper.js.map +1 -1
  78. package/lib/telemetryTypes.d.ts +81 -0
  79. package/lib/telemetryTypes.d.ts.map +1 -0
  80. package/lib/telemetryTypes.js +6 -0
  81. package/lib/telemetryTypes.js.map +1 -0
  82. package/lib/thresholdCounter.d.ts.map +1 -1
  83. package/lib/thresholdCounter.js.map +1 -1
  84. package/lib/utils.d.ts.map +1 -1
  85. package/lib/utils.js.map +1 -1
  86. package/package.json +14 -12
  87. package/prettier.config.cjs +1 -1
  88. package/src/config.ts +173 -172
  89. package/src/debugLogger.ts +118 -111
  90. package/src/errorLogging.ts +306 -300
  91. package/src/eventEmitterWithErrorHandling.ts +16 -12
  92. package/src/events.ts +26 -26
  93. package/src/fluidErrorBase.ts +42 -38
  94. package/src/index.ts +29 -9
  95. package/src/logger.ts +568 -500
  96. package/src/mockLogger.ts +118 -88
  97. package/src/packageVersion.ts +1 -1
  98. package/src/sampledTelemetryHelper.ts +122 -122
  99. package/src/telemetryTypes.ts +96 -0
  100. package/src/thresholdCounter.ts +34 -34
  101. package/src/utils.ts +15 -15
  102. package/tsconfig.esnext.json +6 -6
  103. package/tsconfig.json +9 -13
package/dist/index.d.ts CHANGED
@@ -6,11 +6,12 @@ export { MonitoringContext, IConfigProviderBase, sessionStorageConfigProvider, m
6
6
  export { DebugLogger } from "./debugLogger";
7
7
  export { extractLogSafeErrorProperties, generateErrorWithStack, generateStack, getCircularReplacer, IFluidErrorAnnotations, isExternalError, isILoggingError, isTaggedTelemetryPropertyValue, LoggingError, NORMALIZED_ERROR_TYPE, normalizeError, wrapError, wrapErrorAndLog, } from "./errorLogging";
8
8
  export { EventEmitterWithErrorHandling } from "./eventEmitterWithErrorHandling";
9
- export { connectedEventName, disconnectedEventName, raiseConnectedEvent, safeRaiseEvent } from "./events";
10
- export { hasErrorInstanceId, IFluidErrorBase, isFluidError, isValidLegacyError } from "./fluidErrorBase";
9
+ export { connectedEventName, disconnectedEventName, raiseConnectedEvent, safeRaiseEvent, } from "./events";
10
+ export { hasErrorInstanceId, IFluidErrorBase, isFluidError, isValidLegacyError, } from "./fluidErrorBase";
11
11
  export { BaseTelemetryNullLogger, ChildLogger, IPerformanceEventMarkers, ITelemetryLoggerPropertyBag, ITelemetryLoggerPropertyBags, MultiSinkLogger, PerformanceEvent, TaggedLoggerAdapter, TelemetryDataTag, TelemetryEventPropertyTypes, TelemetryLogger, TelemetryNullLogger, TelemetryUTLogger, } from "./logger";
12
12
  export { MockLogger } from "./mockLogger";
13
13
  export { ThresholdCounter } from "./thresholdCounter";
14
14
  export { SampledTelemetryHelper } from "./sampledTelemetryHelper";
15
15
  export { logIfFalse } from "./utils";
16
+ export { TelemetryEventPropertyTypeExt, ITelemetryEventExt, ITelemetryGenericEventExt, ITelemetryErrorEventExt, ITelemetryPerformanceEventExt, ITelemetryLoggerExt, ITaggedTelemetryPropertyTypeExt, ITelemetryPropertiesExt, } from "./telemetryTypes";
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACH,iBAAiB,EACjB,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,yBAAyB,GAC5B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACN,6BAA6B,EAC7B,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,8BAA8B,EAC9B,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,eAAe,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1G,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACzG,OAAO,EACN,uBAAuB,EACvB,WAAW,EACX,wBAAwB,EACxB,2BAA2B,EAC3B,4BAA4B,EAC5B,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,2BAA2B,EAC3B,eAAe,EACf,mBAAmB,EACnB,iBAAiB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,iBAAiB,EACjB,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,yBAAyB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACN,6BAA6B,EAC7B,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,8BAA8B,EAC9B,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,eAAe,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACN,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,GACd,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,uBAAuB,EACvB,WAAW,EACX,wBAAwB,EACxB,2BAA2B,EAC3B,4BAA4B,EAC5B,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,2BAA2B,EAC3B,eAAe,EACf,mBAAmB,EACnB,iBAAiB,GACjB,MAAM,UAAU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jB,iHAAA,uBAAuB,OAAA;AACvB,qGAAA,WAAW,OAAA;AAIX,yGAAA,eAAe,OAAA;AACf,0GAAA,gBAAgB,OAAA;AAChB,6GAAA,mBAAmB,OAAA;AACnB,0GAAA,gBAAgB,OAAA;AAEhB,yGAAA,eAAe,OAAA;AACf,6GAAA,mBAAmB,OAAA;AACnB,2GAAA,iBAAiB,OAAA;AAElB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,iCAAqC;AAA5B,mGAAA,UAAU,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nexport {\n MonitoringContext,\n IConfigProviderBase,\n sessionStorageConfigProvider,\n mixinMonitoringContext,\n IConfigProvider,\n ConfigTypes,\n loggerToMonitoringContext,\n} from \"./config\";\nexport { DebugLogger } from \"./debugLogger\";\nexport {\n\textractLogSafeErrorProperties,\n\tgenerateErrorWithStack,\n\tgenerateStack,\n\tgetCircularReplacer,\n\tIFluidErrorAnnotations,\n\tisExternalError,\n\tisILoggingError,\n\tisTaggedTelemetryPropertyValue,\n\tLoggingError,\n\tNORMALIZED_ERROR_TYPE,\n\tnormalizeError,\n\twrapError,\n\twrapErrorAndLog,\n} from \"./errorLogging\";\nexport { EventEmitterWithErrorHandling } from \"./eventEmitterWithErrorHandling\";\nexport { connectedEventName, disconnectedEventName, raiseConnectedEvent, safeRaiseEvent } from \"./events\";\nexport { hasErrorInstanceId, IFluidErrorBase, isFluidError, isValidLegacyError } from \"./fluidErrorBase\";\nexport {\n\tBaseTelemetryNullLogger,\n\tChildLogger,\n\tIPerformanceEventMarkers,\n\tITelemetryLoggerPropertyBag,\n\tITelemetryLoggerPropertyBags,\n\tMultiSinkLogger,\n\tPerformanceEvent,\n\tTaggedLoggerAdapter,\n\tTelemetryDataTag,\n\tTelemetryEventPropertyTypes,\n\tTelemetryLogger,\n\tTelemetryNullLogger,\n\tTelemetryUTLogger,\n} from \"./logger\";\nexport { MockLogger } from \"./mockLogger\";\nexport { ThresholdCounter } from \"./thresholdCounter\";\nexport { SampledTelemetryHelper } from \"./sampledTelemetryHelper\";\nexport { logIfFalse } from \"./utils\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,mCAQkB;AALjB,sHAAA,4BAA4B,OAAA;AAC5B,gHAAA,sBAAsB,OAAA;AAGtB,mHAAA,yBAAyB,OAAA;AAE1B,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,+CAcwB;AAbvB,6HAAA,6BAA6B,OAAA;AAC7B,sHAAA,sBAAsB,OAAA;AACtB,6GAAA,aAAa,OAAA;AACb,mHAAA,mBAAmB,OAAA;AAEnB,+GAAA,eAAe,OAAA;AACf,+GAAA,eAAe,OAAA;AACf,8HAAA,8BAA8B,OAAA;AAC9B,4GAAA,YAAY,OAAA;AACZ,qHAAA,qBAAqB,OAAA;AACrB,8GAAA,cAAc,OAAA;AACd,yGAAA,SAAS,OAAA;AACT,+GAAA,eAAe,OAAA;AAEhB,iFAAgF;AAAvE,8IAAA,6BAA6B,OAAA;AACtC,mCAKkB;AAJjB,4GAAA,kBAAkB,OAAA;AAClB,+GAAA,qBAAqB,OAAA;AACrB,6GAAA,mBAAmB,OAAA;AACnB,wGAAA,cAAc,OAAA;AAEf,mDAK0B;AAJzB,oHAAA,kBAAkB,OAAA;AAElB,8GAAA,YAAY,OAAA;AACZ,oHAAA,kBAAkB,OAAA;AAEnB,mCAckB;AAbjB,iHAAA,uBAAuB,OAAA;AACvB,qGAAA,WAAW,OAAA;AAIX,yGAAA,eAAe,OAAA;AACf,0GAAA,gBAAgB,OAAA;AAChB,6GAAA,mBAAmB,OAAA;AACnB,0GAAA,gBAAgB,OAAA;AAEhB,yGAAA,eAAe,OAAA;AACf,6GAAA,mBAAmB,OAAA;AACnB,2GAAA,iBAAiB,OAAA;AAElB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,iCAAqC;AAA5B,mGAAA,UAAU,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nexport {\n\tMonitoringContext,\n\tIConfigProviderBase,\n\tsessionStorageConfigProvider,\n\tmixinMonitoringContext,\n\tIConfigProvider,\n\tConfigTypes,\n\tloggerToMonitoringContext,\n} from \"./config\";\nexport { DebugLogger } from \"./debugLogger\";\nexport {\n\textractLogSafeErrorProperties,\n\tgenerateErrorWithStack,\n\tgenerateStack,\n\tgetCircularReplacer,\n\tIFluidErrorAnnotations,\n\tisExternalError,\n\tisILoggingError,\n\tisTaggedTelemetryPropertyValue,\n\tLoggingError,\n\tNORMALIZED_ERROR_TYPE,\n\tnormalizeError,\n\twrapError,\n\twrapErrorAndLog,\n} from \"./errorLogging\";\nexport { EventEmitterWithErrorHandling } from \"./eventEmitterWithErrorHandling\";\nexport {\n\tconnectedEventName,\n\tdisconnectedEventName,\n\traiseConnectedEvent,\n\tsafeRaiseEvent,\n} from \"./events\";\nexport {\n\thasErrorInstanceId,\n\tIFluidErrorBase,\n\tisFluidError,\n\tisValidLegacyError,\n} from \"./fluidErrorBase\";\nexport {\n\tBaseTelemetryNullLogger,\n\tChildLogger,\n\tIPerformanceEventMarkers,\n\tITelemetryLoggerPropertyBag,\n\tITelemetryLoggerPropertyBags,\n\tMultiSinkLogger,\n\tPerformanceEvent,\n\tTaggedLoggerAdapter,\n\tTelemetryDataTag,\n\tTelemetryEventPropertyTypes,\n\tTelemetryLogger,\n\tTelemetryNullLogger,\n\tTelemetryUTLogger,\n} from \"./logger\";\nexport { MockLogger } from \"./mockLogger\";\nexport { ThresholdCounter } from \"./thresholdCounter\";\nexport { SampledTelemetryHelper } from \"./sampledTelemetryHelper\";\nexport { logIfFalse } from \"./utils\";\nexport {\n\tTelemetryEventPropertyTypeExt,\n\tITelemetryEventExt,\n\tITelemetryGenericEventExt,\n\tITelemetryErrorEventExt,\n\tITelemetryPerformanceEventExt,\n\tITelemetryLoggerExt,\n\tITaggedTelemetryPropertyTypeExt,\n\tITelemetryPropertiesExt,\n} from \"./telemetryTypes\";\n"]}
package/dist/logger.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ITelemetryBaseEvent, ITelemetryBaseLogger, ITelemetryErrorEvent, ITelemetryGenericEvent, ITelemetryLogger, ITelemetryPerformanceEvent, ITelemetryProperties, TelemetryEventPropertyType, ITaggedTelemetryPropertyType, TelemetryEventCategory } from "@fluidframework/common-definitions";
6
+ import { ITaggedTelemetryPropertyTypeExt, ITelemetryGenericEventExt, ITelemetryLoggerExt, ITelemetryPerformanceEventExt, TelemetryEventPropertyTypeExt } from "./telemetryTypes";
6
7
  /**
7
8
  * Broad classifications to be applied to individual properties as they're prepared to be logged to telemetry.
8
9
  * Please do not modify existing entries for backwards compatibility.
@@ -26,7 +27,7 @@ export interface ITelemetryLoggerPropertyBags {
26
27
  * encoding in one place schemas for various types of Fluid telemetry events.
27
28
  * Creates sub-logger that appends properties to all events
28
29
  */
29
- export declare abstract class TelemetryLogger implements ITelemetryLogger {
30
+ export declare abstract class TelemetryLogger implements ITelemetryLoggerExt {
30
31
  protected readonly namespace?: string | undefined;
31
32
  protected readonly properties?: ITelemetryLoggerPropertyBags | undefined;
32
33
  static readonly eventNamespaceSeparator = ":";
@@ -60,14 +61,14 @@ export declare abstract class TelemetryLogger implements ITelemetryLogger {
60
61
  * @param event - the event to send
61
62
  * @param error - optional error object to log
62
63
  */
63
- sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any): void;
64
+ sendTelemetryEvent(event: ITelemetryGenericEventExt, error?: any): void;
64
65
  /**
65
66
  * Send a telemetry event with the logger
66
67
  *
67
68
  * @param event - the event to send
68
69
  * @param error - optional error object to log
69
70
  */
70
- protected sendTelemetryEventCore(event: ITelemetryGenericEvent & {
71
+ protected sendTelemetryEventCore(event: ITelemetryGenericEventExt & {
71
72
  category: TelemetryEventCategory;
72
73
  }, error?: any): void;
73
74
  /**
@@ -83,7 +84,7 @@ export declare abstract class TelemetryLogger implements ITelemetryLogger {
83
84
  * @param event - Event to send
84
85
  * @param error - optional error object to log
85
86
  */
86
- sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void;
87
+ sendPerformanceEvent(event: ITelemetryPerformanceEventExt, error?: any): void;
87
88
  protected prepareEvent(event: ITelemetryBaseEvent): ITelemetryBaseEvent;
88
89
  }
89
90
  /**
@@ -218,4 +219,14 @@ export declare class TelemetryNullLogger implements ITelemetryLogger {
218
219
  sendErrorEvent(event: ITelemetryErrorEvent, error?: any): void;
219
220
  sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void;
220
221
  }
222
+ /**
223
+ * Takes in value, and does one of 4 things.
224
+ * if value is of primitive type - returns the original value.
225
+ * If the value is an array of primitives - returns a stringified version of the array.
226
+ * If the value is an object of type ITaggedTelemetryPropertyType - returns the object
227
+ * with its values recursively converted to base property Type.
228
+ * If none of these cases are reached - returns an error string
229
+ * @param x - value passed in to convert to a base property type
230
+ */
231
+ export declare function convertToBasePropertyType(x: TelemetryEventPropertyTypeExt | ITaggedTelemetryPropertyTypeExt): TelemetryEventPropertyType | ITaggedTelemetryPropertyType;
221
232
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,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,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI;IAC9D,oBAAoB,CAAC,KAAK,EAAE,0BAA0B,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI;CACjF;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACxC,CAAC,EAAE,6BAA6B,GAAG,+BAA+B,GAChE,0BAA0B,GAAG,4BAA4B,CAO3D"}
package/dist/logger.js CHANGED
@@ -3,8 +3,19 @@
3
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
4
  * Licensed under the MIT License.
5
5
  */
6
+ var __rest = (this && this.__rest) || function (s, e) {
7
+ var t = {};
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
9
+ t[p] = s[p];
10
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
11
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
12
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
13
+ t[p[i]] = s[p[i]];
14
+ }
15
+ return t;
16
+ };
6
17
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.TelemetryNullLogger = exports.BaseTelemetryNullLogger = exports.TelemetryUTLogger = exports.PerformanceEvent = exports.MultiSinkLogger = exports.ChildLogger = exports.TaggedLoggerAdapter = exports.TelemetryLogger = exports.TelemetryDataTag = void 0;
18
+ exports.convertToBasePropertyType = exports.TelemetryNullLogger = exports.BaseTelemetryNullLogger = exports.TelemetryUTLogger = exports.PerformanceEvent = exports.MultiSinkLogger = exports.ChildLogger = exports.TaggedLoggerAdapter = exports.TelemetryLogger = exports.TelemetryDataTag = void 0;
8
19
  const common_utils_1 = require("@fluidframework/common-utils");
9
20
  const config_1 = require("./config");
10
21
  const errorLogging_1 = require("./errorLogging");
@@ -94,7 +105,7 @@ class TelemetryLogger {
94
105
  * @param error - optional error object to log
95
106
  */
96
107
  sendTelemetryEventCore(event, error) {
97
- const newEvent = Object.assign({}, event);
108
+ const newEvent = convertToBaseEvent(event);
98
109
  if (error !== undefined) {
99
110
  TelemetryLogger.prepareErrorObject(newEvent, error, false);
100
111
  }
@@ -176,7 +187,7 @@ class TaggedLoggerAdapter {
176
187
  };
177
188
  for (const key of Object.keys(eventWithTagsMaybe)) {
178
189
  const taggableProp = eventWithTagsMaybe[key];
179
- const { value, tag } = (typeof taggableProp === "object")
190
+ const { value, tag } = typeof taggableProp === "object"
180
191
  ? taggableProp
181
192
  : { value: taggableProp, tag: undefined };
182
193
  switch (tag) {
@@ -305,6 +316,7 @@ exports.MultiSinkLogger = MultiSinkLogger;
305
316
  */
306
317
  class PerformanceEvent {
307
318
  constructor(logger, event, markers = { end: true, cancel: "generic" }) {
319
+ var _a;
308
320
  this.logger = logger;
309
321
  this.markers = markers;
310
322
  this.startTime = common_utils_1.performance.now();
@@ -312,7 +324,7 @@ class PerformanceEvent {
312
324
  if (this.markers.start) {
313
325
  this.reportEvent("start");
314
326
  }
315
- if (typeof window === "object" && window != null && window.performance) {
327
+ if (typeof window === "object" && window != null && ((_a = window.performance) === null || _a === void 0 ? void 0 : _a.mark)) {
316
328
  this.startMark = `${event.eventName}-start`;
317
329
  window.performance.mark(this.startMark);
318
330
  }
@@ -344,7 +356,9 @@ class PerformanceEvent {
344
356
  throw error;
345
357
  }
346
358
  }
347
- get duration() { return common_utils_1.performance.now() - this.startTime; }
359
+ get duration() {
360
+ return common_utils_1.performance.now() - this.startTime;
361
+ }
348
362
  reportProgress(props, eventNameSuffix = "update") {
349
363
  this.reportEvent(eventNameSuffix, props);
350
364
  }
@@ -399,15 +413,12 @@ exports.PerformanceEvent = PerformanceEvent;
399
413
  * It can be used in places where logger instance is required, but events should be not send over.
400
414
  */
401
415
  class TelemetryUTLogger {
402
- send(event) {
403
- }
404
- sendTelemetryEvent(event, error) {
405
- }
416
+ send(event) { }
417
+ sendTelemetryEvent(event, error) { }
406
418
  sendErrorEvent(event, error) {
407
419
  this.reportError("errorEvent in UT logger!", event, error);
408
420
  }
409
- sendPerformanceEvent(event, error) {
410
- }
421
+ sendPerformanceEvent(event, error) { }
411
422
  logGenericError(eventName, error) {
412
423
  this.reportError(`genericError in UT logger!`, { eventName }, error);
413
424
  }
@@ -457,4 +468,51 @@ class TelemetryNullLogger {
457
468
  sendPerformanceEvent(event, error) { }
458
469
  }
459
470
  exports.TelemetryNullLogger = TelemetryNullLogger;
471
+ /**
472
+ * Takes in an event object, and converts all of its values to a basePropertyType.
473
+ * In the case of an invalid property type, the value will be converted to an error string.
474
+ * @param event - Event with fields you want to stringify.
475
+ */
476
+ function convertToBaseEvent(_a) {
477
+ var { category, eventName } = _a, props = __rest(_a, ["category", "eventName"]);
478
+ const newEvent = { category, eventName };
479
+ for (const key of Object.keys(props)) {
480
+ newEvent[key] = convertToBasePropertyType(props[key]);
481
+ }
482
+ return newEvent;
483
+ }
484
+ /**
485
+ * Takes in value, and does one of 4 things.
486
+ * if value is of primitive type - returns the original value.
487
+ * If the value is an array of primitives - returns a stringified version of the array.
488
+ * If the value is an object of type ITaggedTelemetryPropertyType - returns the object
489
+ * with its values recursively converted to base property Type.
490
+ * If none of these cases are reached - returns an error string
491
+ * @param x - value passed in to convert to a base property type
492
+ */
493
+ function convertToBasePropertyType(x) {
494
+ return (0, errorLogging_1.isTaggedTelemetryPropertyValue)(x)
495
+ ? {
496
+ value: convertToBasePropertyTypeUntagged(x.value),
497
+ tag: x.tag,
498
+ }
499
+ : convertToBasePropertyTypeUntagged(x);
500
+ }
501
+ exports.convertToBasePropertyType = convertToBasePropertyType;
502
+ function convertToBasePropertyTypeUntagged(x) {
503
+ switch (typeof x) {
504
+ case "string":
505
+ case "number":
506
+ case "boolean":
507
+ case "undefined":
508
+ return x;
509
+ case "object":
510
+ // We assume this is an array based on the input types
511
+ return JSON.stringify(x);
512
+ default:
513
+ // should never reach this case based on the input types
514
+ console.error(`convertToBasePropertyTypeUntagged: INVALID PROPERTY (typed as ${typeof x})`);
515
+ return `INVALID PROPERTY (typed as ${typeof x})`;
516
+ }
517
+ }
460
518
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAcH,+DAA2D;AAC3D,qCAIkB;AAClB,iDAIwB;AAExB;;;GAGG;AACH,IAAY,gBAKX;AALD,WAAY,gBAAgB;IACxB,4FAA4F;IAC5F,iDAA6B,CAAA;IAC7B,8EAA8E;IAC9E,yCAAqB,CAAA;AACzB,CAAC,EALW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAK3B;AAYD;;;;GAIG;AACH,MAAsB,eAAe;IAyDjC,YACuB,SAAkB,EAClB,UAAyC;QADzC,cAAS,GAAT,SAAS,CAAS;QAClB,eAAU,GAAV,UAAU,CAA+B;IAChE,CAAC;IAzDM,MAAM,CAAC,UAAU,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,gBAAgB,CAAC,GAA8B;QACzD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE;YACnC,OAAO,SAAS,CAAC;SACpB;QACD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACzC,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,IAAY;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,kBAAkB,CAAC,KAA0B,EAAE,KAAU,EAAE,UAAmB;QACxF,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK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C,KAAK,CAAC,CAAC;QACrB,MAAM,KAAK,CAAC;IAChB,CAAC;CACJ;AAhCD,8CAgCC;AAED;;;GAGG;AACH,MAAa,uBAAuB;IAChC;;;;OAIG;IACI,IAAI,CAAC,KAA0B;QAClC,OAAO;IACX,CAAC;CACJ;AATD,0DASC;AAED;;;GAGG;AACH,MAAa,mBAAmB;IACrB,IAAI,CAAC,KAA0B,IAAS,CAAC;IACzC,kBAAkB,CAAC,KAA6B,EAAE,KAAW,IAAS,CAAC;IACvE,cAAc,CAAC,KAA2B,EAAE,KAAW,IAAS,CAAC;IACjE,oBAAoB,CAAC,KAAiC,EAAE,KAAW,IAAS,CAAC;CACvF;AALD,kDAKC","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 { 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 */\nexport 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\n/**\n * Null logger\n * It can be used in places where logger instance is required, but events should be not send over.\n */\nexport class BaseTelemetryNullLogger implements ITelemetryBaseLogger {\n /**\n * Send an event with the logger\n *\n * @param event - the event to send\n */\n public send(event: ITelemetryBaseEvent): void {\n return;\n }\n}\n\n/**\n * Null logger\n * It can be used in places where logger instance is required, but events should be not send over.\n */\nexport class TelemetryNullLogger implements ITelemetryLogger {\n public send(event: ITelemetryBaseEvent): void {}\n public sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any): void {}\n public sendErrorEvent(event: ITelemetryErrorEvent, error?: any): void {}\n public sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void {}\n}\n"]}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;AAcH,+DAA2D;AAC3D,qCAAmG;AACnG,iDAKwB;AAUxB;;;GAGG;AACH,IAAY,g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YACF,OAAO,8BAA8B,OAAO,CAAC,GAAG,CAAC;KAClD;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n\tITelemetryErrorEvent,\n\tITelemetryGenericEvent,\n\tITelemetryLogger,\n\tITelemetryPerformanceEvent,\n\tITelemetryProperties,\n\tTelemetryEventPropertyType,\n\tITaggedTelemetryPropertyType,\n\tTelemetryEventCategory,\n} from \"@fluidframework/common-definitions\";\nimport { performance } from \"@fluidframework/common-utils\";\nimport { CachedConfigProvider, loggerIsMonitoringContext, mixinMonitoringContext } from \"./config\";\nimport {\n\tisILoggingError,\n\textractLogSafeErrorProperties,\n\tgenerateStack,\n\tisTaggedTelemetryPropertyValue,\n} from \"./errorLogging\";\nimport {\n\tITaggedTelemetryPropertyTypeExt,\n\tITelemetryEventExt,\n\tITelemetryGenericEventExt,\n\tITelemetryLoggerExt,\n\tITelemetryPerformanceEventExt,\n\tTelemetryEventPropertyTypeExt,\n} from \"./telemetryTypes\";\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\t/** Data containing terms or IDs from code packages that may have been dynamically loaded */\n\tCodeArtifact = \"CodeArtifact\",\n\t/** Personal data of a variety of classifications that pertains to the user */\n\tUserData = \"UserData\",\n}\n\nexport type TelemetryEventPropertyTypes = TelemetryEventPropertyType | ITaggedTelemetryPropertyType;\n\nexport interface ITelemetryLoggerPropertyBag {\n\t[index: string]: TelemetryEventPropertyTypes | (() => TelemetryEventPropertyTypes);\n}\nexport interface ITelemetryLoggerPropertyBags {\n\tall?: ITelemetryLoggerPropertyBag;\n\terror?: 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 ITelemetryLoggerExt {\n\tpublic static readonly eventNamespaceSeparator = \":\";\n\n\tpublic static formatTick(tick: number): number {\n\t\treturn Math.floor(tick);\n\t}\n\n\t/**\n\t * Attempts to parse number from string.\n\t * If fails,returns original string.\n\t * Used to make telemetry data typed (and support math operations, like comparison),\n\t * in places where we do expect numbers (like contentsize/duration property in http header)\n\t */\n\tpublic static numberFromString(str: string | null | undefined): string | number | undefined {\n\t\tif (str === undefined || str === null) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst num = Number(str);\n\t\treturn Number.isNaN(num) ? str : num;\n\t}\n\n\tpublic static sanitizePkgName(name: string) {\n\t\treturn name.replace(\"@\", \"\").replace(\"/\", \"-\");\n\t}\n\n\t/**\n\t * Take an unknown error object and add the appropriate info from it to the event. Message and stack will be copied\n\t * over from the error object, along with other telemetry properties if it's an ILoggingError.\n\t * @param event - Event being logged\n\t * @param error - Error to extract info from\n\t * @param fetchStack - Whether to fetch the current callstack if error.stack is undefined\n\t */\n\tpublic static prepareErrorObject(event: ITelemetryBaseEvent, error: any, fetchStack: boolean) {\n\t\tconst { message, errorType, stack } = extractLogSafeErrorProperties(\n\t\t\terror,\n\t\t\ttrue /* sanitizeStack */,\n\t\t);\n\t\t// First, copy over error message, stack, and errorType directly (overwrite if present on event)\n\t\tevent.stack = stack;\n\t\tevent.error = message; // Note that the error message goes on the 'error' field\n\t\tevent.errorType = errorType;\n\n\t\tif (isILoggingError(error)) {\n\t\t\t// Add any other telemetry properties from the LoggingError\n\t\t\tconst telemetryProp = error.getTelemetryProperties();\n\t\t\tfor (const key of Object.keys(telemetryProp)) {\n\t\t\t\tif (event[key] !== undefined) {\n\t\t\t\t\t// Don't overwrite existing properties on the event\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tevent[key] = telemetryProp[key];\n\t\t\t}\n\t\t}\n\n\t\t// Collect stack if we were not able to extract it from error\n\t\tif (event.stack === undefined && fetchStack) {\n\t\t\tevent.stack = generateStack();\n\t\t}\n\t}\n\n\tpublic constructor(\n\t\tprotected readonly namespace?: string,\n\t\tprotected readonly properties?: ITelemetryLoggerPropertyBags,\n\t) {}\n\n\t/**\n\t * Send an event with the logger\n\t *\n\t * @param event - the event to send\n\t */\n\tpublic abstract send(event: ITelemetryBaseEvent): void;\n\n\t/**\n\t * Send a telemetry event with the logger\n\t *\n\t * @param event - the event to send\n\t * @param error - optional error object to log\n\t */\n\tpublic sendTelemetryEvent(event: ITelemetryGenericEventExt, error?: any) {\n\t\tthis.sendTelemetryEventCore({ ...event, category: event.category ?? \"generic\" }, error);\n\t}\n\n\t/**\n\t * Send a telemetry event with the logger\n\t *\n\t * @param event - the event to send\n\t * @param error - optional error object to log\n\t */\n\tprotected sendTelemetryEventCore(\n\t\tevent: ITelemetryGenericEventExt & { category: TelemetryEventCategory },\n\t\terror?: any,\n\t) {\n\t\tconst newEvent = convertToBaseEvent(event);\n\t\tif (error !== undefined) {\n\t\t\tTelemetryLogger.prepareErrorObject(newEvent, error, false);\n\t\t}\n\n\t\t// Will include Nan & Infinity, but probably we do not care\n\t\tif (typeof newEvent.duration === \"number\") {\n\t\t\tnewEvent.duration = TelemetryLogger.formatTick(newEvent.duration);\n\t\t}\n\n\t\tthis.send(newEvent);\n\t}\n\n\t/**\n\t * Send an error telemetry event with the logger\n\t *\n\t * @param event - the event to send\n\t * @param error - optional error object to log\n\t */\n\tpublic sendErrorEvent(event: ITelemetryErrorEvent, error?: any) {\n\t\tthis.sendTelemetryEventCore(\n\t\t\t{\n\t\t\t\t// ensure the error field has some value,\n\t\t\t\t// this can and will be overridden by event, or error\n\t\t\t\terror: event.eventName,\n\t\t\t\t...event,\n\t\t\t\tcategory: \"error\",\n\t\t\t},\n\t\t\terror,\n\t\t);\n\t}\n\n\t/**\n\t * Send a performance telemetry event with the logger\n\t *\n\t * @param event - Event to send\n\t * @param error - optional error object to log\n\t */\n\tpublic sendPerformanceEvent(event: ITelemetryPerformanceEventExt, error?: any): void {\n\t\tconst perfEvent = {\n\t\t\t...event,\n\t\t\tcategory: event.category ?? \"performance\",\n\t\t};\n\n\t\tthis.sendTelemetryEventCore(perfEvent, error);\n\t}\n\n\tprotected prepareEvent(event: ITelemetryBaseEvent): ITelemetryBaseEvent {\n\t\tconst includeErrorProps = event.category === \"error\" || event.error !== undefined;\n\t\tconst newEvent: ITelemetryBaseEvent = {\n\t\t\t...event,\n\t\t};\n\t\tif (this.namespace !== undefined) {\n\t\t\tnewEvent.eventName = `${this.namespace}${TelemetryLogger.eventNamespaceSeparator}${newEvent.eventName}`;\n\t\t}\n\t\tif (this.properties) {\n\t\t\tconst properties: (undefined | ITelemetryLoggerPropertyBag)[] = [];\n\t\t\tproperties.push(this.properties.all);\n\t\t\tif (includeErrorProps) {\n\t\t\t\tproperties.push(this.properties.error);\n\t\t\t}\n\t\t\tfor (const props of properties) {\n\t\t\t\tif (props !== undefined) {\n\t\t\t\t\tfor (const key of Object.keys(props)) {\n\t\t\t\t\t\tif (event[key] !== undefined) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst getterOrValue = props[key];\n\t\t\t\t\t\t// If this throws, hopefully it is handled elsewhere\n\t\t\t\t\t\tconst value =\n\t\t\t\t\t\t\ttypeof getterOrValue === \"function\" ? getterOrValue() : getterOrValue;\n\t\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\t\tnewEvent[key] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn newEvent;\n\t}\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 */\nexport class TaggedLoggerAdapter implements ITelemetryBaseLogger {\n\tpublic constructor(private readonly logger: ITelemetryBaseLogger) {}\n\n\tpublic send(eventWithTagsMaybe: ITelemetryBaseEvent) {\n\t\tconst newEvent: ITelemetryBaseEvent = {\n\t\t\tcategory: eventWithTagsMaybe.category,\n\t\t\teventName: eventWithTagsMaybe.eventName,\n\t\t};\n\t\tfor (const key of Object.keys(eventWithTagsMaybe)) {\n\t\t\tconst taggableProp = eventWithTagsMaybe[key];\n\t\t\tconst { value, tag } =\n\t\t\t\ttypeof taggableProp === \"object\"\n\t\t\t\t\t? taggableProp\n\t\t\t\t\t: { value: taggableProp, tag: undefined };\n\t\t\tswitch (tag) {\n\t\t\t\tcase undefined:\n\t\t\t\t\t// No tag means we can log plainly\n\t\t\t\t\tnewEvent[key] = value;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"PackageData\": // For back-compat\n\t\t\t\tcase TelemetryDataTag.CodeArtifact:\n\t\t\t\t\t// For Microsoft applications, CodeArtifact is safe for now\n\t\t\t\t\t// (we don't load 3P code in 1P apps)\n\t\t\t\t\tnewEvent[key] = value;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TelemetryDataTag.UserData:\n\t\t\t\t\t// Strip out anything tagged explicitly as PII.\n\t\t\t\t\t// Alternate strategy would be to hash these props\n\t\t\t\t\tnewEvent[key] = \"REDACTED (UserData)\";\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t// If we encounter a tag we don't recognize\n\t\t\t\t\t// then we must assume we should scrub.\n\t\t\t\t\tnewEvent[key] = \"REDACTED (unknown tag)\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tthis.logger.send(newEvent);\n\t}\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\t/**\n\t * Create child logger\n\t * @param baseLogger - Base logger to use to output events. If undefined, proper child logger\n\t * is created, but it does not send telemetry events anywhere.\n\t * @param namespace - Telemetry event name prefix to add to all events\n\t * @param properties - Base properties to add to all events\n\t * @param propertyGetters - Getters to add additional properties to all events\n\t */\n\tpublic static create(\n\t\tbaseLogger?: ITelemetryBaseLogger,\n\t\tnamespace?: string,\n\t\tproperties?: ITelemetryLoggerPropertyBags,\n\t): TelemetryLogger {\n\t\t// if we are creating a child of a child, rather than nest, which will increase\n\t\t// the callstack overhead, just generate a new logger that includes everything from the previous\n\t\tif (baseLogger instanceof ChildLogger) {\n\t\t\tconst combinedProperties: ITelemetryLoggerPropertyBags = {};\n\t\t\tfor (const extendedProps of [baseLogger.properties, properties]) {\n\t\t\t\tif (extendedProps !== undefined) {\n\t\t\t\t\tif (extendedProps.all !== undefined) {\n\t\t\t\t\t\tcombinedProperties.all = {\n\t\t\t\t\t\t\t...combinedProperties.all,\n\t\t\t\t\t\t\t...extendedProps.all,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tif (extendedProps.error !== undefined) {\n\t\t\t\t\t\tcombinedProperties.error = {\n\t\t\t\t\t\t\t...combinedProperties.error,\n\t\t\t\t\t\t\t...extendedProps.error,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst combinedNamespace =\n\t\t\t\tbaseLogger.namespace === undefined\n\t\t\t\t\t? namespace\n\t\t\t\t\t: namespace === undefined\n\t\t\t\t\t? baseLogger.namespace\n\t\t\t\t\t: `${baseLogger.namespace}${TelemetryLogger.eventNamespaceSeparator}${namespace}`;\n\n\t\t\treturn new ChildLogger(baseLogger.baseLogger, combinedNamespace, combinedProperties);\n\t\t}\n\n\t\treturn new ChildLogger(\n\t\t\tbaseLogger ? baseLogger : new BaseTelemetryNullLogger(),\n\t\t\tnamespace,\n\t\t\tproperties,\n\t\t);\n\t}\n\n\tprivate constructor(\n\t\tprotected readonly baseLogger: ITelemetryBaseLogger,\n\t\tnamespace: string | undefined,\n\t\tproperties: ITelemetryLoggerPropertyBags | undefined,\n\t) {\n\t\tsuper(namespace, properties);\n\n\t\t// propagate the monitoring context\n\t\tif (loggerIsMonitoringContext(baseLogger)) {\n\t\t\tmixinMonitoringContext(this, new CachedConfigProvider(baseLogger.config));\n\t\t}\n\t}\n\n\t/**\n\t * Send an event with the logger\n\t *\n\t * @param event - the event to send\n\t */\n\tpublic send(event: ITelemetryBaseEvent): void {\n\t\tthis.baseLogger.send(this.prepareEvent(event));\n\t}\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\tprotected loggers: ITelemetryBaseLogger[] = [];\n\n\t/**\n\t * Create multiple sink logger (i.e. logger that sends events to multiple sinks)\n\t * @param namespace - Telemetry event name prefix to add to all events\n\t * @param properties - Base properties to add to all events\n\t * @param propertyGetters - Getters to add additional properties to all events\n\t */\n\tconstructor(namespace?: string, properties?: ITelemetryLoggerPropertyBags) {\n\t\tsuper(namespace, properties);\n\t}\n\n\t/**\n\t * Add logger to send all events to\n\t * @param logger - Logger to add\n\t */\n\tpublic addLogger(logger?: ITelemetryBaseLogger) {\n\t\tif (logger !== undefined && logger !== null) {\n\t\t\tthis.loggers.push(logger);\n\t\t}\n\t}\n\n\t/**\n\t * Send an event to the loggers\n\t *\n\t * @param event - the event to send to all the registered logger\n\t */\n\tpublic send(event: ITelemetryBaseEvent): void {\n\t\tconst newEvent = this.prepareEvent(event);\n\t\tthis.loggers.forEach((logger: ITelemetryBaseLogger) => {\n\t\t\tlogger.send(newEvent);\n\t\t});\n\t}\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\tstart?: true;\n\tend?: true;\n\tcancel?: \"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\tpublic static start(\n\t\tlogger: ITelemetryLogger,\n\t\tevent: ITelemetryGenericEvent,\n\t\tmarkers?: IPerformanceEventMarkers,\n\t) {\n\t\treturn new PerformanceEvent(logger, event, markers);\n\t}\n\n\tpublic static timedExec<T>(\n\t\tlogger: ITelemetryLogger,\n\t\tevent: ITelemetryGenericEvent,\n\t\tcallback: (event: PerformanceEvent) => T,\n\t\tmarkers?: IPerformanceEventMarkers,\n\t) {\n\t\tconst perfEvent = PerformanceEvent.start(logger, event, markers);\n\t\ttry {\n\t\t\tconst ret = callback(perfEvent);\n\t\t\tperfEvent.autoEnd();\n\t\t\treturn ret;\n\t\t} catch (error) {\n\t\t\tperfEvent.cancel(undefined, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tpublic static async timedExecAsync<T>(\n\t\tlogger: ITelemetryLogger,\n\t\tevent: ITelemetryGenericEvent,\n\t\tcallback: (event: PerformanceEvent) => Promise<T>,\n\t\tmarkers?: IPerformanceEventMarkers,\n\t) {\n\t\tconst perfEvent = PerformanceEvent.start(logger, event, markers);\n\t\ttry {\n\t\t\tconst ret = await callback(perfEvent);\n\t\t\tperfEvent.autoEnd();\n\t\t\treturn ret;\n\t\t} catch (error) {\n\t\t\tperfEvent.cancel(undefined, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tpublic get duration() {\n\t\treturn performance.now() - this.startTime;\n\t}\n\n\tprivate event?: ITelemetryGenericEvent;\n\tprivate readonly startTime = performance.now();\n\tprivate startMark?: string;\n\n\tprotected constructor(\n\t\tprivate readonly logger: ITelemetryLogger,\n\t\tevent: ITelemetryGenericEvent,\n\t\tprivate readonly markers: IPerformanceEventMarkers = { end: true, cancel: \"generic\" },\n\t) {\n\t\tthis.event = { ...event };\n\t\tif (this.markers.start) {\n\t\t\tthis.reportEvent(\"start\");\n\t\t}\n\n\t\tif (typeof window === \"object\" && window != null && window.performance?.mark) {\n\t\t\tthis.startMark = `${event.eventName}-start`;\n\t\t\twindow.performance.mark(this.startMark);\n\t\t}\n\t}\n\n\tpublic reportProgress(props?: ITelemetryProperties, eventNameSuffix: string = \"update\"): void {\n\t\tthis.reportEvent(eventNameSuffix, props);\n\t}\n\n\tprivate autoEnd() {\n\t\t// Event might have been cancelled or ended in the callback\n\t\tif (this.event && this.markers.end) {\n\t\t\tthis.reportEvent(\"end\");\n\t\t}\n\t\tthis.performanceEndMark();\n\t\tthis.event = undefined;\n\t}\n\n\tpublic end(props?: ITelemetryProperties): void {\n\t\tthis.reportEvent(\"end\", props);\n\t\tthis.performanceEndMark();\n\t\tthis.event = undefined;\n\t}\n\n\tprivate performanceEndMark() {\n\t\tif (this.startMark && this.event) {\n\t\t\tconst endMark = `${this.event.eventName}-end`;\n\t\t\twindow.performance.mark(endMark);\n\t\t\twindow.performance.measure(`${this.event.eventName}`, this.startMark, endMark);\n\t\t\tthis.startMark = undefined;\n\t\t}\n\t}\n\n\tpublic cancel(props?: ITelemetryProperties, error?: any): void {\n\t\tif (this.markers.cancel !== undefined) {\n\t\t\tthis.reportEvent(\"cancel\", { category: this.markers.cancel, ...props }, error);\n\t\t}\n\t\tthis.event = undefined;\n\t}\n\n\t/**\n\t * Report the event, if it hasn't already been reported.\n\t */\n\tpublic reportEvent(eventNameSuffix: string, props?: ITelemetryProperties, error?: any) {\n\t\t// There are strange sequences involving multiple Promise chains\n\t\t// where the event can be cancelled and then later a callback is invoked\n\t\t// and the caller attempts to end directly, e.g. issue #3936. Just return.\n\t\tif (!this.event) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst event: ITelemetryPerformanceEvent = { ...this.event, ...props };\n\t\tevent.eventName = `${event.eventName}_${eventNameSuffix}`;\n\t\tif (eventNameSuffix !== \"start\") {\n\t\t\tevent.duration = this.duration;\n\t\t}\n\n\t\tthis.logger.sendPerformanceEvent(event, error);\n\t}\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 */\nexport class TelemetryUTLogger implements ITelemetryLogger {\n\tpublic send(event: ITelemetryBaseEvent): void {}\n\tpublic sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any) {}\n\tpublic sendErrorEvent(event: ITelemetryErrorEvent, error?: any) {\n\t\tthis.reportError(\"errorEvent in UT logger!\", event, error);\n\t}\n\tpublic sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void {}\n\tpublic logGenericError(eventName: string, error: any) {\n\t\tthis.reportError(`genericError in UT logger!`, { eventName }, error);\n\t}\n\tpublic logException(event: ITelemetryErrorEvent, exception: any): void {\n\t\tthis.reportError(\"exception in UT logger!\", event, exception);\n\t}\n\tpublic debugAssert(condition: boolean, event?: ITelemetryErrorEvent): void {\n\t\tthis.reportError(\"debugAssert in UT logger!\");\n\t}\n\tpublic shipAssert(condition: boolean, event?: ITelemetryErrorEvent): void {\n\t\tthis.reportError(\"shipAssert in UT logger!\");\n\t}\n\n\tprivate reportError(message: string, event?: ITelemetryErrorEvent, err?: any) {\n\t\tconst error = new Error(message);\n\t\t(error as any).error = error;\n\t\t(error as any).event = event;\n\t\t// report to console as exception can be eaten\n\t\tconsole.error(message);\n\t\tconsole.error(error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Null logger\n * It can be used in places where logger instance is required, but events should be not send over.\n */\nexport class BaseTelemetryNullLogger implements ITelemetryBaseLogger {\n\t/**\n\t * Send an event with the logger\n\t *\n\t * @param event - the event to send\n\t */\n\tpublic send(event: ITelemetryBaseEvent): void {\n\t\treturn;\n\t}\n}\n\n/**\n * Null logger\n * It can be used in places where logger instance is required, but events should be not send over.\n */\nexport class TelemetryNullLogger implements ITelemetryLogger {\n\tpublic send(event: ITelemetryBaseEvent): void {}\n\tpublic sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any): void {}\n\tpublic sendErrorEvent(event: ITelemetryErrorEvent, error?: any): void {}\n\tpublic sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void {}\n}\n\n/**\n * Takes in an event object, and converts all of its values to a basePropertyType.\n * In the case of an invalid property type, the value will be converted to an error string.\n * @param event - Event with fields you want to stringify.\n */\nfunction convertToBaseEvent({\n\tcategory,\n\teventName,\n\t...props\n}: ITelemetryEventExt): ITelemetryBaseEvent {\n\tconst newEvent: ITelemetryBaseEvent = { category, eventName };\n\tfor (const key of Object.keys(props)) {\n\t\tnewEvent[key] = convertToBasePropertyType(props[key]);\n\t}\n\treturn newEvent;\n}\n\n/**\n * Takes in value, and does one of 4 things.\n * if value is of primitive type - returns the original value.\n * If the value is an array of primitives - returns a stringified version of the array.\n * If the value is an object of type ITaggedTelemetryPropertyType - returns the object\n * with its values recursively converted to base property Type.\n * If none of these cases are reached - returns an error string\n * @param x - value passed in to convert to a base property type\n */\nexport function convertToBasePropertyType(\n\tx: TelemetryEventPropertyTypeExt | ITaggedTelemetryPropertyTypeExt,\n): TelemetryEventPropertyType | ITaggedTelemetryPropertyType {\n\treturn isTaggedTelemetryPropertyValue(x)\n\t\t? {\n\t\t\t\tvalue: convertToBasePropertyTypeUntagged(x.value),\n\t\t\t\ttag: x.tag,\n\t\t }\n\t\t: convertToBasePropertyTypeUntagged(x);\n}\n\nfunction convertToBasePropertyTypeUntagged(\n\tx: TelemetryEventPropertyTypeExt,\n): TelemetryEventPropertyType {\n\tswitch (typeof x) {\n\t\tcase \"string\":\n\t\tcase \"number\":\n\t\tcase \"boolean\":\n\t\tcase \"undefined\":\n\t\t\treturn x;\n\t\tcase \"object\":\n\t\t\t// We assume this is an array based on the input types\n\t\t\treturn JSON.stringify(x);\n\t\tdefault:\n\t\t\t// should never reach this case based on the input types\n\t\t\tconsole.error(\n\t\t\t\t`convertToBasePropertyTypeUntagged: INVALID PROPERTY (typed as ${typeof x})`,\n\t\t\t);\n\t\t\treturn `INVALID PROPERTY (typed as ${typeof x})`;\n\t}\n}\n"]}
@@ -18,7 +18,7 @@ export declare class MockLogger extends TelemetryLogger implements ITelemetryLog
18
18
  * events in order.
19
19
  * @param expectedEvents - events in order that are expected to appear in the recorded log.
20
20
  * These event objects may be subsets of the logged events.
21
- * Note: category is ommitted from the type because it's usually uninteresting and tedious to type.
21
+ * Note: category is omitted from the type because it's usually uninteresting and tedious to type.
22
22
  */
23
23
  matchEvents(expectedEvents: Omit<ITelemetryBaseEvent, "category">[]): boolean;
24
24
  /** Asserts that matchEvents is true, and prints the actual/expected output if not */
@@ -28,12 +28,22 @@ export declare class MockLogger extends TelemetryLogger implements ITelemetryLog
28
28
  * expected events.
29
29
  * @param expectedEvents - events that are expected to appear in the recorded log.
30
30
  * These event objects may be subsets of the logged events.
31
- * Note: category is ommitted from the type because it's usually uninteresting and tedious to type.
31
+ * Note: category is omitted from the type because it's usually uninteresting and tedious to type.
32
32
  * @returns if any of the expected events is found.
33
33
  */
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
+ /**
38
+ * Search events logged since the last time matchEvents was called, looking only for the given expected
39
+ * events in order.
40
+ * @param expectedEvents - events in order that are expected to be the only events in the recorded log.
41
+ * These event objects may be subsets of the logged events.
42
+ * Note: category is omitted from the type because it's usually uninteresting and tedious to type.
43
+ */
44
+ matchEventStrict(expectedEvents: Omit<ITelemetryBaseEvent, "category">[]): boolean;
45
+ /** Asserts that matchEvents is true, and prints the actual/expected output if not */
46
+ assertMatchStrict(expectedEvents: Omit<ITelemetryBaseEvent, "category">[], message?: string): void;
37
47
  /** Asserts that matchAnyEvent is false for the given events, and prints the actual/expected output if not */
38
48
  assertMatchNone(disallowedEvents: Omit<ITelemetryBaseEvent, "category">[], message?: string): void;
39
49
  private getMatchedEventsCount;
@@ -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,UAA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mB,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,EAAE,UAAU,CAAC,EAAE,GAAG,OAAO;IAK/E,uFAAuF;IACvF,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM;IAYxF;;;;;;OAMG;IACH,gBAAgB,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,OAAO;IAIlF,qFAAqF;IACrF,iBAAiB,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM;IAY3F,6GAA6G;IAC7G,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM;IAY3F,OAAO,CAAC,qBAAqB;IAmB7B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;CAO1B"}
@@ -26,7 +26,7 @@ class MockLogger extends logger_1.TelemetryLogger {
26
26
  * events in order.
27
27
  * @param expectedEvents - events in order that are expected to appear in the recorded log.
28
28
  * These event objects may be subsets of the logged events.
29
- * Note: category is ommitted from the type because it's usually uninteresting and tedious to type.
29
+ * Note: category is omitted from the type because it's usually uninteresting and tedious to type.
30
30
  */
31
31
  matchEvents(expectedEvents) {
32
32
  const matchedExpectedEventCount = this.getMatchedEventsCount(expectedEvents);
@@ -51,7 +51,7 @@ ${JSON.stringify(actualEvents)}`);
51
51
  * expected events.
52
52
  * @param expectedEvents - events that are expected to appear in the recorded log.
53
53
  * These event objects may be subsets of the logged events.
54
- * Note: category is ommitted from the type because it's usually uninteresting and tedious to type.
54
+ * Note: category is omitted from the type because it's usually uninteresting and tedious to type.
55
55
  * @returns if any of the expected events is found.
56
56
  */
57
57
  matchAnyEvent(expectedEvents) {
@@ -66,6 +66,28 @@ ${JSON.stringify(actualEvents)}`);
66
66
  expected:
67
67
  ${JSON.stringify(expectedEvents)}
68
68
 
69
+ actual:
70
+ ${JSON.stringify(actualEvents)}`);
71
+ }
72
+ }
73
+ /**
74
+ * Search events logged since the last time matchEvents was called, looking only for the given expected
75
+ * events in order.
76
+ * @param expectedEvents - events in order that are expected to be the only events in the recorded log.
77
+ * These event objects may be subsets of the logged events.
78
+ * Note: category is omitted from the type because it's usually uninteresting and tedious to type.
79
+ */
80
+ matchEventStrict(expectedEvents) {
81
+ return expectedEvents.length === this.events.length && this.matchEvents(expectedEvents);
82
+ }
83
+ /** Asserts that matchEvents is true, and prints the actual/expected output if not */
84
+ assertMatchStrict(expectedEvents, message) {
85
+ const actualEvents = this.events;
86
+ if (!this.matchEventStrict(expectedEvents)) {
87
+ throw new Error(`${message}
88
+ expected:
89
+ ${JSON.stringify(expectedEvents)}
90
+
69
91
  actual:
70
92
  ${JSON.stringify(actualEvents)}`);
71
93
  }
@@ -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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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"]}
1
+ {"version":3,"file":"mockLogger.js","sourceRoot":"","sources":["../src/mockLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qCAA2C;AAE3C;;;GAGG;AACH,MAAa,UAAW,SAAQ,wBAAe;IAG9C;QACC,KAAK,EAAE,CAAC;QAHT,WAAM,GAA0B,EAAE,CAAC;IAInC,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,KAA0B;QAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,cAAuD;QAClE,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;IAC1C,CAAC;IAED,qFAAqF;IACrF,WAAW,CAAC,cAAuD,EAAE,OAAgB;QACpF,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;QACjC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,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;QAC1F,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;QACjC,IAAI,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE;YACzC,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO;;EAE3B,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;;;EAGhC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;SAC/B;IACF,CAAC;IAEO,qBAAqB,CAAC,cAAuD;QACpF,IAAI,cAAc,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC7B,IACC,cAAc,GAAG,cAAc,CAAC,MAAM;gBACtC,UAAU,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC,EAC5D;gBACD,8CAA8C;gBAC9C,EAAE,cAAc,CAAC;aACjB;QACF,CAAC,CAAC,CAAC;QAEH,oFAAoF;QACpF,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QAEjB,sCAAsC;QACtC,OAAO,cAAc,CAAC;IACvB,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,WAAW,CACzB,MAA2B,EAC3B,QAA+C;QAE/C,MAAM,MAAM,mCAAQ,MAAM,GAAK,QAAQ,CAAE,CAAC;QAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC1D,CAAC;CACD;AAtID,gCAsIC","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\tevents: ITelemetryBaseEvent[] = [];\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tclear() {\n\t\tthis.events = [];\n\t}\n\n\tsend(event: ITelemetryBaseEvent): void {\n\t\tthis.events.push(event);\n\t}\n\n\t/**\n\t * Search events logged since the last time matchEvents was called, looking for the given expected\n\t * events in order.\n\t * @param expectedEvents - events in order that are expected to appear in the recorded log.\n\t * These event objects may be subsets of the logged events.\n\t * Note: category is omitted from the type because it's usually uninteresting and tedious to type.\n\t */\n\tmatchEvents(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[]): boolean {\n\t\tconst matchedExpectedEventCount = this.getMatchedEventsCount(expectedEvents);\n\t\t// How many expected events were left over? Hopefully none.\n\t\tconst unmatchedExpectedEventCount = expectedEvents.length - matchedExpectedEventCount;\n\t\treturn unmatchedExpectedEventCount === 0;\n\t}\n\n\t/** Asserts that matchEvents is true, and prints the actual/expected output if not */\n\tassertMatch(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[], message?: string) {\n\t\tconst actualEvents = this.events;\n\t\tif (!this.matchEvents(expectedEvents)) {\n\t\t\tthrow new Error(`${message}\nexpected:\n${JSON.stringify(expectedEvents)}\n\nactual:\n${JSON.stringify(actualEvents)}`);\n\t\t}\n\t}\n\n\t/**\n\t * Search events logged since the last time matchEvents was called, looking for any of the given\n\t * expected events.\n\t * @param expectedEvents - events that are expected to appear in the recorded log.\n\t * These event objects may be subsets of the logged events.\n\t * Note: category is omitted from the type because it's usually uninteresting and tedious to type.\n\t * @returns if any of the expected events is found.\n\t */\n\tmatchAnyEvent(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[]): boolean {\n\t\tconst matchedExpectedEventCount = this.getMatchedEventsCount(expectedEvents);\n\t\treturn matchedExpectedEventCount > 0;\n\t}\n\n\t/** Asserts that matchAnyEvent is true, and prints the actual/expected output if not */\n\tassertMatchAny(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[], message?: string) {\n\t\tconst actualEvents = this.events;\n\t\tif (!this.matchAnyEvent(expectedEvents)) {\n\t\t\tthrow new Error(`${message}\nexpected:\n${JSON.stringify(expectedEvents)}\n\nactual:\n${JSON.stringify(actualEvents)}`);\n\t\t}\n\t}\n\n\t/**\n\t * Search events logged since the last time matchEvents was called, looking only for the given expected\n\t * events in order.\n\t * @param expectedEvents - events in order that are expected to be the only events in the recorded log.\n\t * These event objects may be subsets of the logged events.\n\t * Note: category is omitted from the type because it's usually uninteresting and tedious to type.\n\t */\n\tmatchEventStrict(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[]): boolean {\n\t\treturn expectedEvents.length === this.events.length && this.matchEvents(expectedEvents);\n\t}\n\n\t/** Asserts that matchEvents is true, and prints the actual/expected output if not */\n\tassertMatchStrict(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[], message?: string) {\n\t\tconst actualEvents = this.events;\n\t\tif (!this.matchEventStrict(expectedEvents)) {\n\t\t\tthrow new Error(`${message}\nexpected:\n${JSON.stringify(expectedEvents)}\n\nactual:\n${JSON.stringify(actualEvents)}`);\n\t\t}\n\t}\n\n\t/** Asserts that matchAnyEvent is false for the given events, and prints the actual/expected output if not */\n\tassertMatchNone(disallowedEvents: Omit<ITelemetryBaseEvent, \"category\">[], message?: string) {\n\t\tconst actualEvents = this.events;\n\t\tif (this.matchAnyEvent(disallowedEvents)) {\n\t\t\tthrow new Error(`${message}\ndisallowed events:\n${JSON.stringify(disallowedEvents)}\n\nactual:\n${JSON.stringify(actualEvents)}`);\n\t\t}\n\t}\n\n\tprivate getMatchedEventsCount(expectedEvents: Omit<ITelemetryBaseEvent, \"category\">[]): number {\n\t\tlet iExpectedEvent = 0;\n\t\tthis.events.forEach((event) => {\n\t\t\tif (\n\t\t\t\tiExpectedEvent < expectedEvents.length &&\n\t\t\t\tMockLogger.eventsMatch(event, expectedEvents[iExpectedEvent])\n\t\t\t) {\n\t\t\t\t// We found the next expected event; increment\n\t\t\t\t++iExpectedEvent;\n\t\t\t}\n\t\t});\n\n\t\t// Remove the events so far; next call will just compare subsequent events from here\n\t\tthis.events = [];\n\n\t\t// Return the count of matched events.\n\t\treturn iExpectedEvent;\n\t}\n\n\t/**\n\t * Ensure the expected event is a strict subset of the actual event\n\t */\n\tprivate static eventsMatch(\n\t\tactual: ITelemetryBaseEvent,\n\t\texpected: Omit<ITelemetryBaseEvent, \"category\">,\n\t): boolean {\n\t\tconst masked = { ...actual, ...expected };\n\t\treturn JSON.stringify(masked) === JSON.stringify(actual);\n\t}\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 = "2.0.0-dev.2.3.0.115467";
8
+ export declare const pkgVersion = "2.0.0-dev.3.1.0.125672";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -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 = "2.0.0-dev.2.3.0.115467";
11
+ exports.pkgVersion = "2.0.0-dev.3.1.0.125672";
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,wBAAwB,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.2.3.0.115467\";\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,wBAAwB,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.3.1.0.125672\";\n"]}
@@ -1 +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"}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