@fluidframework/telemetry-utils 2.0.0-internal.7.3.0 → 2.0.0-internal.8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/api-extractor-lint.json +13 -0
  3. package/api-extractor.json +3 -3
  4. package/api-report/telemetry-utils.api.md +64 -57
  5. package/dist/config.d.ts +37 -10
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js +30 -0
  8. package/dist/config.js.map +1 -1
  9. package/dist/error.d.ts +12 -0
  10. package/dist/error.d.ts.map +1 -1
  11. package/dist/error.js +18 -1
  12. package/dist/error.js.map +1 -1
  13. package/dist/errorLogging.d.ts +7 -2
  14. package/dist/errorLogging.d.ts.map +1 -1
  15. package/dist/errorLogging.js +7 -2
  16. package/dist/errorLogging.js.map +1 -1
  17. package/dist/eventEmitterWithErrorHandling.d.ts +6 -0
  18. package/dist/eventEmitterWithErrorHandling.d.ts.map +1 -1
  19. package/dist/eventEmitterWithErrorHandling.js +6 -0
  20. package/dist/eventEmitterWithErrorHandling.js.map +1 -1
  21. package/dist/events.d.ts +15 -0
  22. package/dist/events.d.ts.map +1 -1
  23. package/dist/events.js +16 -0
  24. package/dist/events.js.map +1 -1
  25. package/dist/fluidErrorBase.d.ts +8 -0
  26. package/dist/fluidErrorBase.d.ts.map +1 -1
  27. package/dist/fluidErrorBase.js +6 -0
  28. package/dist/fluidErrorBase.js.map +1 -1
  29. package/dist/index.d.ts +20 -3
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -1
  32. package/dist/index.js.map +1 -1
  33. package/dist/logger.d.ts +117 -17
  34. package/dist/logger.d.ts.map +1 -1
  35. package/dist/logger.js +82 -12
  36. package/dist/logger.js.map +1 -1
  37. package/dist/mockLogger.d.ts +2 -0
  38. package/dist/mockLogger.d.ts.map +1 -1
  39. package/dist/mockLogger.js +2 -0
  40. package/dist/mockLogger.js.map +1 -1
  41. package/dist/sampledTelemetryHelper.d.ts +7 -3
  42. package/dist/sampledTelemetryHelper.d.ts.map +1 -1
  43. package/dist/sampledTelemetryHelper.js +7 -3
  44. package/dist/sampledTelemetryHelper.js.map +1 -1
  45. package/dist/telemetry-utils-alpha.d.ts +270 -0
  46. package/dist/telemetry-utils-beta.d.ts +205 -0
  47. package/dist/telemetry-utils-public.d.ts +205 -0
  48. package/dist/telemetry-utils-untrimmed.d.ts +1123 -0
  49. package/dist/telemetryTypes.d.ts +27 -8
  50. package/dist/telemetryTypes.d.ts.map +1 -1
  51. package/dist/telemetryTypes.js.map +1 -1
  52. package/dist/thresholdCounter.d.ts +3 -2
  53. package/dist/thresholdCounter.d.ts.map +1 -1
  54. package/dist/thresholdCounter.js +3 -2
  55. package/dist/thresholdCounter.js.map +1 -1
  56. package/dist/utils.d.ts +6 -0
  57. package/dist/utils.d.ts.map +1 -1
  58. package/dist/utils.js +6 -0
  59. package/dist/utils.js.map +1 -1
  60. package/lib/config.d.ts +37 -10
  61. package/lib/config.d.ts.map +1 -1
  62. package/lib/config.js +30 -0
  63. package/lib/config.js.map +1 -1
  64. package/lib/error.d.ts +12 -0
  65. package/lib/error.d.ts.map +1 -1
  66. package/lib/error.js +16 -0
  67. package/lib/error.js.map +1 -1
  68. package/lib/errorLogging.d.ts +7 -2
  69. package/lib/errorLogging.d.ts.map +1 -1
  70. package/lib/errorLogging.js +7 -2
  71. package/lib/errorLogging.js.map +1 -1
  72. package/lib/eventEmitterWithErrorHandling.d.ts +6 -0
  73. package/lib/eventEmitterWithErrorHandling.d.ts.map +1 -1
  74. package/lib/eventEmitterWithErrorHandling.js +6 -0
  75. package/lib/eventEmitterWithErrorHandling.js.map +1 -1
  76. package/lib/events.d.ts +15 -0
  77. package/lib/events.d.ts.map +1 -1
  78. package/lib/events.js +16 -0
  79. package/lib/events.js.map +1 -1
  80. package/lib/fluidErrorBase.d.ts +8 -0
  81. package/lib/fluidErrorBase.d.ts.map +1 -1
  82. package/lib/fluidErrorBase.js +6 -0
  83. package/lib/fluidErrorBase.js.map +1 -1
  84. package/lib/index.d.ts +20 -3
  85. package/lib/index.d.ts.map +1 -1
  86. package/lib/index.js +1 -1
  87. package/lib/index.js.map +1 -1
  88. package/lib/logger.d.ts +117 -17
  89. package/lib/logger.d.ts.map +1 -1
  90. package/lib/logger.js +82 -12
  91. package/lib/logger.js.map +1 -1
  92. package/lib/mockLogger.d.ts +2 -0
  93. package/lib/mockLogger.d.ts.map +1 -1
  94. package/lib/mockLogger.js +2 -0
  95. package/lib/mockLogger.js.map +1 -1
  96. package/lib/sampledTelemetryHelper.d.ts +7 -3
  97. package/lib/sampledTelemetryHelper.d.ts.map +1 -1
  98. package/lib/sampledTelemetryHelper.js +7 -3
  99. package/lib/sampledTelemetryHelper.js.map +1 -1
  100. package/lib/telemetry-utils-alpha.d.ts +270 -0
  101. package/lib/telemetry-utils-beta.d.ts +205 -0
  102. package/lib/telemetry-utils-public.d.ts +205 -0
  103. package/lib/telemetry-utils-untrimmed.d.ts +1123 -0
  104. package/lib/telemetryTypes.d.ts +27 -8
  105. package/lib/telemetryTypes.d.ts.map +1 -1
  106. package/lib/telemetryTypes.js.map +1 -1
  107. package/lib/thresholdCounter.d.ts +3 -2
  108. package/lib/thresholdCounter.d.ts.map +1 -1
  109. package/lib/thresholdCounter.js +3 -2
  110. package/lib/thresholdCounter.js.map +1 -1
  111. package/lib/utils.d.ts +6 -0
  112. package/lib/utils.d.ts.map +1 -1
  113. package/lib/utils.js +6 -0
  114. package/lib/utils.js.map +1 -1
  115. package/package.json +29 -10
  116. package/src/config.ts +41 -12
  117. package/src/error.ts +21 -0
  118. package/src/errorLogging.ts +7 -2
  119. package/src/eventEmitterWithErrorHandling.ts +6 -0
  120. package/src/events.ts +18 -0
  121. package/src/fluidErrorBase.ts +8 -0
  122. package/src/index.ts +21 -2
  123. package/src/logger.ts +125 -17
  124. package/src/mockLogger.ts +2 -0
  125. package/src/sampledTelemetryHelper.ts +7 -3
  126. package/src/telemetryTypes.ts +27 -8
  127. package/src/thresholdCounter.ts +3 -2
  128. package/src/utils.ts +6 -0
@@ -7,13 +7,21 @@ import { ITelemetryBaseLogger, LogLevel, Tagged } from "@fluidframework/core-int
7
7
  * The categories FF uses when instrumenting the code.
8
8
  *
9
9
  * generic - Informational log event
10
+ *
10
11
  * error - Error log event, ideally 0 of these are logged during a session
12
+ *
11
13
  * performance - Includes duration, and often has _start, _end, or _cancel suffixes for activity tracking
14
+ * @alpha
12
15
  */
13
16
  export type TelemetryEventCategory = "generic" | "error" | "performance";
14
17
  /**
15
18
  * Property types that can be logged.
16
- * Includes extra types beyond TelemetryBaseEventPropertyType, which must be converted before sending to a base logger
19
+ *
20
+ * @remarks
21
+ * Includes extra types beyond {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType}, which must be
22
+ * converted before sending to a base logger.
23
+ *
24
+ * @alpha
17
25
  */
18
26
  export type TelemetryEventPropertyTypeExt = string | number | boolean | undefined | (string | number | boolean)[] | {
19
27
  [key: string]: // Flat objects can have the same properties as the event itself
@@ -24,7 +32,8 @@ export type TelemetryEventPropertyTypeExt = string | number | boolean | undefine
24
32
  * to mark pieces of information that should be organized or handled differently by loggers in various first or third
25
33
  * party scenarios. For example, tags are used to mark personal information that should not be stored in logs.
26
34
  *
27
- * @deprecated Use Tagged<TelemetryEventPropertyTypeExt>
35
+ * @deprecated Use {@link @fluidframework/core-interfaces#Tagged}\<{@link TelemetryEventPropertyTypeExt}\>
36
+ * @internal
28
37
  */
29
38
  export interface ITaggedTelemetryPropertyTypeExt {
30
39
  value: TelemetryEventPropertyTypeExt;
@@ -32,15 +41,19 @@ export interface ITaggedTelemetryPropertyTypeExt {
32
41
  }
33
42
  /**
34
43
  * JSON-serializable properties, which will be logged with telemetry.
44
+ *
45
+ * @alpha
35
46
  */
36
47
  export interface ITelemetryPropertiesExt {
37
48
  [index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;
38
49
  }
39
50
  /**
40
51
  * Interface for logging telemetry statements.
41
- * Can contain any number of properties that get serialized as json payload.
52
+ * @remarks May contain any number of properties that get serialized as json payload.
42
53
  * @param category - category of the event, like "error", "performance", "generic", etc.
43
54
  * @param eventName - name of the event.
55
+ *
56
+ * @internal
44
57
  */
45
58
  export interface ITelemetryEventExt extends ITelemetryPropertiesExt {
46
59
  category: string;
@@ -48,7 +61,8 @@ export interface ITelemetryEventExt extends ITelemetryPropertiesExt {
48
61
  }
49
62
  /**
50
63
  * Informational (non-error) telemetry event
51
- * Maps to category = "generic"
64
+ * @remarks Maps to category = "generic"
65
+ * @alpha
52
66
  */
53
67
  export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
54
68
  eventName: string;
@@ -56,22 +70,27 @@ export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
56
70
  }
57
71
  /**
58
72
  * Error telemetry event.
59
- * Maps to category = "error"
73
+ * @remarks Maps to category = "error"
74
+ * @alpha
60
75
  */
61
76
  export interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
62
77
  eventName: string;
63
78
  }
64
79
  /**
65
80
  * Performance telemetry event.
66
- * Maps to category = "performance"
81
+ * @remarks Maps to category = "performance"
82
+ * @alpha
67
83
  */
68
84
  export interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {
69
85
  duration?: number;
70
86
  }
71
87
  /**
72
- * An extended TelemetryLogger interface which allows for more lenient event types.
88
+ * An extended {@link @fluidframework/core-interfaces#ITelemetryBaseLogger} which allows for more lenient event types.
89
+ *
90
+ * @remarks
73
91
  * This interface is meant to be used internally within the Fluid Framework,
74
- * and ITelemetryBaseLogger should be used when loggers are passed between layers.
92
+ * and `ITelemetryBaseLogger` should be used when loggers are passed between layers.
93
+ * @alpha
75
94
  */
76
95
  export interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
77
96
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryTypes.d.ts","sourceRoot":"","sources":["../src/telemetryTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEzF;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAEzE;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GACtC,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,GACT,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,GAC7B;IACA,CAAC,GAAG,EAAE,MAAM,GACZ,AADe,gEAAgE;IAC/E,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;CACrE,CAAC;AAEL;;;;;;GAMG;AACH,MAAM,WAAW,+BAA+B;IAC/C,KAAK,EAAE,6BAA6B,CAAC;IACrC,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,CAAC,KAAK,EAAE,MAAM,GAAG,6BAA6B,GAAG,MAAM,CAAC,6BAA6B,CAAC,CAAC;CACvF;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,uBAAuB;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,sBAAsB,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,uBAAuB;IACvE,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,6BAA8B,SAAQ,yBAAyB;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAChE;;;;;OAKG;IACH,kBAAkB,CACjB,KAAK,EAAE,yBAAyB,EAChC,KAAK,CAAC,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,OAAO,QAAQ,CAAC,OAAO,GAAG,OAAO,QAAQ,CAAC,OAAO,GAC1D,IAAI,CAAC;IAER;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,uBAAuB,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEtE;;;;;OAKG;IACH,oBAAoB,CACnB,KAAK,EAAE,6BAA6B,EACpC,KAAK,CAAC,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,OAAO,QAAQ,CAAC,OAAO,GAAG,OAAO,QAAQ,CAAC,OAAO,GAC1D,IAAI,CAAC;CACR"}
1
+ {"version":3,"file":"telemetryTypes.d.ts","sourceRoot":"","sources":["../src/telemetryTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEzF;;;;;;;;;GASG;AACH,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAEzE;;;;;;;;GAQG;AACH,MAAM,MAAM,6BAA6B,GACtC,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,GACT,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,GAC7B;IACA,CAAC,GAAG,EAAE,MAAM,GACZ,AADe,gEAAgE;IAC/E,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;CACrE,CAAC;AAEL;;;;;;;GAOG;AACH,MAAM,WAAW,+BAA+B;IAC/C,KAAK,EAAE,6BAA6B,CAAC;IACrC,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACvC,CAAC,KAAK,EAAE,MAAM,GAAG,6BAA6B,GAAG,MAAM,CAAC,6BAA6B,CAAC,CAAC;CACvF;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,uBAAuB;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,sBAAsB,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,uBAAuB;IACvE,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,6BAA8B,SAAQ,yBAAyB;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAChE;;;;;OAKG;IACH,kBAAkB,CACjB,KAAK,EAAE,yBAAyB,EAChC,KAAK,CAAC,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,OAAO,QAAQ,CAAC,OAAO,GAAG,OAAO,QAAQ,CAAC,OAAO,GAC1D,IAAI,CAAC;IAER;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,uBAAuB,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEtE;;;;;OAKG;IACH,oBAAoB,CACnB,KAAK,EAAE,6BAA6B,EACpC,KAAK,CAAC,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,OAAO,QAAQ,CAAC,OAAO,GAAG,OAAO,QAAQ,CAAC,OAAO,GAC1D,IAAI,CAAC;CACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryTypes.js","sourceRoot":"","sources":["../src/telemetryTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger, LogLevel, Tagged } from \"@fluidframework/core-interfaces\";\n\n/**\n * The categories FF uses when instrumenting the code.\n *\n * generic - Informational log event\n * error - Error log event, ideally 0 of these are logged during a session\n * performance - Includes duration, and often has _start, _end, or _cancel suffixes for activity tracking\n */\nexport type TelemetryEventCategory = \"generic\" | \"error\" | \"performance\";\n\n/**\n * Property types that can be logged.\n * Includes extra types beyond TelemetryBaseEventPropertyType, which must be converted before sending to a base logger\n */\nexport type TelemetryEventPropertyTypeExt =\n\t| string\n\t| number\n\t| boolean\n\t| undefined\n\t| (string | number | boolean)[]\n\t| {\n\t\t\t[key: string]: // Flat objects can have the same properties as the event itself\n\t\t\tstring | number | boolean | undefined | (string | number | boolean)[];\n\t };\n\n/**\n * A property to be logged to telemetry containing both the value and a tag. Tags are generic strings that can be used\n * to mark pieces of information that should be organized or handled differently by loggers in various first or third\n * party scenarios. For example, tags are used to mark personal information that should not be stored in logs.\n *\n * @deprecated Use Tagged<TelemetryEventPropertyTypeExt>\n */\nexport interface ITaggedTelemetryPropertyTypeExt {\n\tvalue: TelemetryEventPropertyTypeExt;\n\ttag: string;\n}\n\n/**\n * JSON-serializable properties, which will be logged with telemetry.\n */\nexport interface ITelemetryPropertiesExt {\n\t[index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;\n}\n\n/**\n * Interface for logging telemetry statements.\n * Can contain any number of properties that get serialized as json payload.\n * @param category - category of the event, like \"error\", \"performance\", \"generic\", etc.\n * @param eventName - name of the event.\n */\nexport interface ITelemetryEventExt extends ITelemetryPropertiesExt {\n\tcategory: string;\n\teventName: string;\n}\n\n/**\n * Informational (non-error) telemetry event\n * Maps to category = \"generic\"\n */\nexport interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {\n\teventName: string;\n\tcategory?: TelemetryEventCategory;\n}\n\n/**\n * Error telemetry event.\n * Maps to category = \"error\"\n */\nexport interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {\n\teventName: string;\n}\n\n/**\n * Performance telemetry event.\n * Maps to category = \"performance\"\n */\nexport interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {\n\tduration?: number; // Duration of event (optional)\n}\n\n/**\n * An extended TelemetryLogger interface which allows for more lenient event types.\n * This interface is meant to be used internally within the Fluid Framework,\n * and ITelemetryBaseLogger should be used when loggers are passed between layers.\n */\nexport interface ITelemetryLoggerExt extends ITelemetryBaseLogger {\n\t/**\n\t * Send information telemetry event\n\t * @param event - Event to send\n\t * @param error - optional error object to log\n\t * @param logLevel - optional level of the log.\n\t */\n\tsendTelemetryEvent(\n\t\tevent: ITelemetryGenericEventExt,\n\t\terror?: unknown,\n\t\tlogLevel?: typeof LogLevel.verbose | typeof LogLevel.default,\n\t): void;\n\n\t/**\n\t * Send error telemetry event\n\t * @param event - Event to send\n\t * @param error - optional error object to log\n\t */\n\tsendErrorEvent(event: ITelemetryErrorEventExt, error?: unknown): void;\n\n\t/**\n\t * Send performance telemetry event\n\t * @param event - Event to send\n\t * @param error - optional error object to log\n\t * @param logLevel - optional level of the log.\n\t */\n\tsendPerformanceEvent(\n\t\tevent: ITelemetryPerformanceEventExt,\n\t\terror?: unknown,\n\t\tlogLevel?: typeof LogLevel.verbose | typeof LogLevel.default,\n\t): void;\n}\n"]}
1
+ {"version":3,"file":"telemetryTypes.js","sourceRoot":"","sources":["../src/telemetryTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger, LogLevel, Tagged } from \"@fluidframework/core-interfaces\";\n\n/**\n * The categories FF uses when instrumenting the code.\n *\n * generic - Informational log event\n *\n * error - Error log event, ideally 0 of these are logged during a session\n *\n * performance - Includes duration, and often has _start, _end, or _cancel suffixes for activity tracking\n * @alpha\n */\nexport type TelemetryEventCategory = \"generic\" | \"error\" | \"performance\";\n\n/**\n * Property types that can be logged.\n *\n * @remarks\n * Includes extra types beyond {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType}, which must be\n * converted before sending to a base logger.\n *\n * @alpha\n */\nexport type TelemetryEventPropertyTypeExt =\n\t| string\n\t| number\n\t| boolean\n\t| undefined\n\t| (string | number | boolean)[]\n\t| {\n\t\t\t[key: string]: // Flat objects can have the same properties as the event itself\n\t\t\tstring | number | boolean | undefined | (string | number | boolean)[];\n\t };\n\n/**\n * A property to be logged to telemetry containing both the value and a tag. Tags are generic strings that can be used\n * to mark pieces of information that should be organized or handled differently by loggers in various first or third\n * party scenarios. For example, tags are used to mark personal information that should not be stored in logs.\n *\n * @deprecated Use {@link @fluidframework/core-interfaces#Tagged}\\<{@link TelemetryEventPropertyTypeExt}\\>\n * @internal\n */\nexport interface ITaggedTelemetryPropertyTypeExt {\n\tvalue: TelemetryEventPropertyTypeExt;\n\ttag: string;\n}\n\n/**\n * JSON-serializable properties, which will be logged with telemetry.\n *\n * @alpha\n */\nexport interface ITelemetryPropertiesExt {\n\t[index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;\n}\n\n/**\n * Interface for logging telemetry statements.\n * @remarks May contain any number of properties that get serialized as json payload.\n * @param category - category of the event, like \"error\", \"performance\", \"generic\", etc.\n * @param eventName - name of the event.\n *\n * @internal\n */\nexport interface ITelemetryEventExt extends ITelemetryPropertiesExt {\n\tcategory: string;\n\teventName: string;\n}\n\n/**\n * Informational (non-error) telemetry event\n * @remarks Maps to category = \"generic\"\n * @alpha\n */\nexport interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {\n\teventName: string;\n\tcategory?: TelemetryEventCategory;\n}\n\n/**\n * Error telemetry event.\n * @remarks Maps to category = \"error\"\n * @alpha\n */\nexport interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {\n\teventName: string;\n}\n\n/**\n * Performance telemetry event.\n * @remarks Maps to category = \"performance\"\n * @alpha\n */\nexport interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {\n\tduration?: number; // Duration of event (optional)\n}\n\n/**\n * An extended {@link @fluidframework/core-interfaces#ITelemetryBaseLogger} which allows for more lenient event types.\n *\n * @remarks\n * This interface is meant to be used internally within the Fluid Framework,\n * and `ITelemetryBaseLogger` should be used when loggers are passed between layers.\n * @alpha\n */\nexport interface ITelemetryLoggerExt extends ITelemetryBaseLogger {\n\t/**\n\t * Send information telemetry event\n\t * @param event - Event to send\n\t * @param error - optional error object to log\n\t * @param logLevel - optional level of the log.\n\t */\n\tsendTelemetryEvent(\n\t\tevent: ITelemetryGenericEventExt,\n\t\terror?: unknown,\n\t\tlogLevel?: typeof LogLevel.verbose | typeof LogLevel.default,\n\t): void;\n\n\t/**\n\t * Send error telemetry event\n\t * @param event - Event to send\n\t * @param error - optional error object to log\n\t */\n\tsendErrorEvent(event: ITelemetryErrorEventExt, error?: unknown): void;\n\n\t/**\n\t * Send performance telemetry event\n\t * @param event - Event to send\n\t * @param error - optional error object to log\n\t * @param logLevel - optional level of the log.\n\t */\n\tsendPerformanceEvent(\n\t\tevent: ITelemetryPerformanceEventExt,\n\t\terror?: unknown,\n\t\tlogLevel?: typeof LogLevel.verbose | typeof LogLevel.default,\n\t): void;\n}\n"]}
@@ -4,8 +4,9 @@
4
4
  */
5
5
  import { ITelemetryLoggerExt } from "./telemetryTypes";
6
6
  /**
7
- * Utility counter which will send event only if the provided value
8
- * is above a configured threshold
7
+ * Utility counter which will send event only if the provided value is above a configured threshold.
8
+ *
9
+ * @internal
9
10
  */
10
11
  export declare class ThresholdCounter {
11
12
  private readonly threshold;
@@ -1 +1 @@
1
- {"version":3,"file":"thresholdCounter.d.ts","sourceRoot":"","sources":["../src/thresholdCounter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;GAGG;AACH,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,iBAAiB;gBAFR,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,EACpC,iBAAiB,SAAY;IAGtC;;OAEG;IACI,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAUnD;;;;;;OAMG;IACI,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAU7D"}
1
+ {"version":3,"file":"thresholdCounter.d.ts","sourceRoot":"","sources":["../src/thresholdCounter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;;GAIG;AACH,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,iBAAiB;gBAFR,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,EACpC,iBAAiB,SAAY;IAGtC;;OAEG;IACI,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAUnD;;;;;;OAMG;IACI,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAU7D"}
@@ -3,8 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  /**
6
- * Utility counter which will send event only if the provided value
7
- * is above a configured threshold
6
+ * Utility counter which will send event only if the provided value is above a configured threshold.
7
+ *
8
+ * @internal
8
9
  */
9
10
  export class ThresholdCounter {
10
11
  constructor(threshold, logger, thresholdMultiple = threshold) {
@@ -1 +1 @@
1
- {"version":3,"file":"thresholdCounter.js","sourceRoot":"","sources":["../src/thresholdCounter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAC5B,YACkB,SAAiB,EACjB,MAA2B,EACpC,oBAAoB,SAAS;QAFpB,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAqB;QACpC,sBAAiB,GAAjB,iBAAiB,CAAY;IACnC,CAAC;IAEJ;;OAEG;IACI,IAAI,CAAC,SAAiB,EAAE,KAAa;QAC3C,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE;YAC3B,OAAO;SACP;QACD,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;YAChC,SAAS;YACT,KAAK;SACL,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAC,SAAiB,EAAE,KAAa;QACrD,IAAI,KAAK,KAAK,IAAI,CAAC,iBAAiB,EAAE;YACrC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBAChC,SAAS;gBACT,KAAK;aACL,CAAC,CAAC;YACH,sCAAsC;YACtC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;SACpD;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"./telemetryTypes\";\n\n/**\n * Utility counter which will send event only if the provided value\n * is above a configured threshold\n */\nexport class ThresholdCounter {\n\tpublic constructor(\n\t\tprivate readonly threshold: number,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate thresholdMultiple = threshold,\n\t) {}\n\n\t/**\n\t * Sends the value if it's above the treshold.\n\t */\n\tpublic send(eventName: string, value: number): void {\n\t\tif (value < this.threshold) {\n\t\t\treturn;\n\t\t}\n\t\tthis.logger.sendPerformanceEvent({\n\t\t\teventName,\n\t\t\tvalue,\n\t\t});\n\t}\n\n\t/**\n\t * Sends the value if it's above the threshold\n\t * and a multiple of the threshold.\n\t *\n\t * To be used in scenarios where we'd like to record a\n\t * threshold violation while reducing telemetry noise.\n\t */\n\tpublic sendIfMultiple(eventName: string, value: number): void {\n\t\tif (value === this.thresholdMultiple) {\n\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\teventName,\n\t\t\t\tvalue,\n\t\t\t});\n\t\t\t// reduce number of \"multiple\" events.\n\t\t\tthis.thresholdMultiple = this.thresholdMultiple * 2;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"thresholdCounter.js","sourceRoot":"","sources":["../src/thresholdCounter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAC5B,YACkB,SAAiB,EACjB,MAA2B,EACpC,oBAAoB,SAAS;QAFpB,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAqB;QACpC,sBAAiB,GAAjB,iBAAiB,CAAY;IACnC,CAAC;IAEJ;;OAEG;IACI,IAAI,CAAC,SAAiB,EAAE,KAAa;QAC3C,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE;YAC3B,OAAO;SACP;QACD,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;YAChC,SAAS;YACT,KAAK;SACL,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAC,SAAiB,EAAE,KAAa;QACrD,IAAI,KAAK,KAAK,IAAI,CAAC,iBAAiB,EAAE;YACrC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBAChC,SAAS;gBACT,KAAK;aACL,CAAC,CAAC;YACH,sCAAsC;YACtC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;SACpD;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"./telemetryTypes\";\n\n/**\n * Utility counter which will send event only if the provided value is above a configured threshold.\n *\n * @internal\n */\nexport class ThresholdCounter {\n\tpublic constructor(\n\t\tprivate readonly threshold: number,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate thresholdMultiple = threshold,\n\t) {}\n\n\t/**\n\t * Sends the value if it's above the treshold.\n\t */\n\tpublic send(eventName: string, value: number): void {\n\t\tif (value < this.threshold) {\n\t\t\treturn;\n\t\t}\n\t\tthis.logger.sendPerformanceEvent({\n\t\t\teventName,\n\t\t\tvalue,\n\t\t});\n\t}\n\n\t/**\n\t * Sends the value if it's above the threshold\n\t * and a multiple of the threshold.\n\t *\n\t * To be used in scenarios where we'd like to record a\n\t * threshold violation while reducing telemetry noise.\n\t */\n\tpublic sendIfMultiple(eventName: string, value: number): void {\n\t\tif (value === this.thresholdMultiple) {\n\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\teventName,\n\t\t\t\tvalue,\n\t\t\t});\n\t\t\t// reduce number of \"multiple\" events.\n\t\t\tthis.thresholdMultiple = this.thresholdMultiple * 2;\n\t\t}\n\t}\n}\n"]}
package/lib/utils.d.ts CHANGED
@@ -10,6 +10,12 @@ import { ITelemetryLoggerExt } from "./telemetryTypes";
10
10
  * @param logger - The logger to log with
11
11
  * @param event - The string or event to log
12
12
  * @returns The outcome of the condition
13
+ *
14
+ * @internal
15
+ *
16
+ * @deprecated
17
+ * This API will be removed in a future release.
18
+ * No replacement API is intended, but reproducing its behavior should be trivial for anyone who needs it.
13
19
  */
14
20
  export declare function logIfFalse(condition: unknown, logger: ITelemetryBaseLogger, event: string | ITelemetryGenericEvent): condition is true;
15
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAEN,oBAAoB,EACpB,sBAAsB,EACtB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAA6B,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAElF;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,oBAAoB,EAC5B,KAAK,EAAE,MAAM,GAAG,sBAAsB,GACpC,SAAS,IAAI,IAAI,CAUnB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,MAAM,EAAE,MAAM,OAAO,GAAG,SAAS,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IACnE;;;;;;;OAOG;IACH,kBAAkB,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,mBAAmB,EAC3B,YAAY,CAAC,EAAE,aAAa,GAC1B,uBAAuB,CAiCzB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAEN,oBAAoB,EACpB,sBAAsB,EACtB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAA6B,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAElF;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CACzB,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,oBAAoB,EAC5B,KAAK,EAAE,MAAM,GAAG,sBAAsB,GACpC,SAAS,IAAI,IAAI,CAUnB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,MAAM,EAAE,MAAM,OAAO,GAAG,SAAS,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IACnE;;;;;;;OAOG;IACH,kBAAkB,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,mBAAmB,EAC3B,YAAY,CAAC,EAAE,aAAa,GAC1B,uBAAuB,CAiCzB"}
package/lib/utils.js CHANGED
@@ -5,6 +5,12 @@ import { loggerToMonitoringContext } from "./config";
5
5
  * @param logger - The logger to log with
6
6
  * @param event - The string or event to log
7
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.
8
14
  */
9
15
  export function logIfFalse(condition, logger, event) {
10
16
  if (condition) {
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;;;;;;GAMG;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 */\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":"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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/telemetry-utils",
3
- "version": "2.0.0-internal.7.3.0",
3
+ "version": "2.0.0-internal.8.0.0",
4
4
  "description": "Collection of telemetry relates utilities for Fluid",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -39,28 +39,30 @@
39
39
  "temp-directory": "nyc/.nyc_output"
40
40
  },
41
41
  "dependencies": {
42
- "@fluid-internal/client-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
43
- "@fluidframework/core-interfaces": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
44
- "@fluidframework/core-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
42
+ "@fluid-internal/client-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
43
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
44
+ "@fluidframework/core-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
45
45
  "@fluidframework/protocol-definitions": "^3.0.0",
46
46
  "debug": "^4.3.4",
47
47
  "events": "^3.1.0",
48
48
  "uuid": "^9.0.0"
49
49
  },
50
50
  "devDependencies": {
51
+ "@arethetypeswrong/cli": "^0.13.3",
51
52
  "@fluid-tools/build-cli": "^0.28.0",
52
53
  "@fluidframework/build-common": "^2.0.3",
53
54
  "@fluidframework/build-tools": "^0.28.0",
54
55
  "@fluidframework/eslint-config-fluid": "^3.1.0",
55
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
56
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
56
57
  "@fluidframework/telemetry-utils-previous": "npm:@fluidframework/telemetry-utils@2.0.0-internal.7.2.0",
57
58
  "@microsoft/api-extractor": "^7.38.3",
58
59
  "@types/debug": "^4.1.5",
59
60
  "@types/events": "^3.0.0",
60
61
  "@types/mocha": "^9.1.1",
61
- "@types/node": "^16.18.38",
62
+ "@types/node": "^18.19.0",
62
63
  "@types/uuid": "^9.0.2",
63
64
  "c8": "^7.7.1",
65
+ "copyfiles": "^2.4.1",
64
66
  "cross-env": "^7.0.3",
65
67
  "eslint": "~8.50.0",
66
68
  "mocha": "^10.2.0",
@@ -72,26 +74,43 @@
72
74
  "sinon": "^7.4.2",
73
75
  "typescript": "~5.1.6"
74
76
  },
77
+ "fluidBuild": {
78
+ "tasks": {
79
+ "build:docs": {
80
+ "dependsOn": [
81
+ "...",
82
+ "api-extractor:commonjs",
83
+ "api-extractor:esnext"
84
+ ],
85
+ "script": false
86
+ }
87
+ }
88
+ },
75
89
  "typeValidation": {
76
90
  "broken": {}
77
91
  },
78
92
  "scripts": {
93
+ "api": "fluid-build . --task api",
94
+ "api-extractor:commonjs": "api-extractor run --local",
95
+ "api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
79
96
  "build": "fluid-build . --task build",
80
97
  "build:commonjs": "fluid-build . --task commonjs",
81
98
  "build:compile": "fluid-build . --task compile",
82
- "build:docs": "api-extractor run --local",
99
+ "build:docs": "fluid-build . --task api",
83
100
  "build:esnext": "tsc --project ./tsconfig.esnext.json",
84
101
  "build:test": "tsc --project ./src/test/tsconfig.json",
85
102
  "bump-version": "npm version minor --no-push --no-git-tag-version && npm run build:genver",
103
+ "check:are-the-types-wrong": "attw --pack",
104
+ "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
86
105
  "ci:build:docs": "api-extractor run",
87
106
  "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
88
107
  "eslint": "eslint --format stylish src",
89
108
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
90
109
  "format": "npm run prettier:fix",
91
- "lint": "npm run prettier && npm run eslint",
110
+ "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
92
111
  "lint:fix": "npm run prettier:fix && npm run eslint:fix",
93
- "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
94
- "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
112
+ "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
113
+ "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
95
114
  "test": "npm run test:mocha",
96
115
  "test:coverage": "c8 npm test",
97
116
  "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
package/src/config.ts CHANGED
@@ -2,22 +2,19 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
5
+ import {
6
+ ITelemetryBaseLogger,
7
+ IConfigProviderBase,
8
+ ConfigTypes,
9
+ } from "@fluidframework/core-interfaces";
6
10
  import { Lazy } from "@fluidframework/core-utils";
7
11
  import { createChildLogger, tagCodeArtifacts } from "./logger";
8
12
  import { ITelemetryLoggerExt } from "./telemetryTypes";
9
13
 
10
- export type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;
11
-
12
- /**
13
- * Base interface for providing configurations to enable/disable/control features
14
- */
15
- export interface IConfigProviderBase {
16
- getRawConfig(name: string): ConfigTypes;
17
- }
18
-
19
14
  /**
20
- * Explicitly typed interface for reading configurations
15
+ * Explicitly typed interface for reading configurations.
16
+ *
17
+ * @internal
21
18
  */
22
19
  export interface IConfigProvider extends IConfigProviderBase {
23
20
  getBoolean(name: string): boolean | undefined;
@@ -31,6 +28,8 @@ export interface IConfigProvider extends IConfigProviderBase {
31
28
  * Creates a base configuration provider based on `sessionStorage`
32
29
  *
33
30
  * @returns A lazy initialized base configuration provider with `sessionStorage` as the underlying config store
31
+ *
32
+ * @internal
34
33
  */
35
34
  export const sessionStorageConfigProvider = new Lazy<IConfigProviderBase>(() =>
36
35
  inMemoryConfigProvider(safeSessionStorage()),
@@ -245,13 +244,21 @@ export class CachedConfigProvider implements IConfigProvider {
245
244
  }
246
245
 
247
246
  /**
248
- * A type containing both a telemetry logger and a configuration provider
247
+ * A type containing both a telemetry logger and a configuration provider.
248
+ *
249
+ * @internal
249
250
  */
250
251
  export interface MonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt> {
251
252
  config: IConfigProvider;
252
253
  logger: L;
253
254
  }
254
255
 
256
+ /**
257
+ * Determines whether or not the provided object is a {@link MonitoringContext}.
258
+ * @remarks Can be used for type-narrowing.
259
+ *
260
+ * @internal
261
+ */
255
262
  export function loggerIsMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(
256
263
  obj: L,
257
264
  ): obj is L & MonitoringContext<L> {
@@ -259,6 +266,11 @@ export function loggerIsMonitoringContext<L extends ITelemetryBaseLogger = ITele
259
266
  return isConfigProviderBase(maybeConfig?.config) && maybeConfig?.logger !== undefined;
260
267
  }
261
268
 
269
+ /**
270
+ * Creates a {@link MonitoringContext} from the provided logger, if it isn't already one.
271
+ *
272
+ * @internal
273
+ */
262
274
  export function loggerToMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(
263
275
  logger: L,
264
276
  ): MonitoringContext<L> {
@@ -268,6 +280,17 @@ export function loggerToMonitoringContext<L extends ITelemetryBaseLogger = ITele
268
280
  return mixinMonitoringContext<L>(logger, sessionStorageConfigProvider.value);
269
281
  }
270
282
 
283
+ /**
284
+ * Creates a {@link MonitoringContext} from the provided logger.
285
+ *
286
+ * @remarks
287
+ * Assumes that the provided logger is not itself already a {@link MonitoringContext}, and will throw an error if it is.
288
+ * If you are unsure, use {@link loggerToMonitoringContext} instead.
289
+ *
290
+ * @throws If the provided logger is already a {@link MonitoringContext}.
291
+ *
292
+ * @internal
293
+ */
271
294
  export function mixinMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(
272
295
  logger: L,
273
296
  ...configs: (IConfigProviderBase | undefined)[]
@@ -294,6 +317,12 @@ function isConfigProviderBase(obj: unknown): obj is IConfigProviderBase {
294
317
  return typeof maybeConfig?.getRawConfig === "function";
295
318
  }
296
319
 
320
+ /**
321
+ * Creates a child logger with a {@link MonitoringContext}.
322
+ *
323
+ * @see {@link loggerToMonitoringContext}
324
+ * @internal
325
+ */
297
326
  export function createChildMonitoringContext(
298
327
  props: Parameters<typeof createChildLogger>[0],
299
328
  ): MonitoringContext {
package/src/error.ts CHANGED
@@ -21,6 +21,25 @@ import {
21
21
  } from "./errorLogging";
22
22
  import { IFluidErrorBase } from "./fluidErrorBase";
23
23
 
24
+ /**
25
+ * Throws a UsageError with the given message if the condition is not met.
26
+ * Use this API when `false` indicates a precondition is not met on a public API (for any FF layer).
27
+ *
28
+ * @param condition - The condition that should be true, if the condition is false a UsageError will be thrown.
29
+ * @param message - The message to include in the error when the condition does not hold.
30
+ * @param props - Telemetry props to include on the error when the condition does not hold.
31
+ * @internal
32
+ */
33
+ export function validatePrecondition(
34
+ condition: boolean,
35
+ message: string,
36
+ props?: ITelemetryBaseProperties,
37
+ ): asserts condition {
38
+ if (!condition) {
39
+ throw new UsageError(message, props);
40
+ }
41
+ }
42
+
24
43
  /**
25
44
  * Generic wrapper for an unrecognized/uncategorized error object
26
45
  *
@@ -184,6 +203,8 @@ export class DataProcessingError extends LoggingError implements IErrorBase, IFl
184
203
  * Extracts specific properties from the provided message that we know are safe to log.
185
204
  *
186
205
  * @param messageLike - Message to include info about via telemetry props.
206
+ *
207
+ * @internal
187
208
  */
188
209
  export const extractSafePropertiesFromMessage = (
189
210
  messageLike: Partial<
@@ -76,7 +76,9 @@ export function extractLogSafeErrorProperties(
76
76
  }
77
77
 
78
78
  /**
79
- * type guard for ILoggingError interface
79
+ * Type-guard for {@link @fluidframework/core-interfaces#ILoggingError}.
80
+ *
81
+ * @internal
80
82
  */
81
83
  export const isILoggingError = (x: unknown): x is ILoggingError =>
82
84
  typeof (x as Partial<ILoggingError>)?.getTelemetryProperties === "function";
@@ -339,7 +341,10 @@ export function isExternalError(error: unknown): boolean {
339
341
  }
340
342
 
341
343
  /**
342
- * Type guard to identify if a particular telemetry property appears to be a tagged telemetry property
344
+ * Type guard to identify if a particular telemetry property appears to be a
345
+ * {@link @fluidframework/core-interfaces#Tagged} telemetry property.
346
+ *
347
+ * @internal
343
348
  */
344
349
  export function isTaggedTelemetryPropertyValue(
345
350
  x: Tagged<TelemetryEventPropertyTypeExt> | TelemetryEventPropertyTypeExt,
@@ -7,8 +7,14 @@ import { IEvent } from "@fluidframework/core-interfaces";
7
7
 
8
8
  /**
9
9
  * Event Emitter helper class
10
+ *
11
+ * @remarks
10
12
  * Any exceptions thrown by listeners will be caught and raised through "error" event.
11
13
  * Any exception thrown by "error" listeners will propagate to the caller.
14
+ * @privateRemarks
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
+ * We should consider moving it to the `core-utils` package.
17
+ * @alpha
12
18
  */
13
19
  export class EventEmitterWithErrorHandling<
14
20
  TEvent extends IEvent = IEvent,
package/src/events.ts CHANGED
@@ -8,9 +8,25 @@
8
8
  import { EventEmitter } from "events";
9
9
  import { ITelemetryLoggerExt } from "./telemetryTypes";
10
10
 
11
+ /**
12
+ * Note: The contents of this file really don't belong in this package, as they are only intended for internal use.
13
+ * They should be moved into the `core-utils` package in the future.
14
+ */
15
+
16
+ /**
17
+ * @internal
18
+ */
11
19
  export const connectedEventName = "connected";
20
+
21
+ /**
22
+ * @internal
23
+ */
12
24
  export const disconnectedEventName = "disconnected";
13
25
 
26
+ // eslint-disable-next-line jsdoc/require-description
27
+ /**
28
+ * @internal
29
+ */
14
30
  export function safeRaiseEvent(
15
31
  emitter: EventEmitter,
16
32
  logger: ITelemetryLoggerExt,
@@ -31,6 +47,8 @@ export function safeRaiseEvent(
31
47
  * @param connected - A boolean tracking whether the connection was in a connected state or not
32
48
  * @param clientId - The connected/disconnected clientId
33
49
  * @param disconnectedReason - The reason for the connection to be disconnected (Used for telemetry purposes only)
50
+ *
51
+ * @internal
34
52
  */
35
53
  export function raiseConnectedEvent(
36
54
  logger: ITelemetryLoggerExt,
@@ -15,6 +15,8 @@ import { ITelemetryProperties } from "@fluidframework/core-interfaces";
15
15
  * It features the members of {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error | Error}
16
16
  * made readonly, as well as {@link IFluidErrorBase.errorType} and {@link IFluidErrorBase.errorInstanceId}.
17
17
  * It also features getters and setters for telemetry props to be included when the error is logged.
18
+ *
19
+ * @internal
18
20
  */
19
21
  export interface IFluidErrorBase extends Error {
20
22
  /**
@@ -73,12 +75,16 @@ const hasTelemetryPropFunctions = (x: unknown): boolean =>
73
75
 
74
76
  /**
75
77
  * Type guard for error data containing the {@link IFluidErrorBase.errorInstanceId} property.
78
+ *
79
+ * @internal
76
80
  */
77
81
  export const hasErrorInstanceId = (x: unknown): x is { errorInstanceId: string } =>
78
82
  typeof (x as Partial<{ errorInstanceId: string }>)?.errorInstanceId === "string";
79
83
 
80
84
  /**
81
85
  * Type guard for {@link IFluidErrorBase}.
86
+ *
87
+ * @internal
82
88
  */
83
89
  export function isFluidError(error: unknown): error is IFluidErrorBase {
84
90
  return (
@@ -91,6 +97,8 @@ export function isFluidError(error: unknown): error is IFluidErrorBase {
91
97
 
92
98
  /**
93
99
  * Type guard for old standard of valid/known errors.
100
+ *
101
+ * @internal
94
102
  */
95
103
  export function isValidLegacyError(
96
104
  error: unknown,
package/src/index.ts CHANGED
@@ -5,11 +5,9 @@
5
5
  export {
6
6
  createChildMonitoringContext,
7
7
  MonitoringContext,
8
- IConfigProviderBase,
9
8
  sessionStorageConfigProvider,
10
9
  mixinMonitoringContext,
11
10
  IConfigProvider,
12
- ConfigTypes,
13
11
  loggerToMonitoringContext,
14
12
  } from "./config";
15
13
  export {
@@ -18,6 +16,7 @@ export {
18
16
  extractSafePropertiesFromMessage,
19
17
  GenericError,
20
18
  UsageError,
19
+ validatePrecondition,
21
20
  } from "./error";
22
21
  export {
23
22
  extractLogSafeErrorProperties,
@@ -56,6 +55,7 @@ export {
56
55
  IPerformanceEventMarkers,
57
56
  ITelemetryLoggerPropertyBag,
58
57
  ITelemetryLoggerPropertyBags,
58
+ MultiSinkLoggerProperties,
59
59
  numberFromString,
60
60
  PerformanceEvent,
61
61
  TaggedLoggerAdapter,
@@ -80,3 +80,22 @@ export {
80
80
  ITelemetryPropertiesExt,
81
81
  TelemetryEventCategory,
82
82
  } from "./telemetryTypes";
83
+
84
+ /**
85
+ * Types supported by {@link IConfigProviderBase}.
86
+ * @deprecated Use ConfigTypes from fluidFramework/core-interfaces
87
+ *
88
+ * @internal
89
+ */
90
+ export type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;
91
+
92
+ /**
93
+ * Base interface for providing configurations to enable/disable/control features.
94
+ *
95
+ * @deprecated Use IConfigProviderBase from fluidFramework/core-interfaces
96
+ *
97
+ * @internal
98
+ */
99
+ export interface IConfigProviderBase {
100
+ getRawConfig(name: string): ConfigTypes;
101
+ }