@fluidframework/telemetry-utils 2.0.0-dev.7.4.0.215747 → 2.0.0-dev.7.4.0.216897

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 (125) hide show
  1. package/api-extractor-lint.json +13 -0
  2. package/api-extractor.json +0 -4
  3. package/api-report/telemetry-utils.api.md +57 -54
  4. package/dist/config.d.ts +44 -3
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +30 -0
  7. package/dist/config.js.map +1 -1
  8. package/dist/error.d.ts +2 -0
  9. package/dist/error.d.ts.map +1 -1
  10. package/dist/error.js +2 -0
  11. package/dist/error.js.map +1 -1
  12. package/dist/errorLogging.d.ts +7 -2
  13. package/dist/errorLogging.d.ts.map +1 -1
  14. package/dist/errorLogging.js +7 -2
  15. package/dist/errorLogging.js.map +1 -1
  16. package/dist/eventEmitterWithErrorHandling.d.ts +8 -0
  17. package/dist/eventEmitterWithErrorHandling.d.ts.map +1 -1
  18. package/dist/eventEmitterWithErrorHandling.js +8 -0
  19. package/dist/eventEmitterWithErrorHandling.js.map +1 -1
  20. package/dist/events.d.ts +15 -0
  21. package/dist/events.d.ts.map +1 -1
  22. package/dist/events.js +16 -0
  23. package/dist/events.js.map +1 -1
  24. package/dist/fluidErrorBase.d.ts +8 -0
  25. package/dist/fluidErrorBase.d.ts.map +1 -1
  26. package/dist/fluidErrorBase.js +6 -0
  27. package/dist/fluidErrorBase.js.map +1 -1
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/logger.d.ts +117 -17
  32. package/dist/logger.d.ts.map +1 -1
  33. package/dist/logger.js +82 -12
  34. package/dist/logger.js.map +1 -1
  35. package/dist/mockLogger.d.ts +2 -0
  36. package/dist/mockLogger.d.ts.map +1 -1
  37. package/dist/mockLogger.js +2 -0
  38. package/dist/mockLogger.js.map +1 -1
  39. package/dist/sampledTelemetryHelper.d.ts +7 -3
  40. package/dist/sampledTelemetryHelper.d.ts.map +1 -1
  41. package/dist/sampledTelemetryHelper.js +7 -3
  42. package/dist/sampledTelemetryHelper.js.map +1 -1
  43. package/dist/telemetry-utils-alpha.d.ts +121 -610
  44. package/dist/telemetry-utils-beta.d.ts +121 -610
  45. package/dist/telemetry-utils-public.d.ts +121 -610
  46. package/dist/telemetry-utils-untrimmed.d.ts +242 -38
  47. package/dist/telemetryTypes.d.ts +32 -8
  48. package/dist/telemetryTypes.d.ts.map +1 -1
  49. package/dist/telemetryTypes.js.map +1 -1
  50. package/dist/thresholdCounter.d.ts +3 -2
  51. package/dist/thresholdCounter.d.ts.map +1 -1
  52. package/dist/thresholdCounter.js +3 -2
  53. package/dist/thresholdCounter.js.map +1 -1
  54. package/dist/utils.d.ts +6 -0
  55. package/dist/utils.d.ts.map +1 -1
  56. package/dist/utils.js +6 -0
  57. package/dist/utils.js.map +1 -1
  58. package/lib/config.d.ts +44 -3
  59. package/lib/config.d.ts.map +1 -1
  60. package/lib/config.js +30 -0
  61. package/lib/config.js.map +1 -1
  62. package/lib/error.d.ts +2 -0
  63. package/lib/error.d.ts.map +1 -1
  64. package/lib/error.js +2 -0
  65. package/lib/error.js.map +1 -1
  66. package/lib/errorLogging.d.ts +7 -2
  67. package/lib/errorLogging.d.ts.map +1 -1
  68. package/lib/errorLogging.js +7 -2
  69. package/lib/errorLogging.js.map +1 -1
  70. package/lib/eventEmitterWithErrorHandling.d.ts +8 -0
  71. package/lib/eventEmitterWithErrorHandling.d.ts.map +1 -1
  72. package/lib/eventEmitterWithErrorHandling.js +8 -0
  73. package/lib/eventEmitterWithErrorHandling.js.map +1 -1
  74. package/lib/events.d.ts +15 -0
  75. package/lib/events.d.ts.map +1 -1
  76. package/lib/events.js +16 -0
  77. package/lib/events.js.map +1 -1
  78. package/lib/fluidErrorBase.d.ts +8 -0
  79. package/lib/fluidErrorBase.d.ts.map +1 -1
  80. package/lib/fluidErrorBase.js +6 -0
  81. package/lib/fluidErrorBase.js.map +1 -1
  82. package/lib/index.d.ts +1 -1
  83. package/lib/index.d.ts.map +1 -1
  84. package/lib/index.js.map +1 -1
  85. package/lib/logger.d.ts +117 -17
  86. package/lib/logger.d.ts.map +1 -1
  87. package/lib/logger.js +82 -12
  88. package/lib/logger.js.map +1 -1
  89. package/lib/mockLogger.d.ts +2 -0
  90. package/lib/mockLogger.d.ts.map +1 -1
  91. package/lib/mockLogger.js +2 -0
  92. package/lib/mockLogger.js.map +1 -1
  93. package/lib/sampledTelemetryHelper.d.ts +7 -3
  94. package/lib/sampledTelemetryHelper.d.ts.map +1 -1
  95. package/lib/sampledTelemetryHelper.js +7 -3
  96. package/lib/sampledTelemetryHelper.js.map +1 -1
  97. package/lib/telemetry-utils-alpha.d.ts +121 -610
  98. package/lib/telemetry-utils-beta.d.ts +121 -610
  99. package/lib/telemetry-utils-public.d.ts +121 -610
  100. package/lib/telemetry-utils-untrimmed.d.ts +242 -38
  101. package/lib/telemetryTypes.d.ts +32 -8
  102. package/lib/telemetryTypes.d.ts.map +1 -1
  103. package/lib/telemetryTypes.js.map +1 -1
  104. package/lib/thresholdCounter.d.ts +3 -2
  105. package/lib/thresholdCounter.d.ts.map +1 -1
  106. package/lib/thresholdCounter.js +3 -2
  107. package/lib/thresholdCounter.js.map +1 -1
  108. package/lib/utils.d.ts +6 -0
  109. package/lib/utils.d.ts.map +1 -1
  110. package/lib/utils.js +6 -0
  111. package/lib/utils.js.map +1 -1
  112. package/package.json +7 -6
  113. package/src/config.ts +44 -3
  114. package/src/error.ts +2 -0
  115. package/src/errorLogging.ts +7 -2
  116. package/src/eventEmitterWithErrorHandling.ts +8 -0
  117. package/src/events.ts +18 -0
  118. package/src/fluidErrorBase.ts +8 -0
  119. package/src/index.ts +1 -0
  120. package/src/logger.ts +125 -17
  121. package/src/mockLogger.ts +2 -0
  122. package/src/sampledTelemetryHelper.ts +7 -3
  123. package/src/telemetryTypes.ts +32 -8
  124. package/src/thresholdCounter.ts +3 -2
  125. package/src/utils.ts +6 -0
@@ -23,16 +23,27 @@ import { TelemetryBaseEventPropertyType } from '@fluidframework/core-interfaces'
23
23
  import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
24
24
  import { TypedEventEmitter } from '@fluid-internal/client-utils';
25
25
 
26
+ /**
27
+ * Types supported by {@link IConfigProviderBase}.
28
+ *
29
+ * @internal
30
+ */
26
31
  export declare type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;
27
32
 
33
+ /**
34
+ * @internal
35
+ */
28
36
  export declare const connectedEventName = "connected";
29
37
 
30
38
  /**
31
- * Create a child logger based on the provided props object
32
- * @param props - logger is the base logger the child will log to after it's processing, namespace will be prefixed to all event names, properties are default properties that will be applied events.
39
+ * Create a child logger based on the provided props object.
33
40
  *
34
41
  * @remarks
35
42
  * Passing in no props object (i.e. undefined) will return a logger that is effectively a no-op.
43
+ *
44
+ * @param props - logger is the base logger the child will log to after it's processing, namespace will be prefixed to all event names, properties are default properties that will be applied events.
45
+ *
46
+ * @internal
36
47
  */
37
48
  export declare function createChildLogger(props?: {
38
49
  logger?: ITelemetryBaseLogger;
@@ -40,19 +51,20 @@ export declare function createChildLogger(props?: {
40
51
  properties?: ITelemetryLoggerPropertyBags;
41
52
  }): ITelemetryLoggerExt;
42
53
 
54
+ /**
55
+ * Creates a child logger with a {@link MonitoringContext}.
56
+ *
57
+ * @see {@link loggerToMonitoringContext}
58
+ * @internal
59
+ */
43
60
  export declare function createChildMonitoringContext(props: Parameters<typeof createChildLogger>[0]): MonitoringContext;
44
61
 
45
62
  /**
46
- * Create a logger which logs to multiple other loggers based on the provided props object
47
- * @param props - loggers are the base loggers that will logged to after it's processing, namespace will be prefixed to all event names, properties are default properties that will be applied events.
48
- * tryInheritProperties will attempted to copy those loggers properties to this loggers if they are of a known type e.g. one from this package
63
+ * Create a logger which logs to multiple other loggers based on the provided props object.
64
+ *
65
+ * @internal
49
66
  */
50
- export declare function createMultiSinkLogger(props: {
51
- namespace?: string;
52
- properties?: ITelemetryLoggerPropertyBags;
53
- loggers?: (ITelemetryBaseLogger | undefined)[];
54
- tryInheritProperties?: true;
55
- }): ITelemetryLoggerExt;
67
+ export declare function createMultiSinkLogger(props: MultiSinkLoggerProperties): ITelemetryLoggerExt;
56
68
 
57
69
  /**
58
70
  * 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}.
@@ -127,12 +139,23 @@ export declare class DataProcessingError extends LoggingError implements IErrorB
127
139
  static wrapIfUnrecognized(originalError: unknown, dataProcessingCodepath: string, messageLike?: Partial<Pick<ISequencedDocumentMessage, "clientId" | "sequenceNumber" | "clientSequenceNumber" | "referenceSequenceNumber" | "minimumSequenceNumber" | "timestamp">>): IFluidErrorBase;
128
140
  }
129
141
 
142
+ /**
143
+ * @internal
144
+ */
130
145
  export declare const disconnectedEventName = "disconnected";
131
146
 
132
147
  /**
133
148
  * Event Emitter helper class
149
+ *
150
+ * @remarks
134
151
  * Any exceptions thrown by listeners will be caught and raised through "error" event.
135
152
  * Any exception thrown by "error" listeners will propagate to the caller.
153
+ *
154
+ * @internal
155
+ *
156
+ * @privateRemarks
157
+ * This probably doesn't belong in this package, as it is not telemetry-specific, and is really only intended for internal fluid-framework use.
158
+ * We should consider moving it to the `core-utils` package.
136
159
  */
137
160
  export declare class EventEmitterWithErrorHandling<TEvent extends IEvent = IEvent> extends TypedEventEmitter<TEvent> {
138
161
  private readonly errorHandler;
@@ -140,6 +163,10 @@ export declare class EventEmitterWithErrorHandling<TEvent extends IEvent = IEven
140
163
  emit(event: EventEmitterEventType, ...args: unknown[]): boolean;
141
164
  }
142
165
 
166
+ /**
167
+ * String used to concatenate the namespace of parent loggers and their child loggers.
168
+ * @internal
169
+ */
143
170
  export declare const eventNamespaceSeparator: ":";
144
171
 
145
172
  /**
@@ -157,6 +184,8 @@ export declare function extractLogSafeErrorProperties(error: unknown, sanitizeSt
157
184
  * Extracts specific properties from the provided message that we know are safe to log.
158
185
  *
159
186
  * @param messageLike - Message to include info about via telemetry props.
187
+ *
188
+ * @internal
160
189
  */
161
190
  export declare const extractSafePropertiesFromMessage: (messageLike: Partial<Pick<ISequencedDocumentMessage, "clientId" | "sequenceNumber" | "clientSequenceNumber" | "referenceSequenceNumber" | "minimumSequenceNumber" | "timestamp">>) => {
162
191
  messageClientId: string | undefined;
@@ -167,6 +196,9 @@ export declare const extractSafePropertiesFromMessage: (messageLike: Partial<Pic
167
196
  messageTimestamp: number | undefined;
168
197
  };
169
198
 
199
+ /**
200
+ * @internal
201
+ */
170
202
  export declare function formatTick(tick: number): number;
171
203
 
172
204
  /**
@@ -220,13 +252,17 @@ export declare const getCircularReplacer: () => (key: string, value: unknown) =>
220
252
 
221
253
  /**
222
254
  * Type guard for error data containing the {@link IFluidErrorBase.errorInstanceId} property.
255
+ *
256
+ * @internal
223
257
  */
224
258
  export declare const hasErrorInstanceId: (x: unknown) => x is {
225
259
  errorInstanceId: string;
226
260
  };
227
261
 
228
262
  /**
229
- * Explicitly typed interface for reading configurations
263
+ * Explicitly typed interface for reading configurations.
264
+ *
265
+ * @internal
230
266
  */
231
267
  export declare interface IConfigProvider extends IConfigProviderBase {
232
268
  getBoolean(name: string): boolean | undefined;
@@ -238,7 +274,9 @@ export declare interface IConfigProvider extends IConfigProviderBase {
238
274
  }
239
275
 
240
276
  /**
241
- * Base interface for providing configurations to enable/disable/control features
277
+ * Base interface for providing configurations to enable/disable/control features.
278
+ *
279
+ * @internal
242
280
  */
243
281
  export declare interface IConfigProviderBase {
244
282
  getRawConfig(name: string): ConfigTypes;
@@ -278,6 +316,8 @@ export declare interface IFluidErrorAnnotations {
278
316
  * It features the members of {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error | Error}
279
317
  * made readonly, as well as {@link IFluidErrorBase.errorType} and {@link IFluidErrorBase.errorInstanceId}.
280
318
  * It also features getters and setters for telemetry props to be included when the error is logged.
319
+ *
320
+ * @internal
281
321
  */
282
322
  export declare interface IFluidErrorBase extends Error {
283
323
  /**
@@ -325,10 +365,15 @@ export declare interface IFluidErrorBase extends Error {
325
365
  }
326
366
 
327
367
  /**
328
- * Describes what events PerformanceEvent should log
329
- * By default, all events are logged, but client can override this behavior
330
- * For example, there is rarely a need to record start event, as we really after
368
+ * Describes what events {@link PerformanceEvent} should log.
369
+ *
370
+ * @remarks
371
+ * By default, all events are logged, but the client can override this behavior.
372
+ *
373
+ * For example, there is rarely a need to record a start event, as we're really after
331
374
  * success / failure tracking, including duration (on success).
375
+ *
376
+ * @internal
332
377
  */
333
378
  export declare interface IPerformanceEventMarkers {
334
379
  start?: true;
@@ -364,21 +409,30 @@ export declare function isExternalError(error: unknown): boolean;
364
409
 
365
410
  /**
366
411
  * Type guard for {@link IFluidErrorBase}.
412
+ *
413
+ * @internal
367
414
  */
368
415
  export declare function isFluidError(error: unknown): error is IFluidErrorBase;
369
416
 
370
417
  /**
371
- * type guard for ILoggingError interface
418
+ * Type-guard for {@link @fluidframework/core-interfaces#ILoggingError}.
419
+ *
420
+ * @internal
372
421
  */
373
422
  export declare const isILoggingError: (x: unknown) => x is ILoggingError;
374
423
 
375
424
  /**
376
- * Type guard to identify if a particular telemetry property appears to be a tagged telemetry property
425
+ * Type guard to identify if a particular telemetry property appears to be a
426
+ * {@link @fluidframework/core-interfaces#Tagged} telemetry property.
427
+ *
428
+ * @internal
377
429
  */
378
430
  export declare function isTaggedTelemetryPropertyValue(x: Tagged<TelemetryEventPropertyTypeExt> | TelemetryEventPropertyTypeExt): x is Tagged<TelemetryEventPropertyTypeExt>;
379
431
 
380
432
  /**
381
433
  * Type guard for old standard of valid/known errors.
434
+ *
435
+ * @internal
382
436
  */
383
437
  export declare function isValidLegacyError(error: unknown): error is Omit<IFluidErrorBase, "errorInstanceId">;
384
438
 
@@ -387,7 +441,8 @@ export declare function isValidLegacyError(error: unknown): error is Omit<IFluid
387
441
  * to mark pieces of information that should be organized or handled differently by loggers in various first or third
388
442
  * party scenarios. For example, tags are used to mark personal information that should not be stored in logs.
389
443
  *
390
- * @deprecated Use Tagged<TelemetryEventPropertyTypeExt>
444
+ * @deprecated Use {@link @fluidframework/core-interfaces#Tagged}\<{@link TelemetryEventPropertyTypeExt}\>
445
+ * @internal
391
446
  */
392
447
  export declare interface ITaggedTelemetryPropertyTypeExt {
393
448
  value: TelemetryEventPropertyTypeExt;
@@ -396,7 +451,9 @@ export declare interface ITaggedTelemetryPropertyTypeExt {
396
451
 
397
452
  /**
398
453
  * Error telemetry event.
399
- * Maps to category = "error"
454
+ * @remarks Maps to category = "error"
455
+ *
456
+ * @internal
400
457
  */
401
458
  export declare interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
402
459
  eventName: string;
@@ -404,9 +461,11 @@ export declare interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt
404
461
 
405
462
  /**
406
463
  * Interface for logging telemetry statements.
407
- * Can contain any number of properties that get serialized as json payload.
464
+ * @remarks May contain any number of properties that get serialized as json payload.
408
465
  * @param category - category of the event, like "error", "performance", "generic", etc.
409
466
  * @param eventName - name of the event.
467
+ *
468
+ * @internal
410
469
  */
411
470
  export declare interface ITelemetryEventExt extends ITelemetryPropertiesExt {
412
471
  category: string;
@@ -415,7 +474,9 @@ export declare interface ITelemetryEventExt extends ITelemetryPropertiesExt {
415
474
 
416
475
  /**
417
476
  * Informational (non-error) telemetry event
418
- * Maps to category = "generic"
477
+ * @remarks Maps to category = "generic"
478
+ *
479
+ * @internal
419
480
  */
420
481
  export declare interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
421
482
  eventName: string;
@@ -423,9 +484,13 @@ export declare interface ITelemetryGenericEventExt extends ITelemetryPropertiesE
423
484
  }
424
485
 
425
486
  /**
426
- * An extended TelemetryLogger interface which allows for more lenient event types.
487
+ * An extended {@link @fluidframework/core-interfaces#ITelemetryBaseLogger} which allows for more lenient event types.
488
+ *
489
+ * @remarks
427
490
  * This interface is meant to be used internally within the Fluid Framework,
428
- * and ITelemetryBaseLogger should be used when loggers are passed between layers.
491
+ * and `ITelemetryBaseLogger` should be used when loggers are passed between layers.
492
+ *
493
+ * @internal
429
494
  */
430
495
  export declare interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
431
496
  /**
@@ -450,10 +515,16 @@ export declare interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
450
515
  sendPerformanceEvent(event: ITelemetryPerformanceEventExt, error?: unknown, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
451
516
  }
452
517
 
518
+ /**
519
+ * @internal
520
+ */
453
521
  export declare interface ITelemetryLoggerPropertyBag {
454
522
  [index: string]: TelemetryEventPropertyTypes | (() => TelemetryEventPropertyTypes);
455
523
  }
456
524
 
525
+ /**
526
+ * @internal
527
+ */
457
528
  export declare interface ITelemetryLoggerPropertyBags {
458
529
  all?: ITelemetryLoggerPropertyBag;
459
530
  error?: ITelemetryLoggerPropertyBag;
@@ -461,7 +532,9 @@ export declare interface ITelemetryLoggerPropertyBags {
461
532
 
462
533
  /**
463
534
  * Performance telemetry event.
464
- * Maps to category = "performance"
535
+ * @remarks Maps to category = "performance"
536
+ *
537
+ * @internal
465
538
  */
466
539
  export declare interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {
467
540
  duration?: number;
@@ -469,11 +542,18 @@ export declare interface ITelemetryPerformanceEventExt extends ITelemetryGeneric
469
542
 
470
543
  /**
471
544
  * JSON-serializable properties, which will be logged with telemetry.
545
+ *
546
+ * @internal
472
547
  */
473
548
  export declare interface ITelemetryPropertiesExt {
474
549
  [index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;
475
550
  }
476
551
 
552
+ /**
553
+ * Creates a {@link MonitoringContext} from the provided logger, if it isn't already one.
554
+ *
555
+ * @internal
556
+ */
477
557
  export declare function loggerToMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(logger: L): MonitoringContext<L>;
478
558
 
479
559
  /**
@@ -523,14 +603,33 @@ export declare class LoggingError extends Error implements ILoggingError, Omit<I
523
603
  * @param logger - The logger to log with
524
604
  * @param event - The string or event to log
525
605
  * @returns The outcome of the condition
606
+ *
607
+ * @internal
608
+ *
609
+ * @deprecated
610
+ * This API will be removed in a future release.
611
+ * No replacement API is intended, but reproducing its behavior should be trivial for anyone who needs it.
526
612
  */
527
613
  export declare function logIfFalse(condition: unknown, logger: ITelemetryBaseLogger, event: string | ITelemetryGenericEvent): condition is true;
528
614
 
615
+ /**
616
+ * Creates a {@link MonitoringContext} from the provided logger.
617
+ *
618
+ * @remarks
619
+ * Assumes that the provided logger is not itself already a {@link MonitoringContext}, and will throw an error if it is.
620
+ * If you are unsure, use {@link loggerToMonitoringContext} instead.
621
+ *
622
+ * @throws If the provided logger is already a {@link MonitoringContext}.
623
+ *
624
+ * @internal
625
+ */
529
626
  export declare function mixinMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(logger: L, ...configs: (IConfigProviderBase | undefined)[]): MonitoringContext<L>;
530
627
 
531
628
  /**
532
629
  * The MockLogger records events sent to it, and then can walk back over those events
533
630
  * searching for a set of expected events to match against the logged events.
631
+ *
632
+ * @internal
534
633
  */
535
634
  export declare class MockLogger implements ITelemetryBaseLogger {
536
635
  readonly minLogLevel?: LogLevel | undefined;
@@ -591,13 +690,39 @@ export declare class MockLogger implements ITelemetryBaseLogger {
591
690
  }
592
691
 
593
692
  /**
594
- * A type containing both a telemetry logger and a configuration provider
693
+ * A type containing both a telemetry logger and a configuration provider.
694
+ *
695
+ * @internal
595
696
  */
596
697
  export declare interface MonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt> {
597
698
  config: IConfigProvider;
598
699
  logger: L;
599
700
  }
600
701
 
702
+ /**
703
+ * Input properties for {@link createMultiSinkLogger}.
704
+ *
705
+ * @internal
706
+ */
707
+ export declare interface MultiSinkLoggerProperties {
708
+ /**
709
+ * Will be prefixed to all event names.
710
+ */
711
+ namespace?: string;
712
+ /**
713
+ * Default properties that will be applied to all events flowing through this logger.
714
+ */
715
+ properties?: ITelemetryLoggerPropertyBags;
716
+ /**
717
+ * The base loggers that this logger will forward the logs to, after it processes them.
718
+ */
719
+ loggers?: (ITelemetryBaseLogger | undefined)[];
720
+ /**
721
+ * If true, the logger will attempt to copy the custom properties (if they are of a known type, i.e. one from this package) of all the base loggers passed to it, to apply them itself to logs that flow through.
722
+ */
723
+ tryInheritProperties?: true;
724
+ }
725
+
601
726
  /**
602
727
  * The Error class used when normalizing an external error
603
728
  *
@@ -617,9 +742,13 @@ export declare function normalizeError(error: unknown, annotations?: IFluidError
617
742
 
618
743
  /**
619
744
  * Attempts to parse number from string.
620
- * If fails,returns original string.
745
+ * If it fails, it will return the original string.
746
+ *
747
+ * @remarks
621
748
  * Used to make telemetry data typed (and support math operations, like comparison),
622
- * in places where we do expect numbers (like contentsize/duration property in http header)
749
+ * in places where we do expect numbers (like contentsize/duration property in http header).
750
+ *
751
+ * @internal
623
752
  */
624
753
  export declare function numberFromString(str: string | null | undefined): string | number | undefined;
625
754
 
@@ -634,7 +763,9 @@ export declare function numberFromString(str: string | null | undefined): string
634
763
  export declare function overwriteStack(error: IFluidErrorBase | LoggingError, stack: string): void;
635
764
 
636
765
  /**
637
- * Helper class to log performance events
766
+ * Helper class to log performance events.
767
+ *
768
+ * @internal
638
769
  */
639
770
  export declare class PerformanceEvent {
640
771
  private readonly logger;
@@ -711,17 +842,26 @@ export declare class PerformanceEvent {
711
842
  * @param connected - A boolean tracking whether the connection was in a connected state or not
712
843
  * @param clientId - The connected/disconnected clientId
713
844
  * @param disconnectedReason - The reason for the connection to be disconnected (Used for telemetry purposes only)
845
+ *
846
+ * @internal
714
847
  */
715
848
  export declare function raiseConnectedEvent(logger: ITelemetryLoggerExt, emitter: EventEmitter, connected: boolean, clientId?: string, disconnectedReason?: string): void;
716
849
 
850
+ /**
851
+ * @internal
852
+ */
717
853
  export declare function safeRaiseEvent(emitter: EventEmitter, logger: ITelemetryLoggerExt, event: string, ...args: unknown[]): void;
718
854
 
719
855
  /**
720
856
  * Helper class that executes a specified code block and writes an
721
857
  * {@link @fluidframework/core-interfaces#ITelemetryPerformanceEvent} to a specified logger every time a specified
722
- * number of executions is reached (or when the class is disposed). The `duration` field in the telemetry event is
723
- * the duration of the latest execution (sample) of the specified function. See the documentation of the
724
- * `includeAggregateMetrics` parameter for additional details that can be included.
858
+ * number of executions is reached (or when the class is disposed).
859
+ *
860
+ * The `duration` field in the telemetry event is the duration of the latest execution (sample) of the specified
861
+ * function. See the documentation of the `includeAggregateMetrics` parameter for additional details that can be
862
+ * included.
863
+ *
864
+ * @internal
725
865
  */
726
866
  export declare class SampledTelemetryHelper implements IDisposable {
727
867
  private readonly eventBase;
@@ -769,12 +909,33 @@ export declare class SampledTelemetryHelper implements IDisposable {
769
909
  * Creates a base configuration provider based on `sessionStorage`
770
910
  *
771
911
  * @returns A lazy initialized base configuration provider with `sessionStorage` as the underlying config store
912
+ *
913
+ * @internal
772
914
  */
773
915
  export declare const sessionStorageConfigProvider: Lazy<IConfigProviderBase>;
774
916
 
775
917
  /**
776
- * Helper function to tag telemetry properties as CodeArtifacts. It supports properties of type
777
- * TelemetryBaseEventPropertyType as well as getters that return TelemetryBaseEventPropertyType.
918
+ * Tags all provided `values` as {@link TelemetryDataTag.CodeArtifact}.
919
+ *
920
+ * @param values - The values to be tagged.
921
+ *
922
+ * @remarks
923
+ * It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
924
+ * as well as callbacks that return that type.
925
+ *
926
+ * @example Sample usage
927
+ * ```typescript
928
+ * {
929
+ * // ...Other properties being added to a telemetry event
930
+ * ...tagCodeArtifacts("someTag", {foo: 1, bar: 2}),
931
+ * // ...
932
+ * }
933
+ * ```
934
+ * This will result in `foo` and `bar` added to the event with their values tagged as {@link TelemetryDataTag.CodeArtifact}.
935
+ *
936
+ * @see {@link tagData}
937
+ *
938
+ * @internal
778
939
  */
779
940
  export declare const tagCodeArtifacts: <T extends Record<string, TelemetryEventPropertyType | (() => TelemetryBaseEventPropertyType)>>(values: T) => { [P in keyof T]: (T[P] extends () => TelemetryBaseEventPropertyType ? () => {
780
941
  value: ReturnType<T[P]>;
@@ -784,6 +945,28 @@ export declare const tagCodeArtifacts: <T extends Record<string, TelemetryEventP
784
945
  tag: TelemetryDataTag.CodeArtifact;
785
946
  }) | (T[P] extends undefined ? undefined : never); };
786
947
 
948
+ /**
949
+ * Tags all given `values` with the same `tag`.
950
+ *
951
+ * @param tag - The tag with which all `values` will be annotated.
952
+ * @param values - The values to be tagged.
953
+ *
954
+ * @remarks
955
+ * It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
956
+ * as well as callbacks that return that type.
957
+ *
958
+ * @example Sample usage
959
+ * ```typescript
960
+ * {
961
+ * // ...Other properties being added to a telemetry event
962
+ * ...tagData("someTag", {foo: 1, bar: 2}),
963
+ * // ...
964
+ * }
965
+ * ```
966
+ * This will result in `foo` and `bar` added to the event with their values tagged.
967
+ *
968
+ * @internal
969
+ */
787
970
  export declare const tagData: <T extends TelemetryDataTag, V extends Record<string, TelemetryEventPropertyType | (() => TelemetryBaseEventPropertyType)>>(tag: T, values: V) => { [P in keyof V]: (V[P] extends () => TelemetryBaseEventPropertyType ? () => {
788
971
  value: ReturnType<V[P]>;
789
972
  tag: T;
@@ -796,6 +979,8 @@ export declare const tagData: <T extends TelemetryDataTag, V extends Record<stri
796
979
  * @deprecated 0.56, remove TaggedLoggerAdapter once its usage is removed from
797
980
  * container-runtime. Issue: #8191
798
981
  * TaggedLoggerAdapter class can add tag handling to your logger.
982
+ *
983
+ * @internal
799
984
  */
800
985
  export declare class TaggedLoggerAdapter implements ITelemetryBaseLogger {
801
986
  private readonly logger;
@@ -808,7 +993,10 @@ export declare class TaggedLoggerAdapter implements ITelemetryBaseLogger {
808
993
 
809
994
  /**
810
995
  * Broad classifications to be applied to individual properties as they're prepared to be logged to telemetry.
811
- * Please do not modify existing entries for backwards compatibility.
996
+ *
997
+ * @privateRemarks Please do not modify existing entries, to maintain backwards compatibility.
998
+ *
999
+ * @internal
812
1000
  */
813
1001
  export declare enum TelemetryDataTag {
814
1002
  /**
@@ -825,28 +1013,43 @@ export declare enum TelemetryDataTag {
825
1013
  * The categories FF uses when instrumenting the code.
826
1014
  *
827
1015
  * generic - Informational log event
1016
+ *
828
1017
  * error - Error log event, ideally 0 of these are logged during a session
1018
+ *
829
1019
  * performance - Includes duration, and often has _start, _end, or _cancel suffixes for activity tracking
1020
+ *
1021
+ * @internal
830
1022
  */
831
1023
  export declare type TelemetryEventCategory = "generic" | "error" | "performance";
832
1024
 
833
1025
  /**
834
1026
  * Property types that can be logged.
835
- * Includes extra types beyond TelemetryBaseEventPropertyType, which must be converted before sending to a base logger
1027
+ *
1028
+ * @remarks
1029
+ * Includes extra types beyond {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType}, which must be
1030
+ * converted before sending to a base logger.
1031
+ *
1032
+ * @internal
836
1033
  */
837
1034
  export declare type TelemetryEventPropertyTypeExt = string | number | boolean | undefined | (string | number | boolean)[] | {
838
1035
  [key: string]: // Flat objects can have the same properties as the event itself
839
1036
  string | number | boolean | undefined | (string | number | boolean)[];
840
1037
  };
841
1038
 
1039
+ /**
1040
+ * @internal
1041
+ */
842
1042
  export declare type TelemetryEventPropertyTypes = ITelemetryBaseProperties[string];
843
1043
 
844
1044
  /**
845
1045
  * Null logger that no-ops for all telemetry events passed to it.
1046
+ *
846
1047
  * @deprecated This will be removed in a future release.
847
1048
  * For internal use within the FluidFramework codebase, use {@link createChildLogger} with no arguments instead.
848
1049
  * For external consumers we recommend writing a trivial implementation of {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}
849
1050
  * where the send() method does nothing and using that.
1051
+ *
1052
+ * @internal
850
1053
  */
851
1054
  export declare class TelemetryNullLogger implements ITelemetryLoggerExt {
852
1055
  send(event: ITelemetryBaseEvent): void;
@@ -856,8 +1059,9 @@ export declare class TelemetryNullLogger implements ITelemetryLoggerExt {
856
1059
  }
857
1060
 
858
1061
  /**
859
- * Utility counter which will send event only if the provided value
860
- * is above a configured threshold
1062
+ * Utility counter which will send event only if the provided value is above a configured threshold.
1063
+ *
1064
+ * @internal
861
1065
  */
862
1066
  export declare class ThresholdCounter {
863
1067
  private readonly threshold;
@@ -7,13 +7,22 @@ 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
+ *
15
+ * @internal
12
16
  */
13
17
  export type TelemetryEventCategory = "generic" | "error" | "performance";
14
18
  /**
15
19
  * Property types that can be logged.
16
- * Includes extra types beyond TelemetryBaseEventPropertyType, which must be converted before sending to a base logger
20
+ *
21
+ * @remarks
22
+ * Includes extra types beyond {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType}, which must be
23
+ * converted before sending to a base logger.
24
+ *
25
+ * @internal
17
26
  */
18
27
  export type TelemetryEventPropertyTypeExt = string | number | boolean | undefined | (string | number | boolean)[] | {
19
28
  [key: string]: // Flat objects can have the same properties as the event itself
@@ -24,7 +33,8 @@ export type TelemetryEventPropertyTypeExt = string | number | boolean | undefine
24
33
  * to mark pieces of information that should be organized or handled differently by loggers in various first or third
25
34
  * party scenarios. For example, tags are used to mark personal information that should not be stored in logs.
26
35
  *
27
- * @deprecated Use Tagged<TelemetryEventPropertyTypeExt>
36
+ * @deprecated Use {@link @fluidframework/core-interfaces#Tagged}\<{@link TelemetryEventPropertyTypeExt}\>
37
+ * @internal
28
38
  */
29
39
  export interface ITaggedTelemetryPropertyTypeExt {
30
40
  value: TelemetryEventPropertyTypeExt;
@@ -32,15 +42,19 @@ export interface ITaggedTelemetryPropertyTypeExt {
32
42
  }
33
43
  /**
34
44
  * JSON-serializable properties, which will be logged with telemetry.
45
+ *
46
+ * @internal
35
47
  */
36
48
  export interface ITelemetryPropertiesExt {
37
49
  [index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;
38
50
  }
39
51
  /**
40
52
  * Interface for logging telemetry statements.
41
- * Can contain any number of properties that get serialized as json payload.
53
+ * @remarks May contain any number of properties that get serialized as json payload.
42
54
  * @param category - category of the event, like "error", "performance", "generic", etc.
43
55
  * @param eventName - name of the event.
56
+ *
57
+ * @internal
44
58
  */
45
59
  export interface ITelemetryEventExt extends ITelemetryPropertiesExt {
46
60
  category: string;
@@ -48,7 +62,9 @@ export interface ITelemetryEventExt extends ITelemetryPropertiesExt {
48
62
  }
49
63
  /**
50
64
  * Informational (non-error) telemetry event
51
- * Maps to category = "generic"
65
+ * @remarks Maps to category = "generic"
66
+ *
67
+ * @internal
52
68
  */
53
69
  export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
54
70
  eventName: string;
@@ -56,22 +72,30 @@ export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
56
72
  }
57
73
  /**
58
74
  * Error telemetry event.
59
- * Maps to category = "error"
75
+ * @remarks Maps to category = "error"
76
+ *
77
+ * @internal
60
78
  */
61
79
  export interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
62
80
  eventName: string;
63
81
  }
64
82
  /**
65
83
  * Performance telemetry event.
66
- * Maps to category = "performance"
84
+ * @remarks Maps to category = "performance"
85
+ *
86
+ * @internal
67
87
  */
68
88
  export interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {
69
89
  duration?: number;
70
90
  }
71
91
  /**
72
- * An extended TelemetryLogger interface which allows for more lenient event types.
92
+ * An extended {@link @fluidframework/core-interfaces#ITelemetryBaseLogger} which allows for more lenient event types.
93
+ *
94
+ * @remarks
73
95
  * This interface is meant to be used internally within the Fluid Framework,
74
- * and ITelemetryBaseLogger should be used when loggers are passed between layers.
96
+ * and `ITelemetryBaseLogger` should be used when loggers are passed between layers.
97
+ *
98
+ * @internal
75
99
  */
76
100
  export interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
77
101
  /**
@@ -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,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