@fluidframework/telemetry-utils 2.0.0-internal.8.0.1 → 2.0.0-rc.1.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.
- package/CHANGELOG.md +38 -0
- package/README.md +1 -7
- package/api-extractor-esm.json +5 -0
- package/api-extractor-lint.json +1 -10
- package/api-extractor.json +1 -9
- package/api-report/telemetry-utils.api.md +16 -25
- package/dist/eventEmitterWithErrorHandling.d.ts +1 -1
- package/dist/eventEmitterWithErrorHandling.js +1 -1
- package/dist/eventEmitterWithErrorHandling.js.map +1 -1
- package/dist/index.d.ts +0 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +4 -4
- package/dist/logger.js +1 -1
- package/dist/logger.js.map +1 -1
- package/dist/telemetry-utils-alpha.d.ts +41 -21
- package/dist/telemetry-utils-beta.d.ts +105 -46
- package/dist/telemetry-utils-public.d.ts +105 -46
- package/dist/telemetry-utils-untrimmed.d.ts +16 -37
- package/dist/telemetryTypes.d.ts +7 -9
- package/dist/telemetryTypes.d.ts.map +1 -1
- package/dist/telemetryTypes.js.map +1 -1
- package/lib/eventEmitterWithErrorHandling.d.ts +1 -1
- package/lib/eventEmitterWithErrorHandling.js +1 -1
- package/lib/eventEmitterWithErrorHandling.js.map +1 -1
- package/lib/index.d.ts +0 -17
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +4 -4
- package/lib/logger.js +1 -1
- package/lib/logger.js.map +1 -1
- package/lib/telemetry-utils-alpha.d.mts +290 -0
- package/lib/{telemetry-utils-alpha.d.ts → telemetry-utils-beta.d.mts} +9 -15
- package/lib/{telemetry-utils-beta.d.ts → telemetry-utils-public.d.mts} +105 -46
- package/lib/{telemetry-utils-untrimmed.d.ts → telemetry-utils-untrimmed.d.mts} +16 -37
- package/lib/telemetryTypes.d.ts +7 -9
- package/lib/telemetryTypes.d.ts.map +1 -1
- package/lib/telemetryTypes.js.map +1 -1
- package/package.json +26 -17
- package/src/eventEmitterWithErrorHandling.ts +1 -1
- package/src/index.ts +0 -19
- package/src/logger.ts +4 -4
- package/src/telemetryTypes.ts +7 -9
- package/lib/telemetry-utils-public.d.ts +0 -205
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
4
|
import { EventEmitterEventType } from '@fluid-internal/client-utils';
|
|
5
|
-
import { IConfigProviderBase
|
|
5
|
+
import { IConfigProviderBase } from '@fluidframework/core-interfaces';
|
|
6
6
|
import { IDisposable } from '@fluidframework/core-interfaces';
|
|
7
7
|
import { IErrorBase } from '@fluidframework/core-interfaces';
|
|
8
8
|
import { IEvent } from '@fluidframework/core-interfaces';
|
|
@@ -24,8 +24,6 @@ import { TelemetryBaseEventPropertyType } from '@fluidframework/core-interfaces'
|
|
|
24
24
|
import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
25
25
|
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
26
26
|
|
|
27
|
-
/* Excluded from this release type: ConfigTypes */
|
|
28
|
-
|
|
29
27
|
/* Excluded from this release type: connectedEventName */
|
|
30
28
|
|
|
31
29
|
/* Excluded from this release type: createChildLogger */
|
|
@@ -42,9 +40,22 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
|
42
40
|
|
|
43
41
|
/* Excluded from this release type: disconnectedEventName */
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Event Emitter helper class
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* Any exceptions thrown by listeners will be caught and raised through "error" event.
|
|
48
|
+
* Any exception thrown by "error" listeners will propagate to the caller.
|
|
49
|
+
* @privateRemarks
|
|
50
|
+
* This probably doesn't belong in this package, as it is not telemetry-specific, and is really only intended for internal fluid-framework use.
|
|
51
|
+
* We should consider moving it to the `core-utils` package.
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
export declare class EventEmitterWithErrorHandling<TEvent extends IEvent = IEvent> extends TypedEventEmitter<TEvent> {
|
|
55
|
+
private readonly errorHandler;
|
|
56
|
+
constructor(errorHandler: (eventName: EventEmitterEventType, error: any) => void);
|
|
57
|
+
emit(event: EventEmitterEventType, ...args: unknown[]): boolean;
|
|
58
|
+
}
|
|
48
59
|
|
|
49
60
|
/* Excluded from this release type: eventNamespaceSeparator */
|
|
50
61
|
|
|
@@ -66,16 +77,6 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
|
66
77
|
|
|
67
78
|
/* Excluded from this release type: IConfigProvider */
|
|
68
79
|
|
|
69
|
-
/* Excluded from this release type: IConfigProviderBase */
|
|
70
|
-
|
|
71
|
-
/* Excluded from this release type: IConfigProviderBase_2 */
|
|
72
|
-
|
|
73
|
-
/* Excluded from this release type: IDisposable */
|
|
74
|
-
|
|
75
|
-
/* Excluded from this release type: IErrorBase */
|
|
76
|
-
|
|
77
|
-
/* Excluded from this release type: IEvent */
|
|
78
|
-
|
|
79
80
|
/* Excluded from this release type: IEventSampler */
|
|
80
81
|
|
|
81
82
|
/* Excluded from this release type: IFluidErrorAnnotations */
|
|
@@ -102,35 +103,78 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
|
102
103
|
|
|
103
104
|
/* Excluded from this release type: ITaggedTelemetryPropertyTypeExt */
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
/* Excluded from this release type: ITelemetryErrorEventExt */
|
|
106
|
+
/**
|
|
107
|
+
* Error telemetry event.
|
|
108
|
+
* @remarks Maps to category = "error"
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
export declare interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
|
|
112
|
+
eventName: string;
|
|
113
|
+
}
|
|
114
114
|
|
|
115
115
|
/* Excluded from this release type: ITelemetryEventExt */
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Informational (non-error) telemetry event
|
|
119
|
+
* @remarks Maps to category = "generic"
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
export declare interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
123
|
+
eventName: string;
|
|
124
|
+
category?: TelemetryEventCategory;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* An extended {@link @fluidframework/core-interfaces#ITelemetryBaseLogger} which allows for more lenient event types.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* This interface is meant to be used internally within the Fluid Framework,
|
|
132
|
+
* and `ITelemetryBaseLogger` should be used when loggers are passed between layers.
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
|
+
export declare interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
136
|
+
/**
|
|
137
|
+
* Send information telemetry event
|
|
138
|
+
* @param event - Event to send
|
|
139
|
+
* @param error - optional error object to log
|
|
140
|
+
* @param logLevel - optional level of the log.
|
|
141
|
+
*/
|
|
142
|
+
sendTelemetryEvent(event: ITelemetryGenericEventExt, error?: unknown, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
143
|
+
/**
|
|
144
|
+
* Send error telemetry event
|
|
145
|
+
* @param event - Event to send
|
|
146
|
+
* @param error - optional error object to log
|
|
147
|
+
*/
|
|
148
|
+
sendErrorEvent(event: ITelemetryErrorEventExt, error?: unknown): void;
|
|
149
|
+
/**
|
|
150
|
+
* Send performance telemetry event
|
|
151
|
+
* @param event - Event to send
|
|
152
|
+
* @param error - optional error object to log
|
|
153
|
+
* @param logLevel - optional level of the log.
|
|
154
|
+
*/
|
|
155
|
+
sendPerformanceEvent(event: ITelemetryPerformanceEventExt, error?: unknown, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
156
|
+
}
|
|
122
157
|
|
|
123
158
|
/* Excluded from this release type: ITelemetryLoggerPropertyBag */
|
|
124
159
|
|
|
125
160
|
/* Excluded from this release type: ITelemetryLoggerPropertyBags */
|
|
126
161
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
162
|
+
/**
|
|
163
|
+
* Performance telemetry event.
|
|
164
|
+
* @remarks Maps to category = "performance"
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
export declare interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {
|
|
168
|
+
duration?: number;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* JSON-serializable properties, which will be logged with telemetry.
|
|
173
|
+
* @public
|
|
174
|
+
*/
|
|
175
|
+
export declare interface ITelemetryPropertiesExt {
|
|
176
|
+
[index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;
|
|
177
|
+
}
|
|
134
178
|
|
|
135
179
|
/* Excluded from this release type: IUsageError */
|
|
136
180
|
|
|
@@ -142,8 +186,6 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
|
142
186
|
|
|
143
187
|
/* Excluded from this release type: logIfFalse */
|
|
144
188
|
|
|
145
|
-
/* Excluded from this release type: LogLevel */
|
|
146
|
-
|
|
147
189
|
/* Excluded from this release type: mixinMonitoringContext */
|
|
148
190
|
|
|
149
191
|
/* Excluded from this release type: MockLogger */
|
|
@@ -174,17 +216,36 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
|
174
216
|
|
|
175
217
|
/* Excluded from this release type: tagData */
|
|
176
218
|
|
|
177
|
-
/* Excluded from this release type: Tagged */
|
|
178
|
-
|
|
179
219
|
/* Excluded from this release type: TaggedLoggerAdapter */
|
|
180
220
|
|
|
181
221
|
/* Excluded from this release type: TelemetryBaseEventPropertyType */
|
|
182
222
|
|
|
183
223
|
/* Excluded from this release type: TelemetryDataTag */
|
|
184
224
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
225
|
+
/**
|
|
226
|
+
* The categories FF uses when instrumenting the code.
|
|
227
|
+
*
|
|
228
|
+
* generic - Informational log event
|
|
229
|
+
*
|
|
230
|
+
* error - Error log event, ideally 0 of these are logged during a session
|
|
231
|
+
*
|
|
232
|
+
* performance - Includes duration, and often has _start, _end, or _cancel suffixes for activity tracking
|
|
233
|
+
* @public
|
|
234
|
+
*/
|
|
235
|
+
export declare type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Property types that can be logged.
|
|
239
|
+
*
|
|
240
|
+
* @remarks
|
|
241
|
+
* Includes extra types beyond {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType}, which must be
|
|
242
|
+
* converted before sending to a base logger.
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
export declare type TelemetryEventPropertyTypeExt = string | number | boolean | undefined | (string | number | boolean)[] | {
|
|
246
|
+
[key: string]: // Flat objects can have the same properties as the event itself
|
|
247
|
+
string | number | boolean | undefined | (string | number | boolean)[];
|
|
248
|
+
};
|
|
188
249
|
|
|
189
250
|
/* Excluded from this release type: TelemetryEventPropertyTypes */
|
|
190
251
|
|
|
@@ -192,8 +253,6 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
|
192
253
|
|
|
193
254
|
/* Excluded from this release type: ThresholdCounter */
|
|
194
255
|
|
|
195
|
-
/* Excluded from this release type: TypedEventEmitter */
|
|
196
|
-
|
|
197
256
|
/* Excluded from this release type: UsageError */
|
|
198
257
|
|
|
199
258
|
/* Excluded from this release type: validatePrecondition */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
4
|
import { EventEmitterEventType } from '@fluid-internal/client-utils';
|
|
5
|
-
import { IConfigProviderBase
|
|
5
|
+
import { IConfigProviderBase } from '@fluidframework/core-interfaces';
|
|
6
6
|
import { IDisposable } from '@fluidframework/core-interfaces';
|
|
7
7
|
import { IErrorBase } from '@fluidframework/core-interfaces';
|
|
8
8
|
import { IEvent } from '@fluidframework/core-interfaces';
|
|
@@ -24,14 +24,6 @@ import { TelemetryBaseEventPropertyType } from '@fluidframework/core-interfaces'
|
|
|
24
24
|
import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
25
25
|
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* Types supported by {@link IConfigProviderBase}.
|
|
29
|
-
* @deprecated Use ConfigTypes from fluidFramework/core-interfaces
|
|
30
|
-
*
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
export declare type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;
|
|
34
|
-
|
|
35
27
|
/**
|
|
36
28
|
* @internal
|
|
37
29
|
*/
|
|
@@ -45,7 +37,7 @@ export declare const connectedEventName = "connected";
|
|
|
45
37
|
*
|
|
46
38
|
* @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.
|
|
47
39
|
*
|
|
48
|
-
* @
|
|
40
|
+
* @alpha
|
|
49
41
|
*/
|
|
50
42
|
export declare function createChildLogger(props?: {
|
|
51
43
|
logger?: ITelemetryBaseLogger;
|
|
@@ -155,7 +147,7 @@ export declare const disconnectedEventName = "disconnected";
|
|
|
155
147
|
* @privateRemarks
|
|
156
148
|
* This probably doesn't belong in this package, as it is not telemetry-specific, and is really only intended for internal fluid-framework use.
|
|
157
149
|
* We should consider moving it to the `core-utils` package.
|
|
158
|
-
* @
|
|
150
|
+
* @public
|
|
159
151
|
*/
|
|
160
152
|
export declare class EventEmitterWithErrorHandling<TEvent extends IEvent = IEvent> extends TypedEventEmitter<TEvent> {
|
|
161
153
|
private readonly errorHandler;
|
|
@@ -264,7 +256,7 @@ export declare const hasErrorInstanceId: (x: unknown) => x is {
|
|
|
264
256
|
*
|
|
265
257
|
* @internal
|
|
266
258
|
*/
|
|
267
|
-
export declare interface IConfigProvider extends
|
|
259
|
+
export declare interface IConfigProvider extends IConfigProviderBase {
|
|
268
260
|
getBoolean(name: string): boolean | undefined;
|
|
269
261
|
getNumber(name: string): number | undefined;
|
|
270
262
|
getString(name: string): string | undefined;
|
|
@@ -273,17 +265,6 @@ export declare interface IConfigProvider extends IConfigProviderBase_2 {
|
|
|
273
265
|
getStringArray(name: string): string[] | undefined;
|
|
274
266
|
}
|
|
275
267
|
|
|
276
|
-
/**
|
|
277
|
-
* Base interface for providing configurations to enable/disable/control features.
|
|
278
|
-
*
|
|
279
|
-
* @deprecated Use IConfigProviderBase from fluidFramework/core-interfaces
|
|
280
|
-
*
|
|
281
|
-
* @internal
|
|
282
|
-
*/
|
|
283
|
-
export declare interface IConfigProviderBase {
|
|
284
|
-
getRawConfig(name: string): ConfigTypes;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
268
|
/**
|
|
288
269
|
* An object that contains a callback used in conjunction with the {@link createSampledLogger} utility function to provide custom logic for sampling events.
|
|
289
270
|
*
|
|
@@ -454,7 +435,7 @@ export declare interface ITaggedTelemetryPropertyTypeExt {
|
|
|
454
435
|
/**
|
|
455
436
|
* Error telemetry event.
|
|
456
437
|
* @remarks Maps to category = "error"
|
|
457
|
-
* @
|
|
438
|
+
* @public
|
|
458
439
|
*/
|
|
459
440
|
export declare interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
|
|
460
441
|
eventName: string;
|
|
@@ -476,7 +457,7 @@ export declare interface ITelemetryEventExt extends ITelemetryPropertiesExt {
|
|
|
476
457
|
/**
|
|
477
458
|
* Informational (non-error) telemetry event
|
|
478
459
|
* @remarks Maps to category = "generic"
|
|
479
|
-
* @
|
|
460
|
+
* @public
|
|
480
461
|
*/
|
|
481
462
|
export declare interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
482
463
|
eventName: string;
|
|
@@ -489,7 +470,7 @@ export declare interface ITelemetryGenericEventExt extends ITelemetryPropertiesE
|
|
|
489
470
|
* @remarks
|
|
490
471
|
* This interface is meant to be used internally within the Fluid Framework,
|
|
491
472
|
* and `ITelemetryBaseLogger` should be used when loggers are passed between layers.
|
|
492
|
-
* @
|
|
473
|
+
* @public
|
|
493
474
|
*/
|
|
494
475
|
export declare interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
495
476
|
/**
|
|
@@ -515,14 +496,14 @@ export declare interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
|
515
496
|
}
|
|
516
497
|
|
|
517
498
|
/**
|
|
518
|
-
* @
|
|
499
|
+
* @alpha
|
|
519
500
|
*/
|
|
520
501
|
export declare interface ITelemetryLoggerPropertyBag {
|
|
521
502
|
[index: string]: TelemetryEventPropertyTypes | (() => TelemetryEventPropertyTypes);
|
|
522
503
|
}
|
|
523
504
|
|
|
524
505
|
/**
|
|
525
|
-
* @
|
|
506
|
+
* @alpha
|
|
526
507
|
*/
|
|
527
508
|
export declare interface ITelemetryLoggerPropertyBags {
|
|
528
509
|
all?: ITelemetryLoggerPropertyBag;
|
|
@@ -532,7 +513,7 @@ export declare interface ITelemetryLoggerPropertyBags {
|
|
|
532
513
|
/**
|
|
533
514
|
* Performance telemetry event.
|
|
534
515
|
* @remarks Maps to category = "performance"
|
|
535
|
-
* @
|
|
516
|
+
* @public
|
|
536
517
|
*/
|
|
537
518
|
export declare interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {
|
|
538
519
|
duration?: number;
|
|
@@ -540,8 +521,7 @@ export declare interface ITelemetryPerformanceEventExt extends ITelemetryGeneric
|
|
|
540
521
|
|
|
541
522
|
/**
|
|
542
523
|
* JSON-serializable properties, which will be logged with telemetry.
|
|
543
|
-
*
|
|
544
|
-
* @alpha
|
|
524
|
+
* @public
|
|
545
525
|
*/
|
|
546
526
|
export declare interface ITelemetryPropertiesExt {
|
|
547
527
|
[index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;
|
|
@@ -621,7 +601,7 @@ export declare function logIfFalse(condition: unknown, logger: ITelemetryBaseLog
|
|
|
621
601
|
*
|
|
622
602
|
* @internal
|
|
623
603
|
*/
|
|
624
|
-
export declare function mixinMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(logger: L, ...configs: (
|
|
604
|
+
export declare function mixinMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(logger: L, ...configs: (IConfigProviderBase | undefined)[]): MonitoringContext<L>;
|
|
625
605
|
|
|
626
606
|
/**
|
|
627
607
|
* The MockLogger records events sent to it, and then can walk back over those events
|
|
@@ -910,7 +890,7 @@ export declare class SampledTelemetryHelper implements IDisposable {
|
|
|
910
890
|
*
|
|
911
891
|
* @internal
|
|
912
892
|
*/
|
|
913
|
-
export declare const sessionStorageConfigProvider: Lazy<
|
|
893
|
+
export declare const sessionStorageConfigProvider: Lazy<IConfigProviderBase>;
|
|
914
894
|
|
|
915
895
|
/**
|
|
916
896
|
* Tags all provided `values` as {@link TelemetryDataTag.CodeArtifact}.
|
|
@@ -1015,7 +995,7 @@ export declare enum TelemetryDataTag {
|
|
|
1015
995
|
* error - Error log event, ideally 0 of these are logged during a session
|
|
1016
996
|
*
|
|
1017
997
|
* performance - Includes duration, and often has _start, _end, or _cancel suffixes for activity tracking
|
|
1018
|
-
* @
|
|
998
|
+
* @public
|
|
1019
999
|
*/
|
|
1020
1000
|
export declare type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
1021
1001
|
|
|
@@ -1025,8 +1005,7 @@ export declare type TelemetryEventCategory = "generic" | "error" | "performance"
|
|
|
1025
1005
|
* @remarks
|
|
1026
1006
|
* Includes extra types beyond {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType}, which must be
|
|
1027
1007
|
* converted before sending to a base logger.
|
|
1028
|
-
*
|
|
1029
|
-
* @alpha
|
|
1008
|
+
* @public
|
|
1030
1009
|
*/
|
|
1031
1010
|
export declare type TelemetryEventPropertyTypeExt = string | number | boolean | undefined | (string | number | boolean)[] | {
|
|
1032
1011
|
[key: string]: // Flat objects can have the same properties as the event itself
|
|
@@ -1034,7 +1013,7 @@ export declare type TelemetryEventPropertyTypeExt = string | number | boolean |
|
|
|
1034
1013
|
};
|
|
1035
1014
|
|
|
1036
1015
|
/**
|
|
1037
|
-
* @
|
|
1016
|
+
* @alpha
|
|
1038
1017
|
*/
|
|
1039
1018
|
export declare type TelemetryEventPropertyTypes = ITelemetryBaseProperties[string];
|
|
1040
1019
|
|
package/lib/telemetryTypes.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { ITelemetryBaseLogger, LogLevel, Tagged } from "@fluidframework/core-int
|
|
|
11
11
|
* error - Error log event, ideally 0 of these are logged during a session
|
|
12
12
|
*
|
|
13
13
|
* performance - Includes duration, and often has _start, _end, or _cancel suffixes for activity tracking
|
|
14
|
-
* @
|
|
14
|
+
* @public
|
|
15
15
|
*/
|
|
16
16
|
export type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
17
17
|
/**
|
|
@@ -20,8 +20,7 @@ export type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
|
20
20
|
* @remarks
|
|
21
21
|
* Includes extra types beyond {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType}, which must be
|
|
22
22
|
* converted before sending to a base logger.
|
|
23
|
-
*
|
|
24
|
-
* @alpha
|
|
23
|
+
* @public
|
|
25
24
|
*/
|
|
26
25
|
export type TelemetryEventPropertyTypeExt = string | number | boolean | undefined | (string | number | boolean)[] | {
|
|
27
26
|
[key: string]: // Flat objects can have the same properties as the event itself
|
|
@@ -41,8 +40,7 @@ export interface ITaggedTelemetryPropertyTypeExt {
|
|
|
41
40
|
}
|
|
42
41
|
/**
|
|
43
42
|
* JSON-serializable properties, which will be logged with telemetry.
|
|
44
|
-
*
|
|
45
|
-
* @alpha
|
|
43
|
+
* @public
|
|
46
44
|
*/
|
|
47
45
|
export interface ITelemetryPropertiesExt {
|
|
48
46
|
[index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;
|
|
@@ -62,7 +60,7 @@ export interface ITelemetryEventExt extends ITelemetryPropertiesExt {
|
|
|
62
60
|
/**
|
|
63
61
|
* Informational (non-error) telemetry event
|
|
64
62
|
* @remarks Maps to category = "generic"
|
|
65
|
-
* @
|
|
63
|
+
* @public
|
|
66
64
|
*/
|
|
67
65
|
export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
68
66
|
eventName: string;
|
|
@@ -71,7 +69,7 @@ export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
|
71
69
|
/**
|
|
72
70
|
* Error telemetry event.
|
|
73
71
|
* @remarks Maps to category = "error"
|
|
74
|
-
* @
|
|
72
|
+
* @public
|
|
75
73
|
*/
|
|
76
74
|
export interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
|
|
77
75
|
eventName: string;
|
|
@@ -79,7 +77,7 @@ export interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
|
|
|
79
77
|
/**
|
|
80
78
|
* Performance telemetry event.
|
|
81
79
|
* @remarks Maps to category = "performance"
|
|
82
|
-
* @
|
|
80
|
+
* @public
|
|
83
81
|
*/
|
|
84
82
|
export interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {
|
|
85
83
|
duration?: number;
|
|
@@ -90,7 +88,7 @@ export interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt
|
|
|
90
88
|
* @remarks
|
|
91
89
|
* This interface is meant to be used internally within the Fluid Framework,
|
|
92
90
|
* and `ITelemetryBaseLogger` should be used when loggers are passed between layers.
|
|
93
|
-
* @
|
|
91
|
+
* @public
|
|
94
92
|
*/
|
|
95
93
|
export interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
96
94
|
/**
|
|
@@ -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;;;;;;;;;GASG;AACH,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAEzE
|
|
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;;;;;;;GAOG;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;;;GAGG;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 *\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 * @
|
|
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 * @public\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 * @public\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 * @public\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 * @public\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 * @public\n */\nexport interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {\n\teventName: string;\n}\n\n/**\n * Performance telemetry event.\n * @remarks Maps to category = \"performance\"\n * @public\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 * @public\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/telemetry-utils",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.1.0.0",
|
|
4
4
|
"description": "Collection of telemetry relates utilities for Fluid",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"all": true,
|
|
23
23
|
"cache-dir": "nyc/.cache",
|
|
24
24
|
"exclude": [
|
|
25
|
-
"src/test
|
|
26
|
-
"dist/test
|
|
25
|
+
"src/test/**/*.*ts",
|
|
26
|
+
"dist/test/**/*.*js"
|
|
27
27
|
],
|
|
28
28
|
"exclude-after-remap": false,
|
|
29
29
|
"include": [
|
|
30
|
-
"src
|
|
31
|
-
"dist
|
|
30
|
+
"src/**/*.*ts",
|
|
31
|
+
"dist/**/*.*js"
|
|
32
32
|
],
|
|
33
33
|
"report-dir": "nyc/report",
|
|
34
34
|
"reporter": [
|
|
@@ -39,29 +39,29 @@
|
|
|
39
39
|
"temp-directory": "nyc/.nyc_output"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@fluid-internal/client-utils": ">=2.0.0-
|
|
43
|
-
"@fluidframework/core-interfaces": ">=2.0.0-
|
|
44
|
-
"@fluidframework/core-utils": ">=2.0.0-
|
|
45
|
-
"@fluidframework/protocol-definitions": "^3.
|
|
42
|
+
"@fluid-internal/client-utils": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
43
|
+
"@fluidframework/core-interfaces": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
44
|
+
"@fluidframework/core-utils": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
45
|
+
"@fluidframework/protocol-definitions": "^3.1.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
51
|
"@arethetypeswrong/cli": "^0.13.3",
|
|
52
|
-
"@fluid-tools/build-cli": "^0.
|
|
52
|
+
"@fluid-tools/build-cli": "^0.29.0",
|
|
53
53
|
"@fluidframework/build-common": "^2.0.3",
|
|
54
|
-
"@fluidframework/build-tools": "^0.
|
|
55
|
-
"@fluidframework/eslint-config-fluid": "^3.
|
|
56
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-
|
|
57
|
-
"@fluidframework/telemetry-utils-previous": "npm:@fluidframework/telemetry-utils@2.0.0-internal.
|
|
54
|
+
"@fluidframework/build-tools": "^0.29.0",
|
|
55
|
+
"@fluidframework/eslint-config-fluid": "^3.2.0",
|
|
56
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
57
|
+
"@fluidframework/telemetry-utils-previous": "npm:@fluidframework/telemetry-utils@2.0.0-internal.8.0.0",
|
|
58
58
|
"@microsoft/api-extractor": "^7.38.3",
|
|
59
59
|
"@types/debug": "^4.1.5",
|
|
60
60
|
"@types/events": "^3.0.0",
|
|
61
61
|
"@types/mocha": "^9.1.1",
|
|
62
62
|
"@types/node": "^18.19.0",
|
|
63
63
|
"@types/uuid": "^9.0.2",
|
|
64
|
-
"c8": "^
|
|
64
|
+
"c8": "^8.0.1",
|
|
65
65
|
"copyfiles": "^2.4.1",
|
|
66
66
|
"cross-env": "^7.0.3",
|
|
67
67
|
"eslint": "~8.50.0",
|
|
@@ -87,12 +87,21 @@
|
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
"typeValidation": {
|
|
90
|
-
"broken": {
|
|
90
|
+
"broken": {
|
|
91
|
+
"RemovedInterfaceDeclaration_IConfigProviderBase": {
|
|
92
|
+
"forwardCompat": false,
|
|
93
|
+
"backCompat": false
|
|
94
|
+
},
|
|
95
|
+
"RemovedTypeAliasDeclaration_ConfigTypes": {
|
|
96
|
+
"backCompat": false,
|
|
97
|
+
"forwardCompat": false
|
|
98
|
+
}
|
|
99
|
+
}
|
|
91
100
|
},
|
|
92
101
|
"scripts": {
|
|
93
102
|
"api": "fluid-build . --task api",
|
|
94
103
|
"api-extractor:commonjs": "api-extractor run --local",
|
|
95
|
-
"api-extractor:esnext": "
|
|
104
|
+
"api-extractor:esnext": "api-extractor run --config ./api-extractor-esm.json",
|
|
96
105
|
"build": "fluid-build . --task build",
|
|
97
106
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
98
107
|
"build:compile": "fluid-build . --task compile",
|
|
@@ -14,7 +14,7 @@ import { IEvent } from "@fluidframework/core-interfaces";
|
|
|
14
14
|
* @privateRemarks
|
|
15
15
|
* This probably doesn't belong in this package, as it is not telemetry-specific, and is really only intended for internal fluid-framework use.
|
|
16
16
|
* We should consider moving it to the `core-utils` package.
|
|
17
|
-
* @
|
|
17
|
+
* @public
|
|
18
18
|
*/
|
|
19
19
|
export class EventEmitterWithErrorHandling<
|
|
20
20
|
TEvent extends IEvent = IEvent,
|
package/src/index.ts
CHANGED
|
@@ -80,22 +80,3 @@ 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
|
-
}
|
package/src/logger.ts
CHANGED
|
@@ -60,19 +60,19 @@ export enum TelemetryDataTag {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* @
|
|
63
|
+
* @alpha
|
|
64
64
|
*/
|
|
65
65
|
export type TelemetryEventPropertyTypes = ITelemetryBaseProperties[string];
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* @
|
|
68
|
+
* @alpha
|
|
69
69
|
*/
|
|
70
70
|
export interface ITelemetryLoggerPropertyBag {
|
|
71
71
|
[index: string]: TelemetryEventPropertyTypes | (() => TelemetryEventPropertyTypes);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
* @
|
|
75
|
+
* @alpha
|
|
76
76
|
*/
|
|
77
77
|
export interface ITelemetryLoggerPropertyBags {
|
|
78
78
|
all?: ITelemetryLoggerPropertyBag;
|
|
@@ -375,7 +375,7 @@ export class TaggedLoggerAdapter implements ITelemetryBaseLogger {
|
|
|
375
375
|
*
|
|
376
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
377
|
*
|
|
378
|
-
* @
|
|
378
|
+
* @alpha
|
|
379
379
|
*/
|
|
380
380
|
export function createChildLogger(props?: {
|
|
381
381
|
logger?: ITelemetryBaseLogger;
|