@fluidframework/telemetry-utils 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.1
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.
- package/CHANGELOG.md +15 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +3 -3
- package/api-report/telemetry-utils.api.md +64 -57
- package/dist/config.d.ts +37 -10
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +30 -0
- package/dist/config.js.map +1 -1
- package/dist/error.d.ts +12 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +18 -1
- package/dist/error.js.map +1 -1
- package/dist/errorLogging.d.ts +7 -2
- package/dist/errorLogging.d.ts.map +1 -1
- package/dist/errorLogging.js +7 -2
- package/dist/errorLogging.js.map +1 -1
- package/dist/eventEmitterWithErrorHandling.d.ts +6 -0
- package/dist/eventEmitterWithErrorHandling.d.ts.map +1 -1
- package/dist/eventEmitterWithErrorHandling.js +6 -0
- package/dist/eventEmitterWithErrorHandling.js.map +1 -1
- package/dist/events.d.ts +15 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +16 -0
- package/dist/events.js.map +1 -1
- package/dist/fluidErrorBase.d.ts +8 -0
- package/dist/fluidErrorBase.d.ts.map +1 -1
- package/dist/fluidErrorBase.js +6 -0
- package/dist/fluidErrorBase.js.map +1 -1
- package/dist/index.d.ts +20 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +117 -17
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +82 -12
- package/dist/logger.js.map +1 -1
- package/dist/mockLogger.d.ts +2 -0
- package/dist/mockLogger.d.ts.map +1 -1
- package/dist/mockLogger.js +2 -0
- package/dist/mockLogger.js.map +1 -1
- package/dist/sampledTelemetryHelper.d.ts +7 -3
- package/dist/sampledTelemetryHelper.d.ts.map +1 -1
- package/dist/sampledTelemetryHelper.js +7 -3
- package/dist/sampledTelemetryHelper.js.map +1 -1
- package/dist/telemetry-utils-alpha.d.ts +270 -0
- package/dist/telemetry-utils-beta.d.ts +205 -0
- package/dist/telemetry-utils-public.d.ts +205 -0
- package/dist/telemetry-utils-untrimmed.d.ts +1123 -0
- package/dist/telemetryTypes.d.ts +27 -8
- package/dist/telemetryTypes.d.ts.map +1 -1
- package/dist/telemetryTypes.js.map +1 -1
- package/dist/thresholdCounter.d.ts +3 -2
- package/dist/thresholdCounter.d.ts.map +1 -1
- package/dist/thresholdCounter.js +3 -2
- package/dist/thresholdCounter.js.map +1 -1
- package/dist/utils.d.ts +6 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +6 -0
- package/dist/utils.js.map +1 -1
- package/lib/config.d.ts +37 -10
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +30 -0
- package/lib/config.js.map +1 -1
- package/lib/error.d.ts +12 -0
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +16 -0
- package/lib/error.js.map +1 -1
- package/lib/errorLogging.d.ts +7 -2
- package/lib/errorLogging.d.ts.map +1 -1
- package/lib/errorLogging.js +7 -2
- package/lib/errorLogging.js.map +1 -1
- package/lib/eventEmitterWithErrorHandling.d.ts +6 -0
- package/lib/eventEmitterWithErrorHandling.d.ts.map +1 -1
- package/lib/eventEmitterWithErrorHandling.js +6 -0
- package/lib/eventEmitterWithErrorHandling.js.map +1 -1
- package/lib/events.d.ts +15 -0
- package/lib/events.d.ts.map +1 -1
- package/lib/events.js +16 -0
- package/lib/events.js.map +1 -1
- package/lib/fluidErrorBase.d.ts +8 -0
- package/lib/fluidErrorBase.d.ts.map +1 -1
- package/lib/fluidErrorBase.js +6 -0
- package/lib/fluidErrorBase.js.map +1 -1
- package/lib/index.d.ts +20 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +117 -17
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +82 -12
- package/lib/logger.js.map +1 -1
- package/lib/mockLogger.d.ts +2 -0
- package/lib/mockLogger.d.ts.map +1 -1
- package/lib/mockLogger.js +2 -0
- package/lib/mockLogger.js.map +1 -1
- package/lib/sampledTelemetryHelper.d.ts +7 -3
- package/lib/sampledTelemetryHelper.d.ts.map +1 -1
- package/lib/sampledTelemetryHelper.js +7 -3
- package/lib/sampledTelemetryHelper.js.map +1 -1
- package/lib/telemetry-utils-alpha.d.ts +270 -0
- package/lib/telemetry-utils-beta.d.ts +205 -0
- package/lib/telemetry-utils-public.d.ts +205 -0
- package/lib/telemetry-utils-untrimmed.d.ts +1123 -0
- package/lib/telemetryTypes.d.ts +27 -8
- package/lib/telemetryTypes.d.ts.map +1 -1
- package/lib/telemetryTypes.js.map +1 -1
- package/lib/thresholdCounter.d.ts +3 -2
- package/lib/thresholdCounter.d.ts.map +1 -1
- package/lib/thresholdCounter.js +3 -2
- package/lib/thresholdCounter.js.map +1 -1
- package/lib/utils.d.ts +6 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +6 -0
- package/lib/utils.js.map +1 -1
- package/package.json +29 -10
- package/src/config.ts +41 -12
- package/src/error.ts +21 -0
- package/src/errorLogging.ts +7 -2
- package/src/eventEmitterWithErrorHandling.ts +6 -0
- package/src/events.ts +18 -0
- package/src/fluidErrorBase.ts +8 -0
- package/src/index.ts +21 -2
- package/src/logger.ts +125 -17
- package/src/mockLogger.ts +2 -0
- package/src/sampledTelemetryHelper.ts +7 -3
- package/src/telemetryTypes.ts +27 -8
- package/src/thresholdCounter.ts +3 -2
- package/src/utils.ts +6 -0
package/src/logger.ts
CHANGED
|
@@ -40,9 +40,13 @@ export interface Memory {
|
|
|
40
40
|
export interface PerformanceWithMemory extends IsomorphicPerformance {
|
|
41
41
|
readonly memory: Memory;
|
|
42
42
|
}
|
|
43
|
+
|
|
43
44
|
/**
|
|
44
45
|
* Broad classifications to be applied to individual properties as they're prepared to be logged to telemetry.
|
|
45
|
-
*
|
|
46
|
+
*
|
|
47
|
+
* @privateRemarks Please do not modify existing entries, to maintain backwards compatibility.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
46
50
|
*/
|
|
47
51
|
export enum TelemetryDataTag {
|
|
48
52
|
/**
|
|
@@ -55,11 +59,21 @@ export enum TelemetryDataTag {
|
|
|
55
59
|
UserData = "UserData",
|
|
56
60
|
}
|
|
57
61
|
|
|
62
|
+
/**
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
58
65
|
export type TelemetryEventPropertyTypes = ITelemetryBaseProperties[string];
|
|
59
66
|
|
|
67
|
+
/**
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
60
70
|
export interface ITelemetryLoggerPropertyBag {
|
|
61
71
|
[index: string]: TelemetryEventPropertyTypes | (() => TelemetryEventPropertyTypes);
|
|
62
72
|
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
63
77
|
export interface ITelemetryLoggerPropertyBags {
|
|
64
78
|
all?: ITelemetryLoggerPropertyBag;
|
|
65
79
|
error?: ITelemetryLoggerPropertyBag;
|
|
@@ -67,9 +81,13 @@ export interface ITelemetryLoggerPropertyBags {
|
|
|
67
81
|
|
|
68
82
|
/**
|
|
69
83
|
* Attempts to parse number from string.
|
|
70
|
-
* If fails,
|
|
84
|
+
* If it fails, it will return the original string.
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
71
87
|
* Used to make telemetry data typed (and support math operations, like comparison),
|
|
72
|
-
* in places where we do expect numbers (like contentsize/duration property in http header)
|
|
88
|
+
* in places where we do expect numbers (like contentsize/duration property in http header).
|
|
89
|
+
*
|
|
90
|
+
* @internal
|
|
73
91
|
*/
|
|
74
92
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
75
93
|
export function numberFromString(str: string | null | undefined): string | number | undefined {
|
|
@@ -80,10 +98,19 @@ export function numberFromString(str: string | null | undefined): string | numbe
|
|
|
80
98
|
return Number.isNaN(num) ? str : num;
|
|
81
99
|
}
|
|
82
100
|
|
|
101
|
+
// TODO: add docs
|
|
102
|
+
// eslint-disable-next-line jsdoc/require-description
|
|
103
|
+
/**
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
83
106
|
export function formatTick(tick: number): number {
|
|
84
107
|
return Math.floor(tick);
|
|
85
108
|
}
|
|
86
109
|
|
|
110
|
+
/**
|
|
111
|
+
* String used to concatenate the namespace of parent loggers and their child loggers.
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
87
114
|
export const eventNamespaceSeparator = ":" as const;
|
|
88
115
|
|
|
89
116
|
/**
|
|
@@ -92,6 +119,9 @@ export const eventNamespaceSeparator = ":" as const;
|
|
|
92
119
|
* Creates sub-logger that appends properties to all events
|
|
93
120
|
*/
|
|
94
121
|
export abstract class TelemetryLogger implements ITelemetryLoggerExt {
|
|
122
|
+
/**
|
|
123
|
+
* {@inheritDoc eventNamespaceSeparator}
|
|
124
|
+
*/
|
|
95
125
|
public static readonly eventNamespaceSeparator = eventNamespaceSeparator;
|
|
96
126
|
|
|
97
127
|
public static sanitizePkgName(name: string): string {
|
|
@@ -286,6 +316,8 @@ export abstract class TelemetryLogger implements ITelemetryLoggerExt {
|
|
|
286
316
|
* @deprecated 0.56, remove TaggedLoggerAdapter once its usage is removed from
|
|
287
317
|
* container-runtime. Issue: #8191
|
|
288
318
|
* TaggedLoggerAdapter class can add tag handling to your logger.
|
|
319
|
+
*
|
|
320
|
+
* @internal
|
|
289
321
|
*/
|
|
290
322
|
export class TaggedLoggerAdapter implements ITelemetryBaseLogger {
|
|
291
323
|
public constructor(private readonly logger: ITelemetryBaseLogger) {}
|
|
@@ -336,11 +368,14 @@ export class TaggedLoggerAdapter implements ITelemetryBaseLogger {
|
|
|
336
368
|
}
|
|
337
369
|
|
|
338
370
|
/**
|
|
339
|
-
* Create a child logger based on the provided props object
|
|
340
|
-
* @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.
|
|
371
|
+
* Create a child logger based on the provided props object.
|
|
341
372
|
*
|
|
342
373
|
* @remarks
|
|
343
374
|
* Passing in no props object (i.e. undefined) will return a logger that is effectively a no-op.
|
|
375
|
+
*
|
|
376
|
+
* @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.
|
|
377
|
+
*
|
|
378
|
+
* @internal
|
|
344
379
|
*/
|
|
345
380
|
export function createChildLogger(props?: {
|
|
346
381
|
logger?: ITelemetryBaseLogger;
|
|
@@ -353,7 +388,7 @@ export function createChildLogger(props?: {
|
|
|
353
388
|
/**
|
|
354
389
|
* ChildLogger class contains various helper telemetry methods,
|
|
355
390
|
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
356
|
-
* Creates sub-logger that appends properties to all events
|
|
391
|
+
* Creates sub-logger that appends properties to all events.
|
|
357
392
|
*/
|
|
358
393
|
export class ChildLogger extends TelemetryLogger {
|
|
359
394
|
/**
|
|
@@ -449,16 +484,38 @@ export class ChildLogger extends TelemetryLogger {
|
|
|
449
484
|
}
|
|
450
485
|
|
|
451
486
|
/**
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
487
|
+
* Input properties for {@link createMultiSinkLogger}.
|
|
488
|
+
*
|
|
489
|
+
* @internal
|
|
455
490
|
*/
|
|
456
|
-
export
|
|
491
|
+
export interface MultiSinkLoggerProperties {
|
|
492
|
+
/**
|
|
493
|
+
* Will be prefixed to all event names.
|
|
494
|
+
*/
|
|
457
495
|
namespace?: string;
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Default properties that will be applied to all events flowing through this logger.
|
|
499
|
+
*/
|
|
458
500
|
properties?: ITelemetryLoggerPropertyBags;
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* The base loggers that this logger will forward the logs to, after it processes them.
|
|
504
|
+
*/
|
|
459
505
|
loggers?: (ITelemetryBaseLogger | undefined)[];
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* 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.
|
|
509
|
+
*/
|
|
460
510
|
tryInheritProperties?: true;
|
|
461
|
-
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Create a logger which logs to multiple other loggers based on the provided props object.
|
|
515
|
+
*
|
|
516
|
+
* @internal
|
|
517
|
+
*/
|
|
518
|
+
export function createMultiSinkLogger(props: MultiSinkLoggerProperties): ITelemetryLoggerExt {
|
|
462
519
|
return new MultiSinkLogger(
|
|
463
520
|
props.namespace,
|
|
464
521
|
props.properties,
|
|
@@ -551,10 +608,15 @@ export class MultiSinkLogger extends TelemetryLogger {
|
|
|
551
608
|
}
|
|
552
609
|
|
|
553
610
|
/**
|
|
554
|
-
* Describes what events PerformanceEvent should log
|
|
555
|
-
*
|
|
556
|
-
*
|
|
611
|
+
* Describes what events {@link PerformanceEvent} should log.
|
|
612
|
+
*
|
|
613
|
+
* @remarks
|
|
614
|
+
* By default, all events are logged, but the client can override this behavior.
|
|
615
|
+
*
|
|
616
|
+
* For example, there is rarely a need to record a start event, as we're really after
|
|
557
617
|
* success / failure tracking, including duration (on success).
|
|
618
|
+
*
|
|
619
|
+
* @internal
|
|
558
620
|
*/
|
|
559
621
|
export interface IPerformanceEventMarkers {
|
|
560
622
|
start?: true;
|
|
@@ -563,7 +625,9 @@ export interface IPerformanceEventMarkers {
|
|
|
563
625
|
}
|
|
564
626
|
|
|
565
627
|
/**
|
|
566
|
-
* Helper class to log performance events
|
|
628
|
+
* Helper class to log performance events.
|
|
629
|
+
*
|
|
630
|
+
* @internal
|
|
567
631
|
*/
|
|
568
632
|
export class PerformanceEvent {
|
|
569
633
|
/**
|
|
@@ -780,10 +844,13 @@ export class PerformanceEvent {
|
|
|
780
844
|
|
|
781
845
|
/**
|
|
782
846
|
* Null logger that no-ops for all telemetry events passed to it.
|
|
847
|
+
*
|
|
783
848
|
* @deprecated This will be removed in a future release.
|
|
784
849
|
* For internal use within the FluidFramework codebase, use {@link createChildLogger} with no arguments instead.
|
|
785
850
|
* For external consumers we recommend writing a trivial implementation of {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}
|
|
786
851
|
* where the send() method does nothing and using that.
|
|
852
|
+
*
|
|
853
|
+
* @internal
|
|
787
854
|
*/
|
|
788
855
|
export class TelemetryNullLogger implements ITelemetryLoggerExt {
|
|
789
856
|
public send(event: ITelemetryBaseEvent): void {}
|
|
@@ -853,6 +920,28 @@ function convertToBasePropertyTypeUntagged(
|
|
|
853
920
|
}
|
|
854
921
|
}
|
|
855
922
|
|
|
923
|
+
/**
|
|
924
|
+
* Tags all given `values` with the same `tag`.
|
|
925
|
+
*
|
|
926
|
+
* @param tag - The tag with which all `values` will be annotated.
|
|
927
|
+
* @param values - The values to be tagged.
|
|
928
|
+
*
|
|
929
|
+
* @remarks
|
|
930
|
+
* It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
|
|
931
|
+
* as well as callbacks that return that type.
|
|
932
|
+
*
|
|
933
|
+
* @example Sample usage
|
|
934
|
+
* ```typescript
|
|
935
|
+
* {
|
|
936
|
+
* // ...Other properties being added to a telemetry event
|
|
937
|
+
* ...tagData("someTag", {foo: 1, bar: 2}),
|
|
938
|
+
* // ...
|
|
939
|
+
* }
|
|
940
|
+
* ```
|
|
941
|
+
* This will result in `foo` and `bar` added to the event with their values tagged.
|
|
942
|
+
*
|
|
943
|
+
* @internal
|
|
944
|
+
*/
|
|
856
945
|
export const tagData = <
|
|
857
946
|
T extends TelemetryDataTag,
|
|
858
947
|
V extends Record<
|
|
@@ -895,8 +984,27 @@ export const tagData = <
|
|
|
895
984
|
}, {}) as ReturnType<typeof tagData>;
|
|
896
985
|
|
|
897
986
|
/**
|
|
898
|
-
*
|
|
899
|
-
*
|
|
987
|
+
* Tags all provided `values` as {@link TelemetryDataTag.CodeArtifact}.
|
|
988
|
+
*
|
|
989
|
+
* @param values - The values to be tagged.
|
|
990
|
+
*
|
|
991
|
+
* @remarks
|
|
992
|
+
* It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
|
|
993
|
+
* as well as callbacks that return that type.
|
|
994
|
+
*
|
|
995
|
+
* @example Sample usage
|
|
996
|
+
* ```typescript
|
|
997
|
+
* {
|
|
998
|
+
* // ...Other properties being added to a telemetry event
|
|
999
|
+
* ...tagCodeArtifacts("someTag", {foo: 1, bar: 2}),
|
|
1000
|
+
* // ...
|
|
1001
|
+
* }
|
|
1002
|
+
* ```
|
|
1003
|
+
* This will result in `foo` and `bar` added to the event with their values tagged as {@link TelemetryDataTag.CodeArtifact}.
|
|
1004
|
+
*
|
|
1005
|
+
* @see {@link tagData}
|
|
1006
|
+
*
|
|
1007
|
+
* @internal
|
|
900
1008
|
*/
|
|
901
1009
|
export const tagCodeArtifacts = <
|
|
902
1010
|
T extends Record<
|
package/src/mockLogger.ts
CHANGED
|
@@ -15,6 +15,8 @@ import { createChildLogger } from "./logger";
|
|
|
15
15
|
/**
|
|
16
16
|
* The MockLogger records events sent to it, and then can walk back over those events
|
|
17
17
|
* searching for a set of expected events to match against the logged events.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
18
20
|
*/
|
|
19
21
|
export class MockLogger implements ITelemetryBaseLogger {
|
|
20
22
|
events: ITelemetryBaseEvent[] = [];
|
|
@@ -49,9 +49,13 @@ interface Measurements {
|
|
|
49
49
|
/**
|
|
50
50
|
* Helper class that executes a specified code block and writes an
|
|
51
51
|
* {@link @fluidframework/core-interfaces#ITelemetryPerformanceEvent} to a specified logger every time a specified
|
|
52
|
-
* number of executions is reached (or when the class is disposed).
|
|
53
|
-
*
|
|
54
|
-
* `
|
|
52
|
+
* number of executions is reached (or when the class is disposed).
|
|
53
|
+
*
|
|
54
|
+
* The `duration` field in the telemetry event is the duration of the latest execution (sample) of the specified
|
|
55
|
+
* function. See the documentation of the `includeAggregateMetrics` parameter for additional details that can be
|
|
56
|
+
* included.
|
|
57
|
+
*
|
|
58
|
+
* @internal
|
|
55
59
|
*/
|
|
56
60
|
export class SampledTelemetryHelper implements IDisposable {
|
|
57
61
|
disposed: boolean = false;
|
package/src/telemetryTypes.ts
CHANGED
|
@@ -9,14 +9,22 @@ import { ITelemetryBaseLogger, LogLevel, Tagged } from "@fluidframework/core-int
|
|
|
9
9
|
* The categories FF uses when instrumenting the code.
|
|
10
10
|
*
|
|
11
11
|
* generic - Informational log event
|
|
12
|
+
*
|
|
12
13
|
* error - Error log event, ideally 0 of these are logged during a session
|
|
14
|
+
*
|
|
13
15
|
* performance - Includes duration, and often has _start, _end, or _cancel suffixes for activity tracking
|
|
16
|
+
* @alpha
|
|
14
17
|
*/
|
|
15
18
|
export type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
* Property types that can be logged.
|
|
19
|
-
*
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Includes extra types beyond {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType}, which must be
|
|
25
|
+
* converted before sending to a base logger.
|
|
26
|
+
*
|
|
27
|
+
* @alpha
|
|
20
28
|
*/
|
|
21
29
|
export type TelemetryEventPropertyTypeExt =
|
|
22
30
|
| string
|
|
@@ -34,7 +42,8 @@ export type TelemetryEventPropertyTypeExt =
|
|
|
34
42
|
* to mark pieces of information that should be organized or handled differently by loggers in various first or third
|
|
35
43
|
* party scenarios. For example, tags are used to mark personal information that should not be stored in logs.
|
|
36
44
|
*
|
|
37
|
-
* @deprecated Use Tagged
|
|
45
|
+
* @deprecated Use {@link @fluidframework/core-interfaces#Tagged}\<{@link TelemetryEventPropertyTypeExt}\>
|
|
46
|
+
* @internal
|
|
38
47
|
*/
|
|
39
48
|
export interface ITaggedTelemetryPropertyTypeExt {
|
|
40
49
|
value: TelemetryEventPropertyTypeExt;
|
|
@@ -43,6 +52,8 @@ export interface ITaggedTelemetryPropertyTypeExt {
|
|
|
43
52
|
|
|
44
53
|
/**
|
|
45
54
|
* JSON-serializable properties, which will be logged with telemetry.
|
|
55
|
+
*
|
|
56
|
+
* @alpha
|
|
46
57
|
*/
|
|
47
58
|
export interface ITelemetryPropertiesExt {
|
|
48
59
|
[index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;
|
|
@@ -50,9 +61,11 @@ export interface ITelemetryPropertiesExt {
|
|
|
50
61
|
|
|
51
62
|
/**
|
|
52
63
|
* Interface for logging telemetry statements.
|
|
53
|
-
*
|
|
64
|
+
* @remarks May contain any number of properties that get serialized as json payload.
|
|
54
65
|
* @param category - category of the event, like "error", "performance", "generic", etc.
|
|
55
66
|
* @param eventName - name of the event.
|
|
67
|
+
*
|
|
68
|
+
* @internal
|
|
56
69
|
*/
|
|
57
70
|
export interface ITelemetryEventExt extends ITelemetryPropertiesExt {
|
|
58
71
|
category: string;
|
|
@@ -61,7 +74,8 @@ export interface ITelemetryEventExt extends ITelemetryPropertiesExt {
|
|
|
61
74
|
|
|
62
75
|
/**
|
|
63
76
|
* Informational (non-error) telemetry event
|
|
64
|
-
* Maps to category = "generic"
|
|
77
|
+
* @remarks Maps to category = "generic"
|
|
78
|
+
* @alpha
|
|
65
79
|
*/
|
|
66
80
|
export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
67
81
|
eventName: string;
|
|
@@ -70,7 +84,8 @@ export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
|
70
84
|
|
|
71
85
|
/**
|
|
72
86
|
* Error telemetry event.
|
|
73
|
-
* Maps to category = "error"
|
|
87
|
+
* @remarks Maps to category = "error"
|
|
88
|
+
* @alpha
|
|
74
89
|
*/
|
|
75
90
|
export interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
|
|
76
91
|
eventName: string;
|
|
@@ -78,16 +93,20 @@ export interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
|
|
|
78
93
|
|
|
79
94
|
/**
|
|
80
95
|
* Performance telemetry event.
|
|
81
|
-
* Maps to category = "performance"
|
|
96
|
+
* @remarks Maps to category = "performance"
|
|
97
|
+
* @alpha
|
|
82
98
|
*/
|
|
83
99
|
export interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {
|
|
84
100
|
duration?: number; // Duration of event (optional)
|
|
85
101
|
}
|
|
86
102
|
|
|
87
103
|
/**
|
|
88
|
-
* An extended
|
|
104
|
+
* An extended {@link @fluidframework/core-interfaces#ITelemetryBaseLogger} which allows for more lenient event types.
|
|
105
|
+
*
|
|
106
|
+
* @remarks
|
|
89
107
|
* This interface is meant to be used internally within the Fluid Framework,
|
|
90
|
-
* and ITelemetryBaseLogger should be used when loggers are passed between layers.
|
|
108
|
+
* and `ITelemetryBaseLogger` should be used when loggers are passed between layers.
|
|
109
|
+
* @alpha
|
|
91
110
|
*/
|
|
92
111
|
export interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
93
112
|
/**
|
package/src/thresholdCounter.ts
CHANGED
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
import { ITelemetryLoggerExt } from "./telemetryTypes";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Utility counter which will send event only if the provided value
|
|
10
|
-
*
|
|
9
|
+
* Utility counter which will send event only if the provided value is above a configured threshold.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
11
12
|
*/
|
|
12
13
|
export class ThresholdCounter {
|
|
13
14
|
public constructor(
|
package/src/utils.ts
CHANGED
|
@@ -16,6 +16,12 @@ import { ITelemetryGenericEventExt, ITelemetryLoggerExt } from "./telemetryTypes
|
|
|
16
16
|
* @param logger - The logger to log with
|
|
17
17
|
* @param event - The string or event to log
|
|
18
18
|
* @returns The outcome of the condition
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*
|
|
22
|
+
* @deprecated
|
|
23
|
+
* This API will be removed in a future release.
|
|
24
|
+
* No replacement API is intended, but reproducing its behavior should be trivial for anyone who needs it.
|
|
19
25
|
*/
|
|
20
26
|
export function logIfFalse(
|
|
21
27
|
condition: unknown,
|