@fluidframework/telemetry-utils 2.0.0-rc.1.0.4 → 2.0.0-rc.2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/{.mocharc.js → .mocharc.cjs} +1 -1
  2. package/CHANGELOG.md +23 -0
  3. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -2
  4. package/api-extractor-lint.json +1 -1
  5. package/api-extractor.json +1 -1
  6. package/api-report/telemetry-utils.api.md +10 -33
  7. package/dist/config.d.ts +2 -2
  8. package/dist/config.d.ts.map +1 -1
  9. package/dist/config.js +3 -3
  10. package/dist/config.js.map +1 -1
  11. package/dist/error.d.ts +2 -2
  12. package/dist/error.d.ts.map +1 -1
  13. package/dist/error.js +9 -9
  14. package/dist/error.js.map +1 -1
  15. package/dist/errorLogging.d.ts +4 -4
  16. package/dist/errorLogging.d.ts.map +1 -1
  17. package/dist/errorLogging.js +19 -60
  18. package/dist/errorLogging.js.map +1 -1
  19. package/dist/eventEmitterWithErrorHandling.d.ts +1 -1
  20. package/dist/eventEmitterWithErrorHandling.js +1 -1
  21. package/dist/eventEmitterWithErrorHandling.js.map +1 -1
  22. package/dist/events.d.ts +2 -3
  23. package/dist/events.d.ts.map +1 -1
  24. package/dist/events.js.map +1 -1
  25. package/dist/fluidErrorBase.d.ts +4 -3
  26. package/dist/fluidErrorBase.d.ts.map +1 -1
  27. package/dist/fluidErrorBase.js.map +1 -1
  28. package/dist/index.d.ts +12 -12
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +58 -60
  31. package/dist/index.js.map +1 -1
  32. package/dist/logger.d.ts +7 -23
  33. package/dist/logger.d.ts.map +1 -1
  34. package/dist/logger.js +12 -29
  35. package/dist/logger.js.map +1 -1
  36. package/dist/mockLogger.d.ts +1 -1
  37. package/dist/mockLogger.d.ts.map +1 -1
  38. package/dist/mockLogger.js +2 -2
  39. package/dist/mockLogger.js.map +1 -1
  40. package/dist/package.json +3 -0
  41. package/dist/sampledTelemetryHelper.d.ts +4 -4
  42. package/dist/sampledTelemetryHelper.d.ts.map +1 -1
  43. package/dist/sampledTelemetryHelper.js +1 -1
  44. package/dist/sampledTelemetryHelper.js.map +1 -1
  45. package/dist/telemetry-utils-alpha.d.ts +4 -15
  46. package/dist/telemetry-utils-beta.d.ts +4 -32
  47. package/dist/telemetry-utils-public.d.ts +4 -32
  48. package/dist/telemetry-utils-untrimmed.d.ts +11 -50
  49. package/dist/thresholdCounter.d.ts +1 -1
  50. package/dist/thresholdCounter.d.ts.map +1 -1
  51. package/dist/thresholdCounter.js.map +1 -1
  52. package/dist/tsdoc-metadata.json +1 -1
  53. package/dist/utils.d.ts +1 -20
  54. package/dist/utils.d.ts.map +1 -1
  55. package/dist/utils.js +3 -27
  56. package/dist/utils.js.map +1 -1
  57. package/lib/config.d.ts +2 -2
  58. package/lib/config.d.ts.map +1 -1
  59. package/lib/config.js +1 -1
  60. package/lib/config.js.map +1 -1
  61. package/lib/error.d.ts +2 -2
  62. package/lib/error.d.ts.map +1 -1
  63. package/lib/error.js +1 -1
  64. package/lib/error.js.map +1 -1
  65. package/lib/errorLogging.d.ts +4 -4
  66. package/lib/errorLogging.d.ts.map +1 -1
  67. package/lib/errorLogging.js +15 -56
  68. package/lib/errorLogging.js.map +1 -1
  69. package/lib/eventEmitterWithErrorHandling.d.ts +1 -1
  70. package/lib/eventEmitterWithErrorHandling.js +1 -1
  71. package/lib/eventEmitterWithErrorHandling.js.map +1 -1
  72. package/lib/events.d.ts +2 -3
  73. package/lib/events.d.ts.map +1 -1
  74. package/lib/events.js.map +1 -1
  75. package/lib/fluidErrorBase.d.ts +4 -3
  76. package/lib/fluidErrorBase.d.ts.map +1 -1
  77. package/lib/fluidErrorBase.js.map +1 -1
  78. package/lib/index.d.ts +12 -12
  79. package/lib/index.d.ts.map +1 -1
  80. package/lib/index.js +11 -11
  81. package/lib/index.js.map +1 -1
  82. package/lib/logger.d.ts +7 -23
  83. package/lib/logger.d.ts.map +1 -1
  84. package/lib/logger.js +3 -19
  85. package/lib/logger.js.map +1 -1
  86. package/lib/mockLogger.d.ts +1 -1
  87. package/lib/mockLogger.d.ts.map +1 -1
  88. package/lib/mockLogger.js +1 -1
  89. package/lib/mockLogger.js.map +1 -1
  90. package/lib/sampledTelemetryHelper.d.ts +4 -4
  91. package/lib/sampledTelemetryHelper.d.ts.map +1 -1
  92. package/lib/sampledTelemetryHelper.js +1 -1
  93. package/lib/sampledTelemetryHelper.js.map +1 -1
  94. package/lib/{telemetry-utils-alpha.d.mts → telemetry-utils-alpha.d.ts} +4 -15
  95. package/lib/{telemetry-utils-beta.d.mts → telemetry-utils-beta.d.ts} +4 -32
  96. package/lib/{telemetry-utils-public.d.mts → telemetry-utils-public.d.ts} +4 -32
  97. package/lib/{telemetry-utils-untrimmed.d.mts → telemetry-utils-untrimmed.d.ts} +11 -50
  98. package/lib/test/EventEmitterWithErrorHandling.spec.js +86 -0
  99. package/lib/test/EventEmitterWithErrorHandling.spec.js.map +1 -0
  100. package/lib/test/childLogger.spec.js +233 -0
  101. package/lib/test/childLogger.spec.js.map +1 -0
  102. package/lib/test/config.spec.js +229 -0
  103. package/lib/test/config.spec.js.map +1 -0
  104. package/lib/test/error.spec.js +161 -0
  105. package/lib/test/error.spec.js.map +1 -0
  106. package/lib/test/errorLogging.spec.js +801 -0
  107. package/lib/test/errorLogging.spec.js.map +1 -0
  108. package/lib/test/errorTypeLoggingTest.spec.js +107 -0
  109. package/lib/test/errorTypeLoggingTest.spec.js.map +1 -0
  110. package/lib/test/mockLogger.spec.js +164 -0
  111. package/lib/test/mockLogger.spec.js.map +1 -0
  112. package/lib/test/multiSinkLogger.spec.js +84 -0
  113. package/lib/test/multiSinkLogger.spec.js.map +1 -0
  114. package/lib/test/performanceEvent.spec.js +86 -0
  115. package/lib/test/performanceEvent.spec.js.map +1 -0
  116. package/lib/test/sampledTelemetryHelper.spec.js +169 -0
  117. package/lib/test/sampledTelemetryHelper.spec.js.map +1 -0
  118. package/lib/test/telemetryLogger.spec.js +357 -0
  119. package/lib/test/telemetryLogger.spec.js.map +1 -0
  120. package/lib/test/thresholdCounter.spec.js +51 -0
  121. package/lib/test/thresholdCounter.spec.js.map +1 -0
  122. package/lib/test/types/validateTelemetryUtilsPrevious.generated.js +132 -0
  123. package/lib/test/types/validateTelemetryUtilsPrevious.generated.js.map +1 -0
  124. package/lib/test/utils.spec.js +284 -0
  125. package/lib/test/utils.spec.js.map +1 -0
  126. package/lib/thresholdCounter.d.ts +1 -1
  127. package/lib/thresholdCounter.d.ts.map +1 -1
  128. package/lib/thresholdCounter.js.map +1 -1
  129. package/lib/utils.d.ts +1 -20
  130. package/lib/utils.d.ts.map +1 -1
  131. package/lib/utils.js +1 -24
  132. package/lib/utils.js.map +1 -1
  133. package/package.json +75 -26
  134. package/src/config.ts +2 -2
  135. package/src/error.ts +2 -2
  136. package/src/errorLogging.ts +27 -68
  137. package/src/eventEmitterWithErrorHandling.ts +1 -1
  138. package/src/events.ts +2 -4
  139. package/src/fluidErrorBase.ts +4 -3
  140. package/src/index.ts +12 -13
  141. package/src/logger.ts +12 -28
  142. package/src/mockLogger.ts +2 -2
  143. package/src/sampledTelemetryHelper.ts +10 -11
  144. package/src/thresholdCounter.ts +1 -1
  145. package/src/utils.ts +3 -36
  146. package/tsconfig.cjs.json +7 -0
  147. package/tsconfig.json +2 -3
  148. package/tsconfig.esnext.json +0 -7
  149. /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
package/lib/utils.js CHANGED
@@ -1,27 +1,4 @@
1
- import { loggerToMonitoringContext } from "./config";
2
- /**
3
- * Like assert, but logs only if the condition is false, rather than throwing
4
- * @param condition - The condition to attest too
5
- * @param logger - The logger to log with
6
- * @param event - The string or event to log
7
- * @returns The outcome of the condition
8
- *
9
- * @internal
10
- *
11
- * @deprecated
12
- * This API will be removed in a future release.
13
- * No replacement API is intended, but reproducing its behavior should be trivial for anyone who needs it.
14
- */
15
- export function logIfFalse(condition, logger, event) {
16
- if (condition) {
17
- return true;
18
- }
19
- const newEvent = typeof event === "string"
20
- ? { eventName: event, category: "error" }
21
- : { category: "error", ...event };
22
- logger.send(newEvent);
23
- return false;
24
- }
1
+ import { loggerToMonitoringContext } from "./config.js";
25
2
  /**
26
3
  * Wraps around an existing logger matching the {@link ITelemetryLoggerExt} interface and provides the ability to only log a subset of events using a sampling strategy provided by an ${@link IEventSampler}.
27
4
  * You can chose to not provide an event sampler which is effectively a no-op, meaning that it will be treated as if the sampler always returns true.
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,UAAU,CACzB,SAAkB,EAClB,MAA4B,EAC5B,KAAsC;IAEtC,IAAI,SAAS,EAAE;QACd,OAAO,IAAI,CAAC;KACZ;IACD,MAAM,QAAQ,GACb,OAAO,KAAK,KAAK,QAAQ;QACxB,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE;QACzC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;IACpC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtB,OAAO,KAAK,CAAC;AACd,CAAC;AA+BD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,mBAAmB,CAClC,MAA2B,EAC3B,YAA4B;IAE5B,MAAM,iBAAiB,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,kBAAkB,GACvB,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,iCAAiC,CAAC,IAAI,KAAK,CAAC;IAEjF,MAAM,aAAa,GAAG;QACrB,IAAI,EAAE,CAAC,KAA0B,EAAQ,EAAE;YAC1C,2DAA2D;YAC3D,gIAAgI;YAChI,2LAA2L;YAC3L,IAAI,kBAAkB,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE;gBAC9E,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACnB;QACF,CAAC;QACD,kBAAkB,EAAE,CAAC,KAAgC,EAAQ,EAAE;YAC9D,IAAI,kBAAkB,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE;gBAC9E,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;aACjC;QACF,CAAC;QACD,cAAc,EAAE,CAAC,KAAgC,EAAQ,EAAE;YAC1D,IAAI,kBAAkB,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE;gBAC9E,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;aAC7B;QACF,CAAC;QACD,oBAAoB,EAAE,CAAC,KAAgC,EAAQ,EAAE;YAChE,IAAI,kBAAkB,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE;gBAC9E,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;aACnC;QACF,CAAC;QACD,kBAAkB;KAClB,CAAC;IAEF,OAAO,aAAa,CAAC;AACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n\tITelemetryGenericEvent,\n} from \"@fluidframework/core-interfaces\";\nimport { loggerToMonitoringContext } from \"./config\";\nimport { ITelemetryGenericEventExt, ITelemetryLoggerExt } from \"./telemetryTypes\";\n\n/**\n * Like assert, but logs only if the condition is false, rather than throwing\n * @param condition - The condition to attest too\n * @param logger - The logger to log with\n * @param event - The string or event to log\n * @returns The outcome of the condition\n *\n * @internal\n *\n * @deprecated\n * This API will be removed in a future release.\n * No replacement API is intended, but reproducing its behavior should be trivial for anyone who needs it.\n */\nexport function logIfFalse(\n\tcondition: unknown,\n\tlogger: ITelemetryBaseLogger,\n\tevent: string | ITelemetryGenericEvent,\n): condition is true {\n\tif (condition) {\n\t\treturn true;\n\t}\n\tconst newEvent: ITelemetryBaseEvent =\n\t\ttypeof event === \"string\"\n\t\t\t? { eventName: event, category: \"error\" }\n\t\t\t: { category: \"error\", ...event };\n\tlogger.send(newEvent);\n\treturn false;\n}\n\n/**\n * An object that contains a callback used in conjunction with the {@link createSampledLogger} utility function to provide custom logic for sampling events.\n *\n * @internal\n */\nexport interface IEventSampler {\n\t/**\n\t * @returns true if the event should be sampled or false if not\n\t */\n\tsample: () => boolean | undefined;\n}\n\n/**\n * A telemetry logger that has sampling capabilities\n *\n * @internal\n */\nexport interface ISampledTelemetryLogger extends ITelemetryLoggerExt {\n\t/**\n\t * Indicates if the feature flag to disable sampling is set.\n\t *\n\t * @remarks Exposed to enable some advanced scenarios where the code using the sampled logger\n\t * could take advantage of skipping the execution of some logic when it can determine\n\t * it won't be necessary because the telemetry event that needs it wouldn't be\n\t * emitted anyway.\n\t */\n\tisSamplingDisabled: boolean;\n}\n\n/**\n * Wraps around an existing logger matching the {@link ITelemetryLoggerExt} interface and provides the ability to only log a subset of events using a sampling strategy provided by an ${@link IEventSampler}.\n * You can chose to not provide an event sampler which is effectively a no-op, meaning that it will be treated as if the sampler always returns true.\n *\n * @remarks\n * The sampling functionality uses the Fluid telemetry logging configuration along with the optionally provided event sampling callback to determine whether an event should\n * be logged or not.\n *\n * Configuration object parameters:\n * 'Fluid.Telemetry.DisableSampling': if this config value is set to true, all events will be unsampled and therefore logged.\n * Otherwise only a sample will be logged according to the provided event sampler callback.\n *\n * Note that the same sampler is used for all APIs of the returned logger. If you want separate events flowing through the returned logger to be sampled separately, the {@link IEventSampler} you provide should track them separately.\n *\n * @internal\n */\nexport function createSampledLogger(\n\tlogger: ITelemetryLoggerExt,\n\teventSampler?: IEventSampler,\n): ISampledTelemetryLogger {\n\tconst monitoringContext = loggerToMonitoringContext(logger);\n\tconst isSamplingDisabled =\n\t\tmonitoringContext.config.getBoolean(\"Fluid.Telemetry.DisableSampling\") ?? false;\n\n\tconst sampledLogger = {\n\t\tsend: (event: ITelemetryBaseEvent): void => {\n\t\t\t// The sampler uses the following logic for sending events:\n\t\t\t// 1. If isSamplingDisabled is true, then this means events should be unsampled. Therefore we send the event without any checks.\n\t\t\t// 2. If isSamplingDisabled is false, then event should be sampled using the event sampler, if the sampler is not defined just send all events, other use the eventSampler.sample() method.\n\t\t\tif (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {\n\t\t\t\tlogger.send(event);\n\t\t\t}\n\t\t},\n\t\tsendTelemetryEvent: (event: ITelemetryGenericEventExt): void => {\n\t\t\tif (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {\n\t\t\t\tlogger.sendTelemetryEvent(event);\n\t\t\t}\n\t\t},\n\t\tsendErrorEvent: (event: ITelemetryGenericEventExt): void => {\n\t\t\tif (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {\n\t\t\t\tlogger.sendErrorEvent(event);\n\t\t\t}\n\t\t},\n\t\tsendPerformanceEvent: (event: ITelemetryGenericEventExt): void => {\n\t\t\tif (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {\n\t\t\t\tlogger.sendPerformanceEvent(event);\n\t\t\t}\n\t\t},\n\t\tisSamplingDisabled,\n\t};\n\n\treturn sampledLogger;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAgCxD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,mBAAmB,CAClC,MAA2B,EAC3B,YAA4B;IAE5B,MAAM,iBAAiB,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,kBAAkB,GACvB,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,iCAAiC,CAAC,IAAI,KAAK,CAAC;IAEjF,MAAM,aAAa,GAAG;QACrB,IAAI,EAAE,CAAC,KAA0B,EAAQ,EAAE;YAC1C,2DAA2D;YAC3D,gIAAgI;YAChI,2LAA2L;YAC3L,IAAI,kBAAkB,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE;gBAC9E,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACnB;QACF,CAAC;QACD,kBAAkB,EAAE,CAAC,KAAgC,EAAQ,EAAE;YAC9D,IAAI,kBAAkB,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE;gBAC9E,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;aACjC;QACF,CAAC;QACD,cAAc,EAAE,CAAC,KAAgC,EAAQ,EAAE;YAC1D,IAAI,kBAAkB,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE;gBAC9E,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;aAC7B;QACF,CAAC;QACD,oBAAoB,EAAE,CAAC,KAAgC,EAAQ,EAAE;YAChE,IAAI,kBAAkB,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE;gBAC9E,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;aACnC;QACF,CAAC;QACD,kBAAkB;KAClB,CAAC;IAEF,OAAO,aAAa,CAAC;AACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ITelemetryBaseEvent } from \"@fluidframework/core-interfaces\";\nimport { loggerToMonitoringContext } from \"./config.js\";\nimport { ITelemetryGenericEventExt, ITelemetryLoggerExt } from \"./telemetryTypes.js\";\n\n/**\n * An object that contains a callback used in conjunction with the {@link createSampledLogger} utility function to provide custom logic for sampling events.\n *\n * @internal\n */\nexport interface IEventSampler {\n\t/**\n\t * @returns true if the event should be sampled or false if not\n\t */\n\tsample: () => boolean | undefined;\n}\n\n/**\n * A telemetry logger that has sampling capabilities\n *\n * @internal\n */\nexport interface ISampledTelemetryLogger extends ITelemetryLoggerExt {\n\t/**\n\t * Indicates if the feature flag to disable sampling is set.\n\t *\n\t * @remarks Exposed to enable some advanced scenarios where the code using the sampled logger\n\t * could take advantage of skipping the execution of some logic when it can determine\n\t * it won't be necessary because the telemetry event that needs it wouldn't be\n\t * emitted anyway.\n\t */\n\tisSamplingDisabled: boolean;\n}\n\n/**\n * Wraps around an existing logger matching the {@link ITelemetryLoggerExt} interface and provides the ability to only log a subset of events using a sampling strategy provided by an ${@link IEventSampler}.\n * You can chose to not provide an event sampler which is effectively a no-op, meaning that it will be treated as if the sampler always returns true.\n *\n * @remarks\n * The sampling functionality uses the Fluid telemetry logging configuration along with the optionally provided event sampling callback to determine whether an event should\n * be logged or not.\n *\n * Configuration object parameters:\n * 'Fluid.Telemetry.DisableSampling': if this config value is set to true, all events will be unsampled and therefore logged.\n * Otherwise only a sample will be logged according to the provided event sampler callback.\n *\n * Note that the same sampler is used for all APIs of the returned logger. If you want separate events flowing through the returned logger to be sampled separately, the {@link IEventSampler} you provide should track them separately.\n *\n * @internal\n */\nexport function createSampledLogger(\n\tlogger: ITelemetryLoggerExt,\n\teventSampler?: IEventSampler,\n): ISampledTelemetryLogger {\n\tconst monitoringContext = loggerToMonitoringContext(logger);\n\tconst isSamplingDisabled =\n\t\tmonitoringContext.config.getBoolean(\"Fluid.Telemetry.DisableSampling\") ?? false;\n\n\tconst sampledLogger = {\n\t\tsend: (event: ITelemetryBaseEvent): void => {\n\t\t\t// The sampler uses the following logic for sending events:\n\t\t\t// 1. If isSamplingDisabled is true, then this means events should be unsampled. Therefore we send the event without any checks.\n\t\t\t// 2. If isSamplingDisabled is false, then event should be sampled using the event sampler, if the sampler is not defined just send all events, other use the eventSampler.sample() method.\n\t\t\tif (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {\n\t\t\t\tlogger.send(event);\n\t\t\t}\n\t\t},\n\t\tsendTelemetryEvent: (event: ITelemetryGenericEventExt): void => {\n\t\t\tif (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {\n\t\t\t\tlogger.sendTelemetryEvent(event);\n\t\t\t}\n\t\t},\n\t\tsendErrorEvent: (event: ITelemetryGenericEventExt): void => {\n\t\t\tif (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {\n\t\t\t\tlogger.sendErrorEvent(event);\n\t\t\t}\n\t\t},\n\t\tsendPerformanceEvent: (event: ITelemetryGenericEventExt): void => {\n\t\t\tif (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {\n\t\t\t\tlogger.sendPerformanceEvent(event);\n\t\t\t}\n\t\t},\n\t\tisSamplingDisabled,\n\t};\n\n\treturn sampledLogger;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/telemetry-utils",
3
- "version": "2.0.0-rc.1.0.4",
3
+ "version": "2.0.0-rc.2.0.0",
4
4
  "description": "Collection of telemetry relates utilities for Fluid",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -11,12 +11,50 @@
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
13
  "sideEffects": false,
14
- "main": "dist/index.js",
15
- "module": "lib/index.js",
16
- "browser": {
17
- "./dist/indexNode.js": "./dist/indexBrowser.js",
18
- "./lib/indexNode.js": "./lib/indexBrowser.js"
14
+ "type": "module",
15
+ "exports": {
16
+ ".": {
17
+ "import": {
18
+ "types": "./lib/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "require": {
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/index.js"
24
+ }
25
+ },
26
+ "./public": {
27
+ "import": {
28
+ "types": "./lib/telemetry-utils-public.d.ts",
29
+ "default": "./lib/index.js"
30
+ },
31
+ "require": {
32
+ "types": "./dist/telemetry-utils-public.d.ts",
33
+ "default": "./dist/index.js"
34
+ }
35
+ },
36
+ "./alpha": {
37
+ "import": {
38
+ "types": "./lib/telemetry-utils-alpha.d.ts",
39
+ "default": "./lib/index.js"
40
+ },
41
+ "require": {
42
+ "types": "./dist/telemetry-utils-alpha.d.ts",
43
+ "default": "./dist/index.js"
44
+ }
45
+ },
46
+ "./internal": {
47
+ "import": {
48
+ "types": "./lib/index.d.ts",
49
+ "default": "./lib/index.js"
50
+ },
51
+ "require": {
52
+ "types": "./dist/index.d.ts",
53
+ "default": "./dist/index.js"
54
+ }
55
+ }
19
56
  },
57
+ "main": "dist/index.js",
20
58
  "types": "dist/index.d.ts",
21
59
  "c8": {
22
60
  "all": true,
@@ -39,39 +77,38 @@
39
77
  "temp-directory": "nyc/.nyc_output"
40
78
  },
41
79
  "dependencies": {
42
- "@fluid-internal/client-utils": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
43
- "@fluidframework/core-interfaces": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
44
- "@fluidframework/core-utils": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
45
- "@fluidframework/protocol-definitions": "^3.1.0",
80
+ "@fluid-internal/client-utils": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
81
+ "@fluidframework/core-interfaces": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
82
+ "@fluidframework/core-utils": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
83
+ "@fluidframework/protocol-definitions": "^3.2.0",
46
84
  "debug": "^4.3.4",
47
- "events": "^3.1.0",
48
85
  "uuid": "^9.0.0"
49
86
  },
50
87
  "devDependencies": {
51
88
  "@arethetypeswrong/cli": "^0.13.3",
52
- "@fluid-tools/build-cli": "^0.29.0",
89
+ "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.2.0.0 <2.0.0-rc.2.1.0",
90
+ "@fluid-tools/build-cli": "^0.34.0",
53
91
  "@fluidframework/build-common": "^2.0.3",
54
- "@fluidframework/build-tools": "^0.29.0",
55
- "@fluidframework/eslint-config-fluid": "^3.2.0",
56
- "@fluidframework/mocha-test-setup": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
92
+ "@fluidframework/build-tools": "^0.34.0",
93
+ "@fluidframework/eslint-config-fluid": "^4.0.0",
57
94
  "@fluidframework/telemetry-utils-previous": "npm:@fluidframework/telemetry-utils@2.0.0-internal.8.0.0",
58
- "@microsoft/api-extractor": "^7.38.3",
95
+ "@microsoft/api-extractor": "^7.42.3",
59
96
  "@types/debug": "^4.1.5",
60
- "@types/events": "^3.0.0",
61
97
  "@types/mocha": "^9.1.1",
62
98
  "@types/node": "^18.19.0",
99
+ "@types/sinon": "^17.0.3",
63
100
  "@types/uuid": "^9.0.2",
64
101
  "c8": "^8.0.1",
65
102
  "copyfiles": "^2.4.1",
66
103
  "cross-env": "^7.0.3",
67
- "eslint": "~8.50.0",
104
+ "eslint": "~8.55.0",
68
105
  "mocha": "^10.2.0",
69
106
  "mocha-json-output-reporter": "^2.0.1",
70
107
  "mocha-multi-reporters": "^1.5.1",
71
108
  "moment": "^2.21.0",
72
109
  "prettier": "~3.0.3",
73
110
  "rimraf": "^4.4.0",
74
- "sinon": "^7.4.2",
111
+ "sinon": "^17.0.1",
75
112
  "typescript": "~5.1.6"
76
113
  },
77
114
  "fluidBuild": {
@@ -95,21 +132,31 @@
95
132
  "RemovedTypeAliasDeclaration_ConfigTypes": {
96
133
  "backCompat": false,
97
134
  "forwardCompat": false
135
+ },
136
+ "RemovedFunctionDeclaration_logIfFalse": {
137
+ "backCompat": false,
138
+ "forwardCompat": false
139
+ },
140
+ "RemovedClassDeclaration_TelemetryNullLogger": {
141
+ "backCompat": false,
142
+ "forwardCompat": false
98
143
  }
99
144
  }
100
145
  },
101
146
  "scripts": {
102
147
  "api": "fluid-build . --task api",
103
- "api-extractor:commonjs": "api-extractor run --local",
104
- "api-extractor:esnext": "api-extractor run --config ./api-extractor-esm.json",
148
+ "api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
149
+ "api-extractor:esnext": "api-extractor run --local",
105
150
  "build": "fluid-build . --task build",
106
151
  "build:commonjs": "fluid-build . --task commonjs",
107
152
  "build:compile": "fluid-build . --task compile",
108
153
  "build:docs": "fluid-build . --task api",
109
- "build:esnext": "tsc --project ./tsconfig.esnext.json",
110
- "build:test": "tsc --project ./src/test/tsconfig.json",
154
+ "build:esnext": "tsc --project ./tsconfig.json",
155
+ "build:test": "npm run build:test:esm && npm run build:test:cjs",
156
+ "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
157
+ "build:test:esm": "tsc --project ./src/test/tsconfig.json",
111
158
  "bump-version": "npm version minor --no-push --no-git-tag-version && npm run build:genver",
112
- "check:are-the-types-wrong": "attw --pack",
159
+ "check:are-the-types-wrong": "attw --pack . --entrypoints .",
113
160
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
114
161
  "ci:build:docs": "api-extractor run",
115
162
  "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
@@ -122,9 +169,11 @@
122
169
  "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
123
170
  "test": "npm run test:mocha",
124
171
  "test:coverage": "c8 npm test",
125
- "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
172
+ "test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
173
+ "test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\" --exit",
174
+ "test:mocha:esm": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit",
126
175
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
127
- "tsc": "tsc",
176
+ "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
128
177
  "typetests:gen": "fluid-type-test-generator",
129
178
  "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
130
179
  }
package/src/config.ts CHANGED
@@ -8,8 +8,8 @@ import {
8
8
  ConfigTypes,
9
9
  } from "@fluidframework/core-interfaces";
10
10
  import { Lazy } from "@fluidframework/core-utils";
11
- import { createChildLogger, tagCodeArtifacts } from "./logger";
12
- import { ITelemetryLoggerExt } from "./telemetryTypes";
11
+ import { createChildLogger, tagCodeArtifacts } from "./logger.js";
12
+ import { ITelemetryLoggerExt } from "./telemetryTypes.js";
13
13
 
14
14
  /**
15
15
  * Explicitly typed interface for reading configurations.
package/src/error.ts CHANGED
@@ -18,8 +18,8 @@ import {
18
18
  isExternalError,
19
19
  normalizeError,
20
20
  wrapError,
21
- } from "./errorLogging";
22
- import { IFluidErrorBase } from "./fluidErrorBase";
21
+ } from "./errorLogging.js";
22
+ import { IFluidErrorBase } from "./fluidErrorBase.js";
23
23
 
24
24
  /**
25
25
  * Throws a UsageError with the given message if the condition is not met.
@@ -3,10 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
6
+ import type {
7
7
  ILoggingError,
8
8
  ITelemetryBaseProperties,
9
- TelemetryBaseEventPropertyType,
10
9
  Tagged,
11
10
  } from "@fluidframework/core-interfaces";
12
11
  import { v4 as uuid } from "uuid";
@@ -15,8 +14,13 @@ import {
15
14
  IFluidErrorBase,
16
15
  isFluidError,
17
16
  isValidLegacyError,
18
- } from "./fluidErrorBase";
19
- import { ITelemetryLoggerExt, TelemetryEventPropertyTypeExt } from "./telemetryTypes";
17
+ } from "./fluidErrorBase.js";
18
+ import type {
19
+ ITelemetryLoggerExt,
20
+ TelemetryEventPropertyTypeExt,
21
+ ITelemetryPropertiesExt,
22
+ } from "./telemetryTypes.js";
23
+ import { convertToBasePropertyType } from "./logger.js";
20
24
 
21
25
  /**
22
26
  * Determines if the provided value is an object but neither null nor an array.
@@ -87,8 +91,8 @@ export const isILoggingError = (x: unknown): x is ILoggingError =>
87
91
  * Copy props from source onto target, but do not overwrite an existing prop that matches
88
92
  */
89
93
  function copyProps(
90
- target: ITelemetryBaseProperties | LoggingError,
91
- source: ITelemetryBaseProperties,
94
+ target: ITelemetryPropertiesExt | LoggingError,
95
+ source: ITelemetryPropertiesExt,
92
96
  ): void {
93
97
  for (const key of Object.keys(source)) {
94
98
  if (target[key] === undefined) {
@@ -352,63 +356,6 @@ export function isTaggedTelemetryPropertyValue(
352
356
  return typeof (x as Partial<Tagged<unknown>>)?.tag === "string";
353
357
  }
354
358
 
355
- /**
356
- * Filter serializable telemetry properties
357
- * @param x - Any telemetry prop
358
- * @returns As-is if x is primitive. returns stringified if x is an array of primitive.
359
- * otherwise returns null since this is what we support at the moment.
360
- */
361
- function filterValidTelemetryProps(x: unknown, key: string): TelemetryBaseEventPropertyType {
362
- if (Array.isArray(x) && x.every((val) => isTelemetryEventPropertyValue(val))) {
363
- return JSON.stringify(x);
364
- }
365
- if (isTelemetryEventPropertyValue(x)) {
366
- return x;
367
- }
368
- // We don't support logging arbitrary objects
369
- console.error(`UnSupported Format of Logging Error Property for key ${key}:`, x);
370
- return "REDACTED (arbitrary object)";
371
- }
372
-
373
- // checking type of x, returns false if x is null
374
- function isTelemetryEventPropertyValue(x: unknown): x is TelemetryBaseEventPropertyType {
375
- switch (typeof x) {
376
- case "string":
377
- case "number":
378
- case "boolean":
379
- case "undefined": {
380
- return true;
381
- }
382
- default: {
383
- return false;
384
- }
385
- }
386
- }
387
-
388
- /**
389
- * Walk an object's enumerable properties to find those fit for telemetry.
390
- */
391
- function getValidTelemetryProps(obj: object, keysToOmit: Set<string>): ITelemetryBaseProperties {
392
- const props: ITelemetryBaseProperties = {};
393
- for (const key of Object.keys(obj)) {
394
- if (keysToOmit.has(key)) {
395
- continue;
396
- }
397
- const val = obj[key] as
398
- | TelemetryEventPropertyTypeExt
399
- | Tagged<TelemetryEventPropertyTypeExt>;
400
-
401
- // ensure only valid props get logged, since props of logging error could be in any shape
402
- props[key] = isTaggedTelemetryPropertyValue(val)
403
- ? {
404
- value: filterValidTelemetryProps(val.value, key),
405
- tag: val.tag,
406
- }
407
- : filterValidTelemetryProps(val, key);
408
- }
409
- return props;
410
- }
411
-
412
359
  /**
413
360
  * Borrowed from
414
361
  * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value#examples}
@@ -503,7 +450,7 @@ export class LoggingError
503
450
  /**
504
451
  * Add additional properties to be logged
505
452
  */
506
- public addTelemetryProperties(props: ITelemetryBaseProperties): void {
453
+ public addTelemetryProperties(props: ITelemetryPropertiesExt): void {
507
454
  copyProps(this, props);
508
455
  }
509
456
 
@@ -511,10 +458,22 @@ export class LoggingError
511
458
  * Get all properties fit to be logged to telemetry for this error
512
459
  */
513
460
  public getTelemetryProperties(): ITelemetryBaseProperties {
514
- const taggableProps = getValidTelemetryProps(this, this.omitPropsFromLogging);
515
- // Include non-enumerable props that are not returned by getValidTelemetryProps
461
+ // Only pick properties fit for telemetry out of all of this object's enumerable properties.
462
+ const telemetryProps: ITelemetryBaseProperties = {};
463
+ for (const key of Object.keys(this)) {
464
+ if (this.omitPropsFromLogging.has(key)) {
465
+ continue;
466
+ }
467
+ const val = this[key] as
468
+ | TelemetryEventPropertyTypeExt
469
+ | Tagged<TelemetryEventPropertyTypeExt>;
470
+
471
+ // Ensure only valid props get logged, since props of logging error could be in any shape
472
+ telemetryProps[key] = convertToBasePropertyType(val);
473
+ }
474
+ // Ensure a few extra props always exist
516
475
  return {
517
- ...taggableProps,
476
+ ...telemetryProps,
518
477
  stack: this.stack,
519
478
  message: this.message,
520
479
  errorInstanceId: this._errorInstanceId,
@@ -536,7 +495,7 @@ export const NORMALIZED_ERROR_TYPE = "genericError";
536
495
  */
537
496
  class NormalizedLoggingError extends LoggingError {
538
497
  // errorType "genericError" is used as a default value throughout the code.
539
- // Note that this matches ContainerErrorType/DriverErrorType's genericError
498
+ // Note that this matches ContainerErrorTypes/DriverErrorTypes' genericError
540
499
  errorType = NORMALIZED_ERROR_TYPE;
541
500
 
542
501
  constructor(errorProps: Pick<IFluidErrorBase, "message" | "stack">) {
@@ -14,7 +14,7 @@ import { IEvent } from "@fluidframework/core-interfaces";
14
14
  * @privateRemarks
15
15
  * This probably doesn't belong in this package, as it is not telemetry-specific, and is really only intended for internal fluid-framework use.
16
16
  * We should consider moving it to the `core-utils` package.
17
- * @public
17
+ * @alpha
18
18
  */
19
19
  export class EventEmitterWithErrorHandling<
20
20
  TEvent extends IEvent = IEvent,
package/src/events.ts CHANGED
@@ -3,10 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- // False positive: this is an import from the `events` package, not from Node.
7
- // eslint-disable-next-line unicorn/prefer-node-protocol
8
- import { EventEmitter } from "events";
9
- import { ITelemetryLoggerExt } from "./telemetryTypes";
6
+ import type { EventEmitter } from "@fluid-internal/client-utils";
7
+ import { ITelemetryLoggerExt } from "./telemetryTypes.js";
10
8
 
11
9
  /**
12
10
  * Note: The contents of this file really don't belong in this package, as they are only intended for internal use.
@@ -3,7 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryProperties } from "@fluidframework/core-interfaces";
6
+ import type { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
7
+ import type { ITelemetryPropertiesExt } from "./telemetryTypes.js";
7
8
 
8
9
  /**
9
10
  * An error emitted by the Fluid Framework.
@@ -61,12 +62,12 @@ export interface IFluidErrorBase extends Error {
61
62
  /**
62
63
  * Get the telemetry properties stashed on this error for logging.
63
64
  */
64
- getTelemetryProperties(): ITelemetryProperties;
65
+ getTelemetryProperties(): ITelemetryBaseProperties;
65
66
 
66
67
  /**
67
68
  * Add telemetry properties to this error which will be logged with the error
68
69
  */
69
- addTelemetryProperties: (props: ITelemetryProperties) => void;
70
+ addTelemetryProperties: (props: ITelemetryPropertiesExt) => void;
70
71
  }
71
72
 
72
73
  const hasTelemetryPropFunctions = (x: unknown): boolean =>
package/src/index.ts CHANGED
@@ -10,7 +10,7 @@ export {
10
10
  IConfigProvider,
11
11
  loggerToMonitoringContext,
12
12
  wrapConfigProviderWithDefaults,
13
- } from "./config";
13
+ } from "./config.js";
14
14
  export {
15
15
  DataCorruptionError,
16
16
  DataProcessingError,
@@ -18,7 +18,7 @@ export {
18
18
  GenericError,
19
19
  UsageError,
20
20
  validatePrecondition,
21
- } from "./error";
21
+ } from "./error.js";
22
22
  export {
23
23
  extractLogSafeErrorProperties,
24
24
  generateErrorWithStack,
@@ -34,20 +34,20 @@ export {
34
34
  overwriteStack,
35
35
  wrapError,
36
36
  wrapErrorAndLog,
37
- } from "./errorLogging";
38
- export { EventEmitterWithErrorHandling } from "./eventEmitterWithErrorHandling";
37
+ } from "./errorLogging.js";
38
+ export { EventEmitterWithErrorHandling } from "./eventEmitterWithErrorHandling.js";
39
39
  export {
40
40
  connectedEventName,
41
41
  disconnectedEventName,
42
42
  raiseConnectedEvent,
43
43
  safeRaiseEvent,
44
- } from "./events";
44
+ } from "./events.js";
45
45
  export {
46
46
  hasErrorInstanceId,
47
47
  IFluidErrorBase,
48
48
  isFluidError,
49
49
  isValidLegacyError,
50
- } from "./fluidErrorBase";
50
+ } from "./fluidErrorBase.js";
51
51
  export {
52
52
  eventNamespaceSeparator,
53
53
  createChildLogger,
@@ -64,12 +64,11 @@ export {
64
64
  tagCodeArtifacts,
65
65
  TelemetryDataTag,
66
66
  TelemetryEventPropertyTypes,
67
- TelemetryNullLogger,
68
- } from "./logger";
69
- export { MockLogger } from "./mockLogger";
70
- export { ThresholdCounter } from "./thresholdCounter";
71
- export { SampledTelemetryHelper } from "./sampledTelemetryHelper";
72
- export { logIfFalse, createSampledLogger, IEventSampler, ISampledTelemetryLogger } from "./utils";
67
+ } from "./logger.js";
68
+ export { MockLogger } from "./mockLogger.js";
69
+ export { ThresholdCounter } from "./thresholdCounter.js";
70
+ export { SampledTelemetryHelper } from "./sampledTelemetryHelper.js";
71
+ export { createSampledLogger, IEventSampler, ISampledTelemetryLogger } from "./utils.js";
73
72
  export {
74
73
  TelemetryEventPropertyTypeExt,
75
74
  ITelemetryEventExt,
@@ -80,4 +79,4 @@ export {
80
79
  ITaggedTelemetryPropertyTypeExt,
81
80
  ITelemetryPropertiesExt,
82
81
  TelemetryEventCategory,
83
- } from "./telemetryTypes";
82
+ } from "./telemetryTypes.js";
package/src/logger.ts CHANGED
@@ -6,23 +6,23 @@
6
6
  import {
7
7
  ITelemetryBaseEvent,
8
8
  ITelemetryBaseLogger,
9
- ITelemetryErrorEvent,
10
- ITelemetryGenericEvent,
11
- ITelemetryPerformanceEvent,
12
- TelemetryBaseEventPropertyType as TelemetryEventPropertyType,
13
9
  LogLevel,
14
10
  Tagged,
15
11
  ITelemetryBaseProperties,
16
12
  TelemetryBaseEventPropertyType,
17
13
  } from "@fluidframework/core-interfaces";
18
14
  import { IsomorphicPerformance, performance } from "@fluid-internal/client-utils";
19
- import { CachedConfigProvider, loggerIsMonitoringContext, mixinMonitoringContext } from "./config";
15
+ import {
16
+ CachedConfigProvider,
17
+ loggerIsMonitoringContext,
18
+ mixinMonitoringContext,
19
+ } from "./config.js";
20
20
  import {
21
21
  isILoggingError,
22
22
  extractLogSafeErrorProperties,
23
23
  generateStack,
24
24
  isTaggedTelemetryPropertyValue,
25
- } from "./errorLogging";
25
+ } from "./errorLogging.js";
26
26
  import {
27
27
  ITelemetryEventExt,
28
28
  ITelemetryGenericEventExt,
@@ -31,7 +31,8 @@ import {
31
31
  TelemetryEventPropertyTypeExt,
32
32
  TelemetryEventCategory,
33
33
  ITelemetryPropertiesExt,
34
- } from "./telemetryTypes";
34
+ type ITelemetryErrorEventExt,
35
+ } from "./telemetryTypes.js";
35
36
 
36
37
  export interface Memory {
37
38
  usedJSHeapSize: number;
@@ -230,7 +231,7 @@ export abstract class TelemetryLogger implements ITelemetryLoggerExt {
230
231
  * @param event - the event to send
231
232
  * @param error - optional error object to log
232
233
  */
233
- public sendErrorEvent(event: ITelemetryErrorEvent, error?: unknown): void {
234
+ public sendErrorEvent(event: ITelemetryErrorEventExt, error?: unknown): void {
234
235
  this.sendTelemetryEventCore(
235
236
  {
236
237
  // ensure the error field has some value,
@@ -848,23 +849,6 @@ export class PerformanceEvent {
848
849
  }
849
850
  }
850
851
 
851
- /**
852
- * Null logger that no-ops for all telemetry events passed to it.
853
- *
854
- * @deprecated This will be removed in a future release.
855
- * For internal use within the FluidFramework codebase, use {@link createChildLogger} with no arguments instead.
856
- * For external consumers we recommend writing a trivial implementation of {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}
857
- * where the send() method does nothing and using that.
858
- *
859
- * @internal
860
- */
861
- export class TelemetryNullLogger implements ITelemetryLoggerExt {
862
- public send(event: ITelemetryBaseEvent): void {}
863
- public sendTelemetryEvent(event: ITelemetryGenericEvent, error?: unknown): void {}
864
- public sendErrorEvent(event: ITelemetryErrorEvent, error?: unknown): void {}
865
- public sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: unknown): void {}
866
- }
867
-
868
852
  /**
869
853
  * Takes in an event object, and converts all of its values to a basePropertyType.
870
854
  * In the case of an invalid property type, the value will be converted to an error string.
@@ -886,14 +870,14 @@ function convertToBaseEvent({
886
870
  * Takes in value, and does one of 4 things.
887
871
  * if value is of primitive type - returns the original value.
888
872
  * If the value is a flat array or object - returns a stringified version of the array/object.
889
- * If the value is an object of type Tagged<TelemetryEventPropertyType> - returns the object
873
+ * If the value is an object of type Tagged<TelemetryBaseEventPropertyType> - returns the object
890
874
  * with its values recursively converted to base property Type.
891
875
  * If none of these cases are reached - returns an error string
892
876
  * @param x - value passed in to convert to a base property type
893
877
  */
894
878
  export function convertToBasePropertyType(
895
879
  x: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>,
896
- ): TelemetryEventPropertyType | Tagged<TelemetryEventPropertyType> {
880
+ ): TelemetryBaseEventPropertyType | Tagged<TelemetryBaseEventPropertyType> {
897
881
  return isTaggedTelemetryPropertyValue(x)
898
882
  ? {
899
883
  value: convertToBasePropertyTypeUntagged(x.value),
@@ -904,7 +888,7 @@ export function convertToBasePropertyType(
904
888
 
905
889
  function convertToBasePropertyTypeUntagged(
906
890
  x: TelemetryEventPropertyTypeExt,
907
- ): TelemetryEventPropertyType {
891
+ ): TelemetryBaseEventPropertyType {
908
892
  switch (typeof x) {
909
893
  case "string":
910
894
  case "number":
package/src/mockLogger.ts CHANGED
@@ -9,8 +9,8 @@ import {
9
9
  LogLevel,
10
10
  } from "@fluidframework/core-interfaces";
11
11
  import { assert } from "@fluidframework/core-utils";
12
- import { ITelemetryLoggerExt, ITelemetryPropertiesExt } from "./telemetryTypes";
13
- import { createChildLogger } from "./logger";
12
+ import { ITelemetryLoggerExt, ITelemetryPropertiesExt } from "./telemetryTypes.js";
13
+ import { createChildLogger } from "./logger.js";
14
14
 
15
15
  /**
16
16
  * The MockLogger records events sent to it, and then can walk back over those events