@fluidframework/telemetry-utils 2.0.0-internal.8.0.0 → 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 +24 -33
- 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 +14 -14
- package/dist/logger.d.ts.map +1 -1
- 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 +24 -45
- 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 +14 -14
- package/lib/logger.d.ts.map +1 -1
- 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} +24 -45
- 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 +22 -16
- package/src/telemetryTypes.ts +7 -9
- package/lib/telemetry-utils-public.d.ts +0 -205
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
import { EventEmitterEventType } from '@fluid-internal/client-utils';
|
|
5
|
+
import { IConfigProviderBase } from '@fluidframework/core-interfaces';
|
|
6
|
+
import { IDisposable } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { IErrorBase } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { IEvent } from '@fluidframework/core-interfaces';
|
|
9
|
+
import { IGenericError } from '@fluidframework/core-interfaces';
|
|
10
|
+
import { ILoggingError } from '@fluidframework/core-interfaces';
|
|
11
|
+
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
12
|
+
import { ITelemetryBaseEvent } from '@fluidframework/core-interfaces';
|
|
13
|
+
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
14
|
+
import { ITelemetryBaseProperties } from '@fluidframework/core-interfaces';
|
|
15
|
+
import { ITelemetryErrorEvent } from '@fluidframework/core-interfaces';
|
|
16
|
+
import { ITelemetryGenericEvent } from '@fluidframework/core-interfaces';
|
|
17
|
+
import { ITelemetryPerformanceEvent } from '@fluidframework/core-interfaces';
|
|
18
|
+
import { ITelemetryProperties } from '@fluidframework/core-interfaces';
|
|
19
|
+
import { IUsageError } from '@fluidframework/core-interfaces';
|
|
20
|
+
import { Lazy } from '@fluidframework/core-utils';
|
|
21
|
+
import { LogLevel } from '@fluidframework/core-interfaces';
|
|
22
|
+
import { Tagged } from '@fluidframework/core-interfaces';
|
|
23
|
+
import { TelemetryBaseEventPropertyType } from '@fluidframework/core-interfaces';
|
|
24
|
+
import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
25
|
+
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
26
|
+
|
|
27
|
+
/* Excluded from this release type: connectedEventName */
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Create a child logger based on the provided props object.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Passing in no props object (i.e. undefined) will return a logger that is effectively a no-op.
|
|
34
|
+
*
|
|
35
|
+
* @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.
|
|
36
|
+
*
|
|
37
|
+
* @alpha
|
|
38
|
+
*/
|
|
39
|
+
export declare function createChildLogger(props?: {
|
|
40
|
+
logger?: ITelemetryBaseLogger;
|
|
41
|
+
namespace?: string;
|
|
42
|
+
properties?: ITelemetryLoggerPropertyBags;
|
|
43
|
+
}): ITelemetryLoggerExt;
|
|
44
|
+
|
|
45
|
+
/* Excluded from this release type: createChildMonitoringContext */
|
|
46
|
+
|
|
47
|
+
/* Excluded from this release type: createMultiSinkLogger */
|
|
48
|
+
|
|
49
|
+
/* Excluded from this release type: createSampledLogger */
|
|
50
|
+
|
|
51
|
+
/* Excluded from this release type: DataCorruptionError */
|
|
52
|
+
|
|
53
|
+
/* Excluded from this release type: DataProcessingError */
|
|
54
|
+
|
|
55
|
+
/* Excluded from this release type: disconnectedEventName */
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Event Emitter helper class
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* Any exceptions thrown by listeners will be caught and raised through "error" event.
|
|
62
|
+
* Any exception thrown by "error" listeners will propagate to the caller.
|
|
63
|
+
* @privateRemarks
|
|
64
|
+
* This probably doesn't belong in this package, as it is not telemetry-specific, and is really only intended for internal fluid-framework use.
|
|
65
|
+
* We should consider moving it to the `core-utils` package.
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
export declare class EventEmitterWithErrorHandling<TEvent extends IEvent = IEvent> extends TypedEventEmitter<TEvent> {
|
|
69
|
+
private readonly errorHandler;
|
|
70
|
+
constructor(errorHandler: (eventName: EventEmitterEventType, error: any) => void);
|
|
71
|
+
emit(event: EventEmitterEventType, ...args: unknown[]): boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Excluded from this release type: eventNamespaceSeparator */
|
|
75
|
+
|
|
76
|
+
/* Excluded from this release type: extractLogSafeErrorProperties */
|
|
77
|
+
|
|
78
|
+
/* Excluded from this release type: extractSafePropertiesFromMessage */
|
|
79
|
+
|
|
80
|
+
/* Excluded from this release type: formatTick */
|
|
81
|
+
|
|
82
|
+
/* Excluded from this release type: generateErrorWithStack */
|
|
83
|
+
|
|
84
|
+
/* Excluded from this release type: generateStack */
|
|
85
|
+
|
|
86
|
+
/* Excluded from this release type: GenericError */
|
|
87
|
+
|
|
88
|
+
/* Excluded from this release type: getCircularReplacer */
|
|
89
|
+
|
|
90
|
+
/* Excluded from this release type: hasErrorInstanceId */
|
|
91
|
+
|
|
92
|
+
/* Excluded from this release type: IConfigProvider */
|
|
93
|
+
|
|
94
|
+
/* Excluded from this release type: IEventSampler */
|
|
95
|
+
|
|
96
|
+
/* Excluded from this release type: IFluidErrorAnnotations */
|
|
97
|
+
|
|
98
|
+
/* Excluded from this release type: IFluidErrorBase */
|
|
99
|
+
|
|
100
|
+
/* Excluded from this release type: IGenericError */
|
|
101
|
+
|
|
102
|
+
/* Excluded from this release type: ILoggingError */
|
|
103
|
+
|
|
104
|
+
/* Excluded from this release type: IPerformanceEventMarkers */
|
|
105
|
+
|
|
106
|
+
/* Excluded from this release type: ISampledTelemetryLogger */
|
|
107
|
+
|
|
108
|
+
/* Excluded from this release type: isExternalError */
|
|
109
|
+
|
|
110
|
+
/* Excluded from this release type: isFluidError */
|
|
111
|
+
|
|
112
|
+
/* Excluded from this release type: isILoggingError */
|
|
113
|
+
|
|
114
|
+
/* Excluded from this release type: isTaggedTelemetryPropertyValue */
|
|
115
|
+
|
|
116
|
+
/* Excluded from this release type: isValidLegacyError */
|
|
117
|
+
|
|
118
|
+
/* Excluded from this release type: ITaggedTelemetryPropertyTypeExt */
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Error telemetry event.
|
|
122
|
+
* @remarks Maps to category = "error"
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
125
|
+
export declare interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
|
|
126
|
+
eventName: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Excluded from this release type: ITelemetryEventExt */
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Informational (non-error) telemetry event
|
|
133
|
+
* @remarks Maps to category = "generic"
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
export declare interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
137
|
+
eventName: string;
|
|
138
|
+
category?: TelemetryEventCategory;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* An extended {@link @fluidframework/core-interfaces#ITelemetryBaseLogger} which allows for more lenient event types.
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
* This interface is meant to be used internally within the Fluid Framework,
|
|
146
|
+
* and `ITelemetryBaseLogger` should be used when loggers are passed between layers.
|
|
147
|
+
* @public
|
|
148
|
+
*/
|
|
149
|
+
export declare interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
150
|
+
/**
|
|
151
|
+
* Send information telemetry event
|
|
152
|
+
* @param event - Event to send
|
|
153
|
+
* @param error - optional error object to log
|
|
154
|
+
* @param logLevel - optional level of the log.
|
|
155
|
+
*/
|
|
156
|
+
sendTelemetryEvent(event: ITelemetryGenericEventExt, error?: unknown, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
157
|
+
/**
|
|
158
|
+
* Send error telemetry event
|
|
159
|
+
* @param event - Event to send
|
|
160
|
+
* @param error - optional error object to log
|
|
161
|
+
*/
|
|
162
|
+
sendErrorEvent(event: ITelemetryErrorEventExt, error?: unknown): void;
|
|
163
|
+
/**
|
|
164
|
+
* Send performance telemetry event
|
|
165
|
+
* @param event - Event to send
|
|
166
|
+
* @param error - optional error object to log
|
|
167
|
+
* @param logLevel - optional level of the log.
|
|
168
|
+
*/
|
|
169
|
+
sendPerformanceEvent(event: ITelemetryPerformanceEventExt, error?: unknown, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @alpha
|
|
174
|
+
*/
|
|
175
|
+
export declare interface ITelemetryLoggerPropertyBag {
|
|
176
|
+
[index: string]: TelemetryEventPropertyTypes | (() => TelemetryEventPropertyTypes);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @alpha
|
|
181
|
+
*/
|
|
182
|
+
export declare interface ITelemetryLoggerPropertyBags {
|
|
183
|
+
all?: ITelemetryLoggerPropertyBag;
|
|
184
|
+
error?: ITelemetryLoggerPropertyBag;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Performance telemetry event.
|
|
189
|
+
* @remarks Maps to category = "performance"
|
|
190
|
+
* @public
|
|
191
|
+
*/
|
|
192
|
+
export declare interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {
|
|
193
|
+
duration?: number;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* JSON-serializable properties, which will be logged with telemetry.
|
|
198
|
+
* @public
|
|
199
|
+
*/
|
|
200
|
+
export declare interface ITelemetryPropertiesExt {
|
|
201
|
+
[index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* Excluded from this release type: IUsageError */
|
|
205
|
+
|
|
206
|
+
/* Excluded from this release type: Lazy */
|
|
207
|
+
|
|
208
|
+
/* Excluded from this release type: loggerToMonitoringContext */
|
|
209
|
+
|
|
210
|
+
/* Excluded from this release type: LoggingError */
|
|
211
|
+
|
|
212
|
+
/* Excluded from this release type: logIfFalse */
|
|
213
|
+
|
|
214
|
+
/* Excluded from this release type: mixinMonitoringContext */
|
|
215
|
+
|
|
216
|
+
/* Excluded from this release type: MockLogger */
|
|
217
|
+
|
|
218
|
+
/* Excluded from this release type: MonitoringContext */
|
|
219
|
+
|
|
220
|
+
/* Excluded from this release type: MultiSinkLoggerProperties */
|
|
221
|
+
|
|
222
|
+
/* Excluded from this release type: NORMALIZED_ERROR_TYPE */
|
|
223
|
+
|
|
224
|
+
/* Excluded from this release type: normalizeError */
|
|
225
|
+
|
|
226
|
+
/* Excluded from this release type: numberFromString */
|
|
227
|
+
|
|
228
|
+
/* Excluded from this release type: overwriteStack */
|
|
229
|
+
|
|
230
|
+
/* Excluded from this release type: PerformanceEvent */
|
|
231
|
+
|
|
232
|
+
/* Excluded from this release type: raiseConnectedEvent */
|
|
233
|
+
|
|
234
|
+
/* Excluded from this release type: safeRaiseEvent */
|
|
235
|
+
|
|
236
|
+
/* Excluded from this release type: SampledTelemetryHelper */
|
|
237
|
+
|
|
238
|
+
/* Excluded from this release type: sessionStorageConfigProvider */
|
|
239
|
+
|
|
240
|
+
/* Excluded from this release type: tagCodeArtifacts */
|
|
241
|
+
|
|
242
|
+
/* Excluded from this release type: tagData */
|
|
243
|
+
|
|
244
|
+
/* Excluded from this release type: TaggedLoggerAdapter */
|
|
245
|
+
|
|
246
|
+
/* Excluded from this release type: TelemetryDataTag */
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* The categories FF uses when instrumenting the code.
|
|
250
|
+
*
|
|
251
|
+
* generic - Informational log event
|
|
252
|
+
*
|
|
253
|
+
* error - Error log event, ideally 0 of these are logged during a session
|
|
254
|
+
*
|
|
255
|
+
* performance - Includes duration, and often has _start, _end, or _cancel suffixes for activity tracking
|
|
256
|
+
* @public
|
|
257
|
+
*/
|
|
258
|
+
export declare type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Property types that can be logged.
|
|
262
|
+
*
|
|
263
|
+
* @remarks
|
|
264
|
+
* Includes extra types beyond {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType}, which must be
|
|
265
|
+
* converted before sending to a base logger.
|
|
266
|
+
* @public
|
|
267
|
+
*/
|
|
268
|
+
export declare type TelemetryEventPropertyTypeExt = string | number | boolean | undefined | (string | number | boolean)[] | {
|
|
269
|
+
[key: string]: // Flat objects can have the same properties as the event itself
|
|
270
|
+
string | number | boolean | undefined | (string | number | boolean)[];
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* @alpha
|
|
275
|
+
*/
|
|
276
|
+
export declare type TelemetryEventPropertyTypes = ITelemetryBaseProperties[string];
|
|
277
|
+
|
|
278
|
+
/* Excluded from this release type: TelemetryNullLogger */
|
|
279
|
+
|
|
280
|
+
/* Excluded from this release type: ThresholdCounter */
|
|
281
|
+
|
|
282
|
+
/* Excluded from this release type: UsageError */
|
|
283
|
+
|
|
284
|
+
/* Excluded from this release type: validatePrecondition */
|
|
285
|
+
|
|
286
|
+
/* Excluded from this release type: wrapError */
|
|
287
|
+
|
|
288
|
+
/* Excluded from this release type: wrapErrorAndLog */
|
|
289
|
+
|
|
290
|
+
export { }
|
|
@@ -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 */
|
|
@@ -51,7 +49,7 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
|
51
49
|
* @privateRemarks
|
|
52
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.
|
|
53
51
|
* We should consider moving it to the `core-utils` package.
|
|
54
|
-
* @
|
|
52
|
+
* @public
|
|
55
53
|
*/
|
|
56
54
|
export declare class EventEmitterWithErrorHandling<TEvent extends IEvent = IEvent> extends TypedEventEmitter<TEvent> {
|
|
57
55
|
private readonly errorHandler;
|
|
@@ -79,8 +77,6 @@ export declare class EventEmitterWithErrorHandling<TEvent extends IEvent = IEven
|
|
|
79
77
|
|
|
80
78
|
/* Excluded from this release type: IConfigProvider */
|
|
81
79
|
|
|
82
|
-
/* Excluded from this release type: IConfigProviderBase */
|
|
83
|
-
|
|
84
80
|
/* Excluded from this release type: IEventSampler */
|
|
85
81
|
|
|
86
82
|
/* Excluded from this release type: IFluidErrorAnnotations */
|
|
@@ -110,7 +106,7 @@ export declare class EventEmitterWithErrorHandling<TEvent extends IEvent = IEven
|
|
|
110
106
|
/**
|
|
111
107
|
* Error telemetry event.
|
|
112
108
|
* @remarks Maps to category = "error"
|
|
113
|
-
* @
|
|
109
|
+
* @public
|
|
114
110
|
*/
|
|
115
111
|
export declare interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
|
|
116
112
|
eventName: string;
|
|
@@ -121,7 +117,7 @@ export declare interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt
|
|
|
121
117
|
/**
|
|
122
118
|
* Informational (non-error) telemetry event
|
|
123
119
|
* @remarks Maps to category = "generic"
|
|
124
|
-
* @
|
|
120
|
+
* @public
|
|
125
121
|
*/
|
|
126
122
|
export declare interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
127
123
|
eventName: string;
|
|
@@ -134,7 +130,7 @@ export declare interface ITelemetryGenericEventExt extends ITelemetryPropertiesE
|
|
|
134
130
|
* @remarks
|
|
135
131
|
* This interface is meant to be used internally within the Fluid Framework,
|
|
136
132
|
* and `ITelemetryBaseLogger` should be used when loggers are passed between layers.
|
|
137
|
-
* @
|
|
133
|
+
* @public
|
|
138
134
|
*/
|
|
139
135
|
export declare interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
140
136
|
/**
|
|
@@ -166,7 +162,7 @@ export declare interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
|
166
162
|
/**
|
|
167
163
|
* Performance telemetry event.
|
|
168
164
|
* @remarks Maps to category = "performance"
|
|
169
|
-
* @
|
|
165
|
+
* @public
|
|
170
166
|
*/
|
|
171
167
|
export declare interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {
|
|
172
168
|
duration?: number;
|
|
@@ -174,8 +170,7 @@ export declare interface ITelemetryPerformanceEventExt extends ITelemetryGeneric
|
|
|
174
170
|
|
|
175
171
|
/**
|
|
176
172
|
* JSON-serializable properties, which will be logged with telemetry.
|
|
177
|
-
*
|
|
178
|
-
* @alpha
|
|
173
|
+
* @public
|
|
179
174
|
*/
|
|
180
175
|
export declare interface ITelemetryPropertiesExt {
|
|
181
176
|
[index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;
|
|
@@ -235,7 +230,7 @@ export declare interface ITelemetryPropertiesExt {
|
|
|
235
230
|
* error - Error log event, ideally 0 of these are logged during a session
|
|
236
231
|
*
|
|
237
232
|
* performance - Includes duration, and often has _start, _end, or _cancel suffixes for activity tracking
|
|
238
|
-
* @
|
|
233
|
+
* @public
|
|
239
234
|
*/
|
|
240
235
|
export declare type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
241
236
|
|
|
@@ -245,8 +240,7 @@ export declare type TelemetryEventCategory = "generic" | "error" | "performance"
|
|
|
245
240
|
* @remarks
|
|
246
241
|
* Includes extra types beyond {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType}, which must be
|
|
247
242
|
* converted before sending to a base logger.
|
|
248
|
-
*
|
|
249
|
-
* @alpha
|
|
243
|
+
* @public
|
|
250
244
|
*/
|
|
251
245
|
export declare type TelemetryEventPropertyTypeExt = string | number | boolean | undefined | (string | number | boolean)[] | {
|
|
252
246
|
[key: string]: // Flat objects can have the same properties as the event itself
|
|
@@ -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 */
|