@fluidframework/telemetry-utils 2.0.0-internal.7.2.2 → 2.0.0-internal.7.4.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 +19 -0
- package/README.md +1 -2
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +3 -3
- package/api-report/telemetry-utils.api.md +66 -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 +16 -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/tsdoc-metadata.json +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 +16 -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 +36 -17
- 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/lib/logger.d.ts
CHANGED
|
@@ -13,7 +13,10 @@ export interface PerformanceWithMemory extends IsomorphicPerformance {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Broad classifications to be applied to individual properties as they're prepared to be logged to telemetry.
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
|
+
* @privateRemarks Please do not modify existing entries, to maintain backwards compatibility.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
17
20
|
*/
|
|
18
21
|
export declare enum TelemetryDataTag {
|
|
19
22
|
/**
|
|
@@ -25,22 +28,42 @@ export declare enum TelemetryDataTag {
|
|
|
25
28
|
*/
|
|
26
29
|
UserData = "UserData"
|
|
27
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
28
34
|
export type TelemetryEventPropertyTypes = ITelemetryBaseProperties[string];
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
29
38
|
export interface ITelemetryLoggerPropertyBag {
|
|
30
39
|
[index: string]: TelemetryEventPropertyTypes | (() => TelemetryEventPropertyTypes);
|
|
31
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
32
44
|
export interface ITelemetryLoggerPropertyBags {
|
|
33
45
|
all?: ITelemetryLoggerPropertyBag;
|
|
34
46
|
error?: ITelemetryLoggerPropertyBag;
|
|
35
47
|
}
|
|
36
48
|
/**
|
|
37
49
|
* Attempts to parse number from string.
|
|
38
|
-
* If fails,
|
|
50
|
+
* If it fails, it will return the original string.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
39
53
|
* Used to make telemetry data typed (and support math operations, like comparison),
|
|
40
|
-
* in places where we do expect numbers (like contentsize/duration property in http header)
|
|
54
|
+
* in places where we do expect numbers (like contentsize/duration property in http header).
|
|
55
|
+
*
|
|
56
|
+
* @internal
|
|
41
57
|
*/
|
|
42
58
|
export declare function numberFromString(str: string | null | undefined): string | number | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
43
62
|
export declare function formatTick(tick: number): number;
|
|
63
|
+
/**
|
|
64
|
+
* String used to concatenate the namespace of parent loggers and their child loggers.
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
44
67
|
export declare const eventNamespaceSeparator: ":";
|
|
45
68
|
/**
|
|
46
69
|
* TelemetryLogger class contains various helper telemetry methods,
|
|
@@ -50,6 +73,9 @@ export declare const eventNamespaceSeparator: ":";
|
|
|
50
73
|
export declare abstract class TelemetryLogger implements ITelemetryLoggerExt {
|
|
51
74
|
protected readonly namespace?: string | undefined;
|
|
52
75
|
protected readonly properties?: ITelemetryLoggerPropertyBags | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* {@inheritDoc eventNamespaceSeparator}
|
|
78
|
+
*/
|
|
53
79
|
static readonly eventNamespaceSeparator: ":";
|
|
54
80
|
static sanitizePkgName(name: string): string;
|
|
55
81
|
/**
|
|
@@ -109,6 +135,8 @@ export declare abstract class TelemetryLogger implements ITelemetryLoggerExt {
|
|
|
109
135
|
* @deprecated 0.56, remove TaggedLoggerAdapter once its usage is removed from
|
|
110
136
|
* container-runtime. Issue: #8191
|
|
111
137
|
* TaggedLoggerAdapter class can add tag handling to your logger.
|
|
138
|
+
*
|
|
139
|
+
* @internal
|
|
112
140
|
*/
|
|
113
141
|
export declare class TaggedLoggerAdapter implements ITelemetryBaseLogger {
|
|
114
142
|
private readonly logger;
|
|
@@ -119,11 +147,14 @@ export declare class TaggedLoggerAdapter implements ITelemetryBaseLogger {
|
|
|
119
147
|
send(eventWithTagsMaybe: ITelemetryBaseEvent): void;
|
|
120
148
|
}
|
|
121
149
|
/**
|
|
122
|
-
* Create a child logger based on the provided props object
|
|
123
|
-
* @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.
|
|
150
|
+
* Create a child logger based on the provided props object.
|
|
124
151
|
*
|
|
125
152
|
* @remarks
|
|
126
153
|
* Passing in no props object (i.e. undefined) will return a logger that is effectively a no-op.
|
|
154
|
+
*
|
|
155
|
+
* @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.
|
|
156
|
+
*
|
|
157
|
+
* @internal
|
|
127
158
|
*/
|
|
128
159
|
export declare function createChildLogger(props?: {
|
|
129
160
|
logger?: ITelemetryBaseLogger;
|
|
@@ -133,7 +164,7 @@ export declare function createChildLogger(props?: {
|
|
|
133
164
|
/**
|
|
134
165
|
* ChildLogger class contains various helper telemetry methods,
|
|
135
166
|
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
136
|
-
* Creates sub-logger that appends properties to all events
|
|
167
|
+
* Creates sub-logger that appends properties to all events.
|
|
137
168
|
*/
|
|
138
169
|
export declare class ChildLogger extends TelemetryLogger {
|
|
139
170
|
protected readonly baseLogger: ITelemetryBaseLogger;
|
|
@@ -156,16 +187,34 @@ export declare class ChildLogger extends TelemetryLogger {
|
|
|
156
187
|
send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
|
|
157
188
|
}
|
|
158
189
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
190
|
+
* Input properties for {@link createMultiSinkLogger}.
|
|
191
|
+
*
|
|
192
|
+
* @internal
|
|
162
193
|
*/
|
|
163
|
-
export
|
|
194
|
+
export interface MultiSinkLoggerProperties {
|
|
195
|
+
/**
|
|
196
|
+
* Will be prefixed to all event names.
|
|
197
|
+
*/
|
|
164
198
|
namespace?: string;
|
|
199
|
+
/**
|
|
200
|
+
* Default properties that will be applied to all events flowing through this logger.
|
|
201
|
+
*/
|
|
165
202
|
properties?: ITelemetryLoggerPropertyBags;
|
|
203
|
+
/**
|
|
204
|
+
* The base loggers that this logger will forward the logs to, after it processes them.
|
|
205
|
+
*/
|
|
166
206
|
loggers?: (ITelemetryBaseLogger | undefined)[];
|
|
207
|
+
/**
|
|
208
|
+
* 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.
|
|
209
|
+
*/
|
|
167
210
|
tryInheritProperties?: true;
|
|
168
|
-
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Create a logger which logs to multiple other loggers based on the provided props object.
|
|
214
|
+
*
|
|
215
|
+
* @internal
|
|
216
|
+
*/
|
|
217
|
+
export declare function createMultiSinkLogger(props: MultiSinkLoggerProperties): ITelemetryLoggerExt;
|
|
169
218
|
/**
|
|
170
219
|
* Multi-sink logger
|
|
171
220
|
* Takes multiple ITelemetryBaseLogger objects (sinks) and logs all events into each sink
|
|
@@ -196,10 +245,15 @@ export declare class MultiSinkLogger extends TelemetryLogger {
|
|
|
196
245
|
send(event: ITelemetryBaseEvent): void;
|
|
197
246
|
}
|
|
198
247
|
/**
|
|
199
|
-
* Describes what events PerformanceEvent should log
|
|
200
|
-
*
|
|
201
|
-
*
|
|
248
|
+
* Describes what events {@link PerformanceEvent} should log.
|
|
249
|
+
*
|
|
250
|
+
* @remarks
|
|
251
|
+
* By default, all events are logged, but the client can override this behavior.
|
|
252
|
+
*
|
|
253
|
+
* For example, there is rarely a need to record a start event, as we're really after
|
|
202
254
|
* success / failure tracking, including duration (on success).
|
|
255
|
+
*
|
|
256
|
+
* @internal
|
|
203
257
|
*/
|
|
204
258
|
export interface IPerformanceEventMarkers {
|
|
205
259
|
start?: true;
|
|
@@ -207,7 +261,9 @@ export interface IPerformanceEventMarkers {
|
|
|
207
261
|
cancel?: "generic" | "error";
|
|
208
262
|
}
|
|
209
263
|
/**
|
|
210
|
-
* Helper class to log performance events
|
|
264
|
+
* Helper class to log performance events.
|
|
265
|
+
*
|
|
266
|
+
* @internal
|
|
211
267
|
*/
|
|
212
268
|
export declare class PerformanceEvent {
|
|
213
269
|
private readonly logger;
|
|
@@ -278,10 +334,13 @@ export declare class PerformanceEvent {
|
|
|
278
334
|
}
|
|
279
335
|
/**
|
|
280
336
|
* Null logger that no-ops for all telemetry events passed to it.
|
|
337
|
+
*
|
|
281
338
|
* @deprecated This will be removed in a future release.
|
|
282
339
|
* For internal use within the FluidFramework codebase, use {@link createChildLogger} with no arguments instead.
|
|
283
340
|
* For external consumers we recommend writing a trivial implementation of {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}
|
|
284
341
|
* where the send() method does nothing and using that.
|
|
342
|
+
*
|
|
343
|
+
* @internal
|
|
285
344
|
*/
|
|
286
345
|
export declare class TelemetryNullLogger implements ITelemetryLoggerExt {
|
|
287
346
|
send(event: ITelemetryBaseEvent): void;
|
|
@@ -299,6 +358,28 @@ export declare class TelemetryNullLogger implements ITelemetryLoggerExt {
|
|
|
299
358
|
* @param x - value passed in to convert to a base property type
|
|
300
359
|
*/
|
|
301
360
|
export declare function convertToBasePropertyType(x: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>): TelemetryEventPropertyType | Tagged<TelemetryEventPropertyType>;
|
|
361
|
+
/**
|
|
362
|
+
* Tags all given `values` with the same `tag`.
|
|
363
|
+
*
|
|
364
|
+
* @param tag - The tag with which all `values` will be annotated.
|
|
365
|
+
* @param values - The values to be tagged.
|
|
366
|
+
*
|
|
367
|
+
* @remarks
|
|
368
|
+
* It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
|
|
369
|
+
* as well as callbacks that return that type.
|
|
370
|
+
*
|
|
371
|
+
* @example Sample usage
|
|
372
|
+
* ```typescript
|
|
373
|
+
* {
|
|
374
|
+
* // ...Other properties being added to a telemetry event
|
|
375
|
+
* ...tagData("someTag", {foo: 1, bar: 2}),
|
|
376
|
+
* // ...
|
|
377
|
+
* }
|
|
378
|
+
* ```
|
|
379
|
+
* This will result in `foo` and `bar` added to the event with their values tagged.
|
|
380
|
+
*
|
|
381
|
+
* @internal
|
|
382
|
+
*/
|
|
302
383
|
export declare const tagData: <T extends TelemetryDataTag, V extends Record<string, import("@fluidframework/core-interfaces").TelemetryEventPropertyType | (() => TelemetryBaseEventPropertyType)>>(tag: T, values: V) => { [P in keyof V]: (V[P] extends () => TelemetryBaseEventPropertyType ? () => {
|
|
303
384
|
value: ReturnType<V[P]>;
|
|
304
385
|
tag: T;
|
|
@@ -307,8 +388,27 @@ export declare const tagData: <T extends TelemetryDataTag, V extends Record<stri
|
|
|
307
388
|
tag: T;
|
|
308
389
|
}) | (V[P] extends undefined ? undefined : never); };
|
|
309
390
|
/**
|
|
310
|
-
*
|
|
311
|
-
*
|
|
391
|
+
* Tags all provided `values` as {@link TelemetryDataTag.CodeArtifact}.
|
|
392
|
+
*
|
|
393
|
+
* @param values - The values to be tagged.
|
|
394
|
+
*
|
|
395
|
+
* @remarks
|
|
396
|
+
* It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
|
|
397
|
+
* as well as callbacks that return that type.
|
|
398
|
+
*
|
|
399
|
+
* @example Sample usage
|
|
400
|
+
* ```typescript
|
|
401
|
+
* {
|
|
402
|
+
* // ...Other properties being added to a telemetry event
|
|
403
|
+
* ...tagCodeArtifacts("someTag", {foo: 1, bar: 2}),
|
|
404
|
+
* // ...
|
|
405
|
+
* }
|
|
406
|
+
* ```
|
|
407
|
+
* This will result in `foo` and `bar` added to the event with their values tagged as {@link TelemetryDataTag.CodeArtifact}.
|
|
408
|
+
*
|
|
409
|
+
* @see {@link tagData}
|
|
410
|
+
*
|
|
411
|
+
* @internal
|
|
312
412
|
*/
|
|
313
413
|
export declare const tagCodeArtifacts: <T extends Record<string, import("@fluidframework/core-interfaces").TelemetryEventPropertyType | (() => TelemetryBaseEventPropertyType)>>(values: T) => { [P in keyof T]: (T[P] extends () => TelemetryBaseEventPropertyType ? () => {
|
|
314
414
|
value: ReturnType<T[P]>;
|
package/lib/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,8BAA8B,IAAI,0BAA0B,EAC5D,QAAQ,EACR,MAAM,EACN,wBAAwB,EACxB,8BAA8B,EAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAe,MAAM,8BAA8B,CAA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AAC,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAOlE;;OAEG;IACI,WAAW,CACjB,eAAe,EAAE,MAAM,EACvB,KAAK,CAAC,EAAE,oBAAoB,EAC5B,KAAK,CAAC,EAAE,OAAO,GACb,IAAI;IAkCP,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAA6B;IAC9D,OAAO,CAAC,MAAM,CAAC,YAAY;CAM3B;AAED;;;;;;;;;GASG;AACH,qBAAa,mBAAoB,YAAW,mBAAmB;IACvD,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;IACtC,kBAAkB,CAAC,KAAK,EAAE,sBAAsB,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IACxE,cAAc,CAAC,KAAK,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAClE,oBAAoB,CAAC,KAAK,EAAE,0BAA0B,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;CACrF;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACxC,CAAC,EAAE,6BAA6B,GAAG,MAAM,CAAC,6BAA6B,CAAC,GACtE,0BAA0B,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAOjE;AA0BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,OAAO,sIAIsB,8BAA8B,gEAOhD,8BAA8B;;;;;;oDA4BhB,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,gBAAgB,0GAGa,8BAA8B,wDAMhD,8BAA8B;;SAG3C,iBAAiB,YAAY;;;SAI7B,iBAAiB,YAAY;oDAG6C,CAAC"}
|
package/lib/logger.js
CHANGED
|
@@ -8,7 +8,10 @@ import { CachedConfigProvider, loggerIsMonitoringContext, mixinMonitoringContext
|
|
|
8
8
|
import { isILoggingError, extractLogSafeErrorProperties, generateStack, isTaggedTelemetryPropertyValue, } from "./errorLogging";
|
|
9
9
|
/**
|
|
10
10
|
* Broad classifications to be applied to individual properties as they're prepared to be logged to telemetry.
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
|
+
* @privateRemarks Please do not modify existing entries, to maintain backwards compatibility.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
12
15
|
*/
|
|
13
16
|
export var TelemetryDataTag;
|
|
14
17
|
(function (TelemetryDataTag) {
|
|
@@ -23,9 +26,13 @@ export var TelemetryDataTag;
|
|
|
23
26
|
})(TelemetryDataTag || (TelemetryDataTag = {}));
|
|
24
27
|
/**
|
|
25
28
|
* Attempts to parse number from string.
|
|
26
|
-
* If fails,
|
|
29
|
+
* If it fails, it will return the original string.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
27
32
|
* Used to make telemetry data typed (and support math operations, like comparison),
|
|
28
|
-
* in places where we do expect numbers (like contentsize/duration property in http header)
|
|
33
|
+
* in places where we do expect numbers (like contentsize/duration property in http header).
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
29
36
|
*/
|
|
30
37
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
31
38
|
export function numberFromString(str) {
|
|
@@ -35,9 +42,18 @@ export function numberFromString(str) {
|
|
|
35
42
|
const num = Number(str);
|
|
36
43
|
return Number.isNaN(num) ? str : num;
|
|
37
44
|
}
|
|
45
|
+
// TODO: add docs
|
|
46
|
+
// eslint-disable-next-line jsdoc/require-description
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
38
50
|
export function formatTick(tick) {
|
|
39
51
|
return Math.floor(tick);
|
|
40
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* String used to concatenate the namespace of parent loggers and their child loggers.
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
41
57
|
export const eventNamespaceSeparator = ":";
|
|
42
58
|
/**
|
|
43
59
|
* TelemetryLogger class contains various helper telemetry methods,
|
|
@@ -177,11 +193,16 @@ export class TelemetryLogger {
|
|
|
177
193
|
return toExtend;
|
|
178
194
|
}
|
|
179
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* {@inheritDoc eventNamespaceSeparator}
|
|
198
|
+
*/
|
|
180
199
|
TelemetryLogger.eventNamespaceSeparator = eventNamespaceSeparator;
|
|
181
200
|
/**
|
|
182
201
|
* @deprecated 0.56, remove TaggedLoggerAdapter once its usage is removed from
|
|
183
202
|
* container-runtime. Issue: #8191
|
|
184
203
|
* TaggedLoggerAdapter class can add tag handling to your logger.
|
|
204
|
+
*
|
|
205
|
+
* @internal
|
|
185
206
|
*/
|
|
186
207
|
export class TaggedLoggerAdapter {
|
|
187
208
|
constructor(logger) {
|
|
@@ -231,11 +252,14 @@ export class TaggedLoggerAdapter {
|
|
|
231
252
|
}
|
|
232
253
|
}
|
|
233
254
|
/**
|
|
234
|
-
* Create a child logger based on the provided props object
|
|
235
|
-
* @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.
|
|
255
|
+
* Create a child logger based on the provided props object.
|
|
236
256
|
*
|
|
237
257
|
* @remarks
|
|
238
258
|
* Passing in no props object (i.e. undefined) will return a logger that is effectively a no-op.
|
|
259
|
+
*
|
|
260
|
+
* @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.
|
|
261
|
+
*
|
|
262
|
+
* @internal
|
|
239
263
|
*/
|
|
240
264
|
export function createChildLogger(props) {
|
|
241
265
|
return ChildLogger.create(props?.logger, props?.namespace, props?.properties);
|
|
@@ -243,7 +267,7 @@ export function createChildLogger(props) {
|
|
|
243
267
|
/**
|
|
244
268
|
* ChildLogger class contains various helper telemetry methods,
|
|
245
269
|
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
246
|
-
* Creates sub-logger that appends properties to all events
|
|
270
|
+
* Creates sub-logger that appends properties to all events.
|
|
247
271
|
*/
|
|
248
272
|
export class ChildLogger extends TelemetryLogger {
|
|
249
273
|
/**
|
|
@@ -317,9 +341,9 @@ export class ChildLogger extends TelemetryLogger {
|
|
|
317
341
|
}
|
|
318
342
|
}
|
|
319
343
|
/**
|
|
320
|
-
* Create a logger which logs to multiple other loggers based on the provided props object
|
|
321
|
-
*
|
|
322
|
-
*
|
|
344
|
+
* Create a logger which logs to multiple other loggers based on the provided props object.
|
|
345
|
+
*
|
|
346
|
+
* @internal
|
|
323
347
|
*/
|
|
324
348
|
export function createMultiSinkLogger(props) {
|
|
325
349
|
return new MultiSinkLogger(props.namespace, props.properties, props.loggers?.filter((l) => l !== undefined), props.tryInheritProperties);
|
|
@@ -393,7 +417,9 @@ export class MultiSinkLogger extends TelemetryLogger {
|
|
|
393
417
|
}
|
|
394
418
|
}
|
|
395
419
|
/**
|
|
396
|
-
* Helper class to log performance events
|
|
420
|
+
* Helper class to log performance events.
|
|
421
|
+
*
|
|
422
|
+
* @internal
|
|
397
423
|
*/
|
|
398
424
|
export class PerformanceEvent {
|
|
399
425
|
/**
|
|
@@ -556,10 +582,13 @@ export class PerformanceEvent {
|
|
|
556
582
|
PerformanceEvent.eventHits = new Map();
|
|
557
583
|
/**
|
|
558
584
|
* Null logger that no-ops for all telemetry events passed to it.
|
|
585
|
+
*
|
|
559
586
|
* @deprecated This will be removed in a future release.
|
|
560
587
|
* For internal use within the FluidFramework codebase, use {@link createChildLogger} with no arguments instead.
|
|
561
588
|
* For external consumers we recommend writing a trivial implementation of {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}
|
|
562
589
|
* where the send() method does nothing and using that.
|
|
590
|
+
*
|
|
591
|
+
* @internal
|
|
563
592
|
*/
|
|
564
593
|
export class TelemetryNullLogger {
|
|
565
594
|
send(event) { }
|
|
@@ -615,6 +644,28 @@ function convertToBasePropertyTypeUntagged(x) {
|
|
|
615
644
|
}
|
|
616
645
|
}
|
|
617
646
|
}
|
|
647
|
+
/**
|
|
648
|
+
* Tags all given `values` with the same `tag`.
|
|
649
|
+
*
|
|
650
|
+
* @param tag - The tag with which all `values` will be annotated.
|
|
651
|
+
* @param values - The values to be tagged.
|
|
652
|
+
*
|
|
653
|
+
* @remarks
|
|
654
|
+
* It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
|
|
655
|
+
* as well as callbacks that return that type.
|
|
656
|
+
*
|
|
657
|
+
* @example Sample usage
|
|
658
|
+
* ```typescript
|
|
659
|
+
* {
|
|
660
|
+
* // ...Other properties being added to a telemetry event
|
|
661
|
+
* ...tagData("someTag", {foo: 1, bar: 2}),
|
|
662
|
+
* // ...
|
|
663
|
+
* }
|
|
664
|
+
* ```
|
|
665
|
+
* This will result in `foo` and `bar` added to the event with their values tagged.
|
|
666
|
+
*
|
|
667
|
+
* @internal
|
|
668
|
+
*/
|
|
618
669
|
export const tagData = (tag, values) =>
|
|
619
670
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
620
671
|
Object.entries(values)
|
|
@@ -636,8 +687,27 @@ Object.entries(values)
|
|
|
636
687
|
return pv;
|
|
637
688
|
}, {});
|
|
638
689
|
/**
|
|
639
|
-
*
|
|
640
|
-
*
|
|
690
|
+
* Tags all provided `values` as {@link TelemetryDataTag.CodeArtifact}.
|
|
691
|
+
*
|
|
692
|
+
* @param values - The values to be tagged.
|
|
693
|
+
*
|
|
694
|
+
* @remarks
|
|
695
|
+
* It supports properties of type {@link @fluidframework/core-interfaces#TelemetryBaseEventPropertyType},
|
|
696
|
+
* as well as callbacks that return that type.
|
|
697
|
+
*
|
|
698
|
+
* @example Sample usage
|
|
699
|
+
* ```typescript
|
|
700
|
+
* {
|
|
701
|
+
* // ...Other properties being added to a telemetry event
|
|
702
|
+
* ...tagCodeArtifacts("someTag", {foo: 1, bar: 2}),
|
|
703
|
+
* // ...
|
|
704
|
+
* }
|
|
705
|
+
* ```
|
|
706
|
+
* This will result in `foo` and `bar` added to the event with their values tagged as {@link TelemetryDataTag.CodeArtifact}.
|
|
707
|
+
*
|
|
708
|
+
* @see {@link tagData}
|
|
709
|
+
*
|
|
710
|
+
* @internal
|
|
641
711
|
*/
|
|
642
712
|
export const tagCodeArtifacts = (values) => tagData(TelemetryDataTag.CodeArtifact, values);
|
|
643
713
|
//# sourceMappingURL=logger.js.map
|