@fluidframework/telemetry-utils 2.92.0 → 2.100.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 +26 -0
- package/DEV.md +33 -0
- package/README.md +1 -1
- package/api-extractor/api-extractor-lint-api-bundle.json +5 -0
- package/api-extractor/api-extractor-lint-bundle.json +1 -1
- package/api-extractor.json +2 -1
- package/api-report/telemetry-utils.legacy.beta.api.md +8 -5
- package/dist/api.d.ts +26 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +40 -0
- package/dist/api.js.map +1 -0
- package/dist/config.d.ts +6 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/errorLogging.d.ts +2 -2
- package/dist/errorLogging.d.ts.map +1 -1
- package/dist/errorLogging.js.map +1 -1
- package/dist/events.d.ts +3 -3
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js.map +1 -1
- package/dist/{index.d.ts → internal.d.ts} +16 -4
- package/dist/internal.d.ts.map +1 -0
- package/dist/{index.js → internal.js} +22 -5
- package/dist/internal.js.map +1 -0
- package/dist/legacy.d.ts +2 -2
- package/dist/logger.d.ts +45 -10
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +43 -5
- package/dist/logger.js.map +1 -1
- package/dist/main.d.ts +8 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +13 -0
- package/dist/main.js.map +1 -0
- package/dist/mockLogger.d.ts +5 -4
- package/dist/mockLogger.d.ts.map +1 -1
- package/dist/mockLogger.js.map +1 -1
- package/dist/public.d.ts +1 -1
- package/dist/sampledTelemetryHelper.d.ts +2 -2
- package/dist/sampledTelemetryHelper.d.ts.map +1 -1
- package/dist/sampledTelemetryHelper.js.map +1 -1
- package/dist/telemetryEventBatcher.d.ts +2 -2
- package/dist/telemetryEventBatcher.d.ts.map +1 -1
- package/dist/telemetryEventBatcher.js.map +1 -1
- package/dist/telemetryTypes.d.ts +58 -3
- package/dist/telemetryTypes.d.ts.map +1 -1
- package/dist/telemetryTypes.js.map +1 -1
- package/dist/telemetryTypesUndeprecated.d.ts +36 -0
- package/dist/telemetryTypesUndeprecated.d.ts.map +1 -0
- package/dist/telemetryTypesUndeprecated.js +7 -0
- package/dist/telemetryTypesUndeprecated.js.map +1 -0
- package/dist/thresholdCounter.d.ts +2 -2
- package/dist/thresholdCounter.d.ts.map +1 -1
- package/dist/thresholdCounter.js.map +1 -1
- package/dist/utils.d.ts +4 -4
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/eslint.config.mts +1 -1
- package/internal.d.ts +2 -2
- package/legacy.d.ts +1 -1
- package/lib/api.d.ts +26 -0
- package/lib/api.d.ts.map +1 -0
- package/lib/api.js +22 -0
- package/lib/api.js.map +1 -0
- package/lib/config.d.ts +6 -6
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +2 -0
- package/lib/config.js.map +1 -1
- package/lib/errorLogging.d.ts +2 -2
- package/lib/errorLogging.d.ts.map +1 -1
- package/lib/errorLogging.js.map +1 -1
- package/lib/events.d.ts +3 -3
- package/lib/events.d.ts.map +1 -1
- package/lib/events.js.map +1 -1
- package/lib/{index.d.ts → internal.d.ts} +16 -4
- package/lib/internal.d.ts.map +1 -0
- package/lib/{index.js → internal.js} +5 -3
- package/lib/internal.js.map +1 -0
- package/lib/legacy.d.ts +2 -2
- package/lib/logger.d.ts +45 -10
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +40 -4
- package/lib/logger.js.map +1 -1
- package/lib/main.d.ts +8 -0
- package/lib/main.d.ts.map +1 -0
- package/lib/main.js +9 -0
- package/lib/main.js.map +1 -0
- package/lib/mockLogger.d.ts +5 -4
- package/lib/mockLogger.d.ts.map +1 -1
- package/lib/mockLogger.js.map +1 -1
- package/lib/public.d.ts +1 -1
- package/lib/sampledTelemetryHelper.d.ts +2 -2
- package/lib/sampledTelemetryHelper.d.ts.map +1 -1
- package/lib/sampledTelemetryHelper.js.map +1 -1
- package/lib/telemetryEventBatcher.d.ts +2 -2
- package/lib/telemetryEventBatcher.d.ts.map +1 -1
- package/lib/telemetryEventBatcher.js.map +1 -1
- package/lib/telemetryTypes.d.ts +58 -3
- package/lib/telemetryTypes.d.ts.map +1 -1
- package/lib/telemetryTypes.js.map +1 -1
- package/lib/telemetryTypesUndeprecated.d.ts +36 -0
- package/lib/telemetryTypesUndeprecated.d.ts.map +1 -0
- package/lib/telemetryTypesUndeprecated.js +6 -0
- package/lib/telemetryTypesUndeprecated.js.map +1 -0
- package/lib/thresholdCounter.d.ts +2 -2
- package/lib/thresholdCounter.d.ts.map +1 -1
- package/lib/thresholdCounter.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/utils.d.ts +4 -4
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +25 -24
- package/src/api.ts +44 -0
- package/src/config.ts +17 -11
- package/src/errorLogging.ts +2 -2
- package/src/events.ts +3 -3
- package/src/{index.ts → internal.ts} +23 -8
- package/src/logger.ts +74 -15
- package/src/main.ts +19 -0
- package/src/mockLogger.ts +4 -4
- package/src/sampledTelemetryHelper.ts +3 -3
- package/src/telemetryEventBatcher.ts +3 -3
- package/src/telemetryTypes.ts +69 -3
- package/src/telemetryTypesUndeprecated.ts +51 -0
- package/src/thresholdCounter.ts +2 -2
- package/src/utils.ts +7 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetryEventBatcher.js","sourceRoot":"","sources":["../src/telemetryEventBatcher.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAAsD;AAOtD;;;;;;;;;;GAUG;AACH,MAAa,qBAAqB;IAgBjC;IACC;;OAEG;IACc,SAAoC;IAEr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G,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAe,EAAE,CAAC;YAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC3B,cAAc,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,IAAA,mCAAoB,EAAC,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAChF,CAAC;YACD,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;gBACvC,cAAc,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YACpD,CAAC;QACF,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;QAEjD,kCAAkC;QAClC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACrB,CAAC;CACD;AA5ED,sDA4EC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { roundToDecimalPlaces } from \"./mathTools.js\";\nimport type {\n\tITelemetryGenericEventExt,\n\tTelemetryLoggerExt,\n\tITelemetryPerformanceEventExt,\n} from \"./telemetryTypesUndeprecated.js\";\n\n/**\n * Telemetry class that accumulates measurements which are eventually logged in a telemetry event through the provided\n * {@link TelemetryEventBatcher.logger | logger} when the number of calls to the function reaches the specified {@link TelemetryEventBatcher.threshold | threshold}.\n *\n * @remarks It is expected to be used for a single event type. If different properties should be logged at different times, a separate `TelemetryEventBatcher` should be created with separate `TMetrics` type.\n * @typeparam TMetrics - The set of keys that should be logged.\n * E.g., `keyof Foo` for logging properties `bar` and `baz` from `type Foo = { bar: number, baz: number }`.\n *\n * @sealed\n * @internal\n */\nexport class TelemetryEventBatcher<TMetrics extends string> {\n\t/**\n\t * Stores the sum of the custom data passed into the logger.\n\t */\n\tprivate dataSums: Partial<Record<TMetrics, number>> = {};\n\n\t/**\n\t * Stores the maximum value of the custom data passed into the logger.\n\t */\n\tprivate dataMaxes: Partial<Record<TMetrics, number>> = {};\n\n\t/**\n\t * Counter to keep track of the number of times the log function is called.\n\t */\n\tprivate counter = 0;\n\n\tpublic constructor(\n\t\t/**\n\t\t * Custom properties to include in the telemetry performance event when it is written.\n\t\t */\n\t\tprivate readonly eventBase: ITelemetryGenericEventExt,\n\n\t\t/**\n\t\t * The logger to use to write the telemetry performance event.\n\t\t */\n\t\tprivate readonly logger: TelemetryLoggerExt,\n\n\t\t/**\n\t\t * The number of logs to accumulate before sending the data to the logger.\n\t\t */\n\t\tprivate readonly threshold: number,\n\t) {}\n\n\t/**\n\t * Accumulates the custom data and sends it to the logger every {@link TelemetryEventBatcher.threshold} calls.\n\t *\n\t * @param customData - A record storing the custom data to be accumulated and eventually logged.\n\t */\n\tpublic accumulateAndLog(customData: Record<TMetrics, number>): void {\n\t\tfor (const key of Object.keys(customData) as TMetrics[]) {\n\t\t\tthis.dataSums[key] = (this.dataSums[key] ?? 0) + customData[key];\n\t\t\tthis.dataMaxes[key] = Math.max(\n\t\t\t\tthis.dataMaxes[key] ?? Number.NEGATIVE_INFINITY,\n\t\t\t\tcustomData[key],\n\t\t\t);\n\t\t}\n\n\t\tthis.counter++;\n\n\t\tif (this.counter >= this.threshold) {\n\t\t\tthis.sendData();\n\t\t}\n\t}\n\n\tprivate sendData(): void {\n\t\tconst telemetryEvent: ITelemetryPerformanceEventExt = {\n\t\t\t...this.eventBase,\n\t\t};\n\n\t\tfor (const key of Object.keys(this.dataSums) as TMetrics[]) {\n\t\t\tconst dataSum = this.dataSums[key];\n\t\t\tif (dataSum !== undefined) {\n\t\t\t\ttelemetryEvent[`avg_${key}`] = roundToDecimalPlaces(dataSum / this.counter, 6);\n\t\t\t}\n\t\t\tif (this.dataMaxes[key] !== undefined) {\n\t\t\t\ttelemetryEvent[`max_${key}`] = this.dataMaxes[key];\n\t\t\t}\n\t\t}\n\n\t\tthis.logger.sendPerformanceEvent(telemetryEvent);\n\n\t\t// Reset the counter and the data.\n\t\tthis.counter = 0;\n\t\tthis.dataSums = {};\n\t\tthis.dataMaxes = {};\n\t}\n}\n"]}
|
package/dist/telemetryTypes.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ import type { ITelemetryBaseLogger, LogLevel, Tagged } from "@fluidframework/cor
|
|
|
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
|
+
* @deprecated This type is being removed without a replacement.
|
|
15
|
+
* @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.
|
|
14
16
|
* @legacy @beta
|
|
15
17
|
*/
|
|
16
18
|
export type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
@@ -49,6 +51,8 @@ export interface ITelemetryEventExt extends ITelemetryPropertiesExt {
|
|
|
49
51
|
/**
|
|
50
52
|
* Informational (non-error) telemetry event
|
|
51
53
|
* @remarks Maps to category = "generic"
|
|
54
|
+
* @deprecated This type is being removed without a replacement.
|
|
55
|
+
* @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.
|
|
52
56
|
* @legacy @beta
|
|
53
57
|
*/
|
|
54
58
|
export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
@@ -65,6 +69,8 @@ export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
|
65
69
|
/**
|
|
66
70
|
* Error telemetry event.
|
|
67
71
|
* @remarks Maps to category = "error"
|
|
72
|
+
* @deprecated This type is being removed without a replacement.
|
|
73
|
+
* @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.
|
|
68
74
|
* @legacy @beta
|
|
69
75
|
*/
|
|
70
76
|
export interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
|
|
@@ -76,6 +82,8 @@ export interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
|
|
|
76
82
|
/**
|
|
77
83
|
* Performance telemetry event.
|
|
78
84
|
* @remarks Maps to category = "performance"
|
|
85
|
+
* @deprecated This type is being removed without a replacement.
|
|
86
|
+
* @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.
|
|
79
87
|
* @legacy @beta
|
|
80
88
|
*/
|
|
81
89
|
export interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {
|
|
@@ -84,15 +92,62 @@ export interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt
|
|
|
84
92
|
*/
|
|
85
93
|
duration?: number;
|
|
86
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* This is the externally facing type for a FluidFramework internal telemetry logger wrapper.
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
* The methods if this interface are not to be used directly by consumers and are all
|
|
100
|
+
* deprecated to removed without replacement. This type is not deprecated and will
|
|
101
|
+
* transition to an erased type to handle cases where "internal" `ITelemetryLoggerExt`
|
|
102
|
+
* previously leaked out.
|
|
103
|
+
*
|
|
104
|
+
* @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for deprecation and breaking change details.
|
|
105
|
+
*
|
|
106
|
+
* @privateRemarks
|
|
107
|
+
* External APIs taking in an `ITelemetryLoggerExt` ideally should be updated to
|
|
108
|
+
* accept `ITelemetryBaseLogger` instead.
|
|
109
|
+
*
|
|
110
|
+
* @sealed
|
|
111
|
+
* @legacy
|
|
112
|
+
* @beta
|
|
113
|
+
*/
|
|
114
|
+
export interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
115
|
+
/**
|
|
116
|
+
* Send an information telemetry event.
|
|
117
|
+
* @param event - Event to send.
|
|
118
|
+
* @param error - Optional error object to log.
|
|
119
|
+
* @param logLevel - Optional level of the log. Default: {@link @fluidframework/core-interfaces#LogLevel.essential}.
|
|
120
|
+
* @deprecated This method is being removed without a replacement.
|
|
121
|
+
* @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.
|
|
122
|
+
*/
|
|
123
|
+
sendTelemetryEvent(event: ITelemetryGenericEventExt, error?: unknown, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
124
|
+
/**
|
|
125
|
+
* Send an error telemetry event.
|
|
126
|
+
* @param event - Event to send.
|
|
127
|
+
* @param error - Optional error object to log.
|
|
128
|
+
* @deprecated This method is being removed without a replacement.
|
|
129
|
+
* @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.
|
|
130
|
+
*/
|
|
131
|
+
sendErrorEvent(event: ITelemetryErrorEventExt, error?: unknown): void;
|
|
132
|
+
/**
|
|
133
|
+
* Send a performance telemetry event.
|
|
134
|
+
* @param event - Event to send
|
|
135
|
+
* @param error - Optional error object to log.
|
|
136
|
+
* @param logLevel - Optional level of the log. Default: {@link @fluidframework/core-interfaces#LogLevel.essential}.
|
|
137
|
+
* @deprecated This method is being removed without a replacement.
|
|
138
|
+
* @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.
|
|
139
|
+
*/
|
|
140
|
+
sendPerformanceEvent(event: ITelemetryPerformanceEventExt, error?: unknown, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
141
|
+
}
|
|
87
142
|
/**
|
|
88
143
|
* An extended {@link @fluidframework/core-interfaces#ITelemetryBaseLogger} which allows for more lenient event types.
|
|
89
144
|
*
|
|
90
145
|
* @remarks
|
|
91
146
|
* This interface is meant to be used internally within the Fluid Framework,
|
|
92
147
|
* and `ITelemetryBaseLogger` should be used when loggers are passed between layers.
|
|
93
|
-
* @
|
|
148
|
+
* @internal
|
|
94
149
|
*/
|
|
95
|
-
export interface
|
|
150
|
+
export interface TelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
96
151
|
/**
|
|
97
152
|
* Send an information telemetry event.
|
|
98
153
|
* @param event - Event to send.
|
|
@@ -110,7 +165,7 @@ export interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
|
110
165
|
* Send a performance telemetry event.
|
|
111
166
|
* @param event - Event to send
|
|
112
167
|
* @param error - Optional error object to log.
|
|
113
|
-
* @param logLevel - Optional level of the log. Default: {@link @fluidframework/core-interfaces#LogLevel.default}.
|
|
168
|
+
* @param logLevel - Optional level of the log. Default: {@link @fluidframework/core-interfaces#LogLevelConst.default | LogLevel.default}.
|
|
114
169
|
*/
|
|
115
170
|
sendPerformanceEvent(event: ITelemetryPerformanceEventExt, error?: unknown, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
116
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetryTypes.d.ts","sourceRoot":"","sources":["../src/telemetryTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9F
|
|
1
|
+
{"version":3,"file":"telemetryTypes.d.ts","sourceRoot":"","sources":["../src/telemetryTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9F;;;;;;;;;;;GAWG;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,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,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C;CACR;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAmB,SAAQ,oBAAoB;IAC/D;;;;;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 type { 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 * @legacy @beta\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 * @legacy @beta\n */\nexport type TelemetryEventPropertyTypeExt =\n\t| string\n\t| number\n\t| boolean\n\t| undefined\n\t| (string | number | boolean)[]\n\t| Record<string, string | number | boolean | undefined | (string | number | boolean)[]>;\n\n/**\n * JSON-serializable properties, which will be logged with telemetry.\n * @legacy @beta\n */\nexport type ITelemetryPropertiesExt = Record<\n\tstring,\n\tTelemetryEventPropertyTypeExt | 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\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#ITelemetryBaseEvent.category}\n\t */\n\tcategory: string;\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#ITelemetryBaseEvent.eventName}\n\t */\n\teventName: string;\n}\n\n/**\n * Informational (non-error) telemetry event\n * @remarks Maps to category = \"generic\"\n * @legacy @beta\n */\nexport interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#ITelemetryBaseEvent.eventName}\n\t */\n\teventName: string;\n\n\t/**\n\t * Optional event {@link @fluidframework/core-interfaces#ITelemetryBaseEvent.category}.\n\t * @defaultValue \"generic\"\n\t */\n\tcategory?: TelemetryEventCategory;\n}\n\n/**\n * Error telemetry event.\n * @remarks Maps to category = \"error\"\n * @legacy @beta\n */\nexport interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#ITelemetryBaseEvent.eventName}\n\t */\n\teventName: string;\n}\n\n/**\n * Performance telemetry event.\n * @remarks Maps to category = \"performance\"\n * @legacy @beta\n */\nexport interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {\n\t/**\n\t * Duration of event (optional)\n\t */\n\tduration?: number;\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 * @
|
|
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 type { 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 * @deprecated This type is being removed without a replacement.\n * @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.\n * @legacy @beta\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 * @legacy @beta\n */\nexport type TelemetryEventPropertyTypeExt =\n\t| string\n\t| number\n\t| boolean\n\t| undefined\n\t| (string | number | boolean)[]\n\t| Record<string, string | number | boolean | undefined | (string | number | boolean)[]>;\n\n/**\n * JSON-serializable properties, which will be logged with telemetry.\n * @legacy @beta\n */\nexport type ITelemetryPropertiesExt = Record<\n\tstring,\n\tTelemetryEventPropertyTypeExt | 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\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#ITelemetryBaseEvent.category}\n\t */\n\tcategory: string;\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#ITelemetryBaseEvent.eventName}\n\t */\n\teventName: string;\n}\n\n/**\n * Informational (non-error) telemetry event\n * @remarks Maps to category = \"generic\"\n * @deprecated This type is being removed without a replacement.\n * @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.\n * @legacy @beta\n */\nexport interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#ITelemetryBaseEvent.eventName}\n\t */\n\teventName: string;\n\n\t/**\n\t * Optional event {@link @fluidframework/core-interfaces#ITelemetryBaseEvent.category}.\n\t * @defaultValue \"generic\"\n\t */\n\tcategory?: TelemetryEventCategory;\n}\n\n/**\n * Error telemetry event.\n * @remarks Maps to category = \"error\"\n * @deprecated This type is being removed without a replacement.\n * @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.\n * @legacy @beta\n */\nexport interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#ITelemetryBaseEvent.eventName}\n\t */\n\teventName: string;\n}\n\n/**\n * Performance telemetry event.\n * @remarks Maps to category = \"performance\"\n * @deprecated This type is being removed without a replacement.\n * @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.\n * @legacy @beta\n */\nexport interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {\n\t/**\n\t * Duration of event (optional)\n\t */\n\tduration?: number;\n}\n\n/**\n * This is the externally facing type for a FluidFramework internal telemetry logger wrapper.\n *\n * @remarks\n * The methods if this interface are not to be used directly by consumers and are all\n * deprecated to removed without replacement. This type is not deprecated and will\n * transition to an erased type to handle cases where \"internal\" `ITelemetryLoggerExt`\n * previously leaked out.\n *\n * @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for deprecation and breaking change details.\n *\n * @privateRemarks\n * External APIs taking in an `ITelemetryLoggerExt` ideally should be updated to\n * accept `ITelemetryBaseLogger` instead.\n *\n * @sealed\n * @legacy\n * @beta\n */\nexport interface ITelemetryLoggerExt extends ITelemetryBaseLogger {\n\t/**\n\t * Send an 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. Default: {@link @fluidframework/core-interfaces#LogLevel.essential}.\n\t * @deprecated This method is being removed without a replacement.\n\t * @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.\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 an error telemetry event.\n\t * @param event - Event to send.\n\t * @param error - Optional error object to log.\n\t * @deprecated This method is being removed without a replacement.\n\t * @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.\n\t */\n\tsendErrorEvent(event: ITelemetryErrorEventExt, error?: unknown): void;\n\n\t/**\n\t * Send a 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. Default: {@link @fluidframework/core-interfaces#LogLevel.essential}.\n\t * @deprecated This method is being removed without a replacement.\n\t * @see {@link https://github.com/microsoft/FluidFramework/issues/26910 | Issue #26910} for details.\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\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 * @internal\n */\nexport interface TelemetryLoggerExt extends ITelemetryBaseLogger {\n\t/**\n\t * Send an 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. Default: {@link @fluidframework/core-interfaces#LogLevel.default}.\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 an 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 a 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. Default: {@link @fluidframework/core-interfaces#LogLevelConst.default | LogLevel.default}.\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"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export type { TelemetryLoggerExt } from "./telemetryTypes.js";
|
|
6
|
+
import type { ITelemetryGenericEventExt as ExposedITelemetryGenericEventExt, ITelemetryErrorEventExt as ExposedITelemetryErrorEventExt, ITelemetryPerformanceEventExt as ExposedITelemetryPerformanceEventExt, TelemetryEventCategory as ExposedTelemetryEventCategory } from "./telemetryTypes.js";
|
|
7
|
+
/**
|
|
8
|
+
* Informational (non-error) telemetry event
|
|
9
|
+
* @remarks Maps to category = "generic"
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export type ITelemetryGenericEventExt = ExposedITelemetryGenericEventExt;
|
|
13
|
+
/**
|
|
14
|
+
* Error telemetry event.
|
|
15
|
+
* @remarks Maps to category = "error"
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export type ITelemetryErrorEventExt = ExposedITelemetryErrorEventExt;
|
|
19
|
+
/**
|
|
20
|
+
* Performance telemetry event.
|
|
21
|
+
* @remarks Maps to category = "performance"
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export type ITelemetryPerformanceEventExt = ExposedITelemetryPerformanceEventExt;
|
|
25
|
+
/**
|
|
26
|
+
* The categories FF uses when instrumenting the code.
|
|
27
|
+
*
|
|
28
|
+
* generic - Informational log event
|
|
29
|
+
*
|
|
30
|
+
* error - Error log event, ideally 0 of these are logged during a session
|
|
31
|
+
*
|
|
32
|
+
* performance - Includes duration, and often has _start, _end, or _cancel suffixes for activity tracking
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export type TelemetryEventCategory = ExposedTelemetryEventCategory;
|
|
36
|
+
//# sourceMappingURL=telemetryTypesUndeprecated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetryTypesUndeprecated.d.ts","sourceRoot":"","sources":["../src/telemetryTypesUndeprecated.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,KAAK,EACX,yBAAyB,IAAI,gCAAgC,EAC7D,uBAAuB,IAAI,8BAA8B,EACzD,6BAA6B,IAAI,oCAAoC,EACrE,sBAAsB,IAAI,6BAA6B,EACvD,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG,gCAAgC,CAAC;AACzE;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AACrE;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,GAAG,oCAAoC,CAAC;AACjF;;;;;;;;;GASG;AACH,MAAM,MAAM,sBAAsB,GAAG,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetryTypesUndeprecated.js","sourceRoot":"","sources":["../src/telemetryTypesUndeprecated.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable import-x/no-deprecated -- This file specifically works with deprecated types to undeprecate them for internal use */\n\n// This file contains exports that \"un-deprecate\" certain types that we want to\n// continue using internally while exposing deprecated version that will be\n// removed in a future release.\n\n// For internal maintenance convenience, we re-export some non-deprecated types\n// from telemetryTypes.ts too.\nexport type { TelemetryLoggerExt } from \"./telemetryTypes.js\";\n\nimport type {\n\tITelemetryGenericEventExt as ExposedITelemetryGenericEventExt,\n\tITelemetryErrorEventExt as ExposedITelemetryErrorEventExt,\n\tITelemetryPerformanceEventExt as ExposedITelemetryPerformanceEventExt,\n\tTelemetryEventCategory as ExposedTelemetryEventCategory,\n} from \"./telemetryTypes.js\";\n\n/**\n * Informational (non-error) telemetry event\n * @remarks Maps to category = \"generic\"\n * @internal\n */\nexport type ITelemetryGenericEventExt = ExposedITelemetryGenericEventExt;\n/**\n * Error telemetry event.\n * @remarks Maps to category = \"error\"\n * @internal\n */\nexport type ITelemetryErrorEventExt = ExposedITelemetryErrorEventExt;\n/**\n * Performance telemetry event.\n * @remarks Maps to category = \"performance\"\n * @internal\n */\nexport type ITelemetryPerformanceEventExt = ExposedITelemetryPerformanceEventExt;\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 * @internal\n */\nexport type TelemetryEventCategory = ExposedTelemetryEventCategory;\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { TelemetryLoggerExt } from "./telemetryTypes.js";
|
|
6
6
|
/**
|
|
7
7
|
* Utility counter which will send event only if the provided value is above a configured threshold.
|
|
8
8
|
*
|
|
@@ -12,7 +12,7 @@ export declare class ThresholdCounter {
|
|
|
12
12
|
private readonly threshold;
|
|
13
13
|
private readonly logger;
|
|
14
14
|
private thresholdMultiple;
|
|
15
|
-
constructor(threshold: number, logger:
|
|
15
|
+
constructor(threshold: number, logger: TelemetryLoggerExt, thresholdMultiple?: number);
|
|
16
16
|
/**
|
|
17
17
|
* Sends the value if it's above the treshold.
|
|
18
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thresholdCounter.d.ts","sourceRoot":"","sources":["../src/thresholdCounter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"thresholdCounter.d.ts","sourceRoot":"","sources":["../src/thresholdCounter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D;;;;GAIG;AACH,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,iBAAiB;gBAFR,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,kBAAkB,EACnC,iBAAiB,SAAY;IAGtC;;OAEG;IACI,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAUnD;;;;;;OAMG;IACI,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAU7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thresholdCounter.js","sourceRoot":"","sources":["../src/thresholdCounter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;GAIG;AACH,MAAa,gBAAgB;IAC5B,YACkB,SAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"thresholdCounter.js","sourceRoot":"","sources":["../src/thresholdCounter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;GAIG;AACH,MAAa,gBAAgB;IAC5B,YACkB,SAAiB,EACjB,MAA0B,EACnC,oBAAoB,SAAS;QAFpB,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAoB;QACnC,sBAAiB,GAAjB,iBAAiB,CAAY;IACnC,CAAC;IAEJ;;OAEG;IACI,IAAI,CAAC,SAAiB,EAAE,KAAa;QAC3C,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;YAC5B,OAAO;QACR,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;YAChC,SAAS;YACT,KAAK;SACL,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAC,SAAiB,EAAE,KAAa;QACrD,IAAI,KAAK,KAAK,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACtC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBAChC,SAAS;gBACT,KAAK;aACL,CAAC,CAAC;YACH,sCAAsC;YACtC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QACrD,CAAC;IACF,CAAC;CACD;AArCD,4CAqCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TelemetryLoggerExt } from \"./telemetryTypes.js\";\n\n/**\n * Utility counter which will send event only if the provided value is above a configured threshold.\n *\n * @internal\n */\nexport class ThresholdCounter {\n\tpublic constructor(\n\t\tprivate readonly threshold: number,\n\t\tprivate readonly logger: TelemetryLoggerExt,\n\t\tprivate thresholdMultiple = threshold,\n\t) {}\n\n\t/**\n\t * Sends the value if it's above the treshold.\n\t */\n\tpublic send(eventName: string, value: number): void {\n\t\tif (value < this.threshold) {\n\t\t\treturn;\n\t\t}\n\t\tthis.logger.sendPerformanceEvent({\n\t\t\teventName,\n\t\t\tvalue,\n\t\t});\n\t}\n\n\t/**\n\t * Sends the value if it's above the threshold\n\t * and a multiple of the threshold.\n\t *\n\t * To be used in scenarios where we'd like to record a\n\t * threshold violation while reducing telemetry noise.\n\t */\n\tpublic sendIfMultiple(eventName: string, value: number): void {\n\t\tif (value === this.thresholdMultiple) {\n\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\teventName,\n\t\t\t\tvalue,\n\t\t\t});\n\t\t\t// reduce number of \"multiple\" events.\n\t\t\tthis.thresholdMultiple = this.thresholdMultiple * 2;\n\t\t}\n\t}\n}\n"]}
|
package/dist/utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { TelemetryLoggerExt } from "./telemetryTypesUndeprecated.js";
|
|
6
6
|
/**
|
|
7
7
|
* An object that contains a callback used in conjunction with the {@link createSampledLogger} utility function to provide custom logic for sampling events.
|
|
8
8
|
*
|
|
@@ -19,7 +19,7 @@ export interface IEventSampler {
|
|
|
19
19
|
*
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
|
-
export interface ISampledTelemetryLogger extends
|
|
22
|
+
export interface ISampledTelemetryLogger extends TelemetryLoggerExt {
|
|
23
23
|
/**
|
|
24
24
|
* Indicates if the feature flag to disable sampling is set.
|
|
25
25
|
*
|
|
@@ -31,7 +31,7 @@ export interface ISampledTelemetryLogger extends ITelemetryLoggerExt {
|
|
|
31
31
|
isSamplingDisabled: boolean;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Wraps around an existing logger matching the {@link
|
|
34
|
+
* Wraps around an existing logger matching the {@link TelemetryLoggerExt} interface and provides the ability to only log a subset of events using a sampling strategy provided by an {@link IEventSampler}.
|
|
35
35
|
* You can chose to not provide an event sampler which is effectively a no-op, meaning that it will be treated as if the sampler always returns true.
|
|
36
36
|
*
|
|
37
37
|
* @remarks
|
|
@@ -46,7 +46,7 @@ export interface ISampledTelemetryLogger extends ITelemetryLoggerExt {
|
|
|
46
46
|
*
|
|
47
47
|
* @internal
|
|
48
48
|
*/
|
|
49
|
-
export declare function createSampledLogger(logger:
|
|
49
|
+
export declare function createSampledLogger(logger: TelemetryLoggerExt, eventSampler?: IEventSampler, skipLoggingWhenSamplingIsDisabled?: boolean): ISampledTelemetryLogger;
|
|
50
50
|
/**
|
|
51
51
|
* Runs the specified function and returns an object with the time it took to run as well as any output from it.
|
|
52
52
|
* @remarks Useful in conjunction with {@link TelemetryEventBatcher}.
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAEX,kBAAkB,EAClB,MAAM,iCAAiC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,MAAM,EAAE,MAAM,OAAO,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IAClE;;;;;;;OAOG;IACH,kBAAkB,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,kBAAkB,EAC1B,YAAY,CAAC,EAAE,aAAa,EAC5B,iCAAiC,CAAC,EAAE,OAAO,GACzC,uBAAuB,CA8CzB;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,CAKlF"}
|
package/dist/utils.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.measure = exports.createSampledLogger = void 0;
|
|
8
8
|
const config_js_1 = require("./config.js");
|
|
9
9
|
/**
|
|
10
|
-
* Wraps around an existing logger matching the {@link
|
|
10
|
+
* Wraps around an existing logger matching the {@link TelemetryLoggerExt} interface and provides the ability to only log a subset of events using a sampling strategy provided by an {@link IEventSampler}.
|
|
11
11
|
* You can chose to not provide an event sampler which is effectively a no-op, meaning that it will be treated as if the sampler always returns true.
|
|
12
12
|
*
|
|
13
13
|
* @remarks
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2CAAwD;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2CAAwD;AAmCxD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,mBAAmB,CAClC,MAA0B,EAC1B,YAA4B,EAC5B,iCAA2C;IAE3C,MAAM,iBAAiB,GAAG,IAAA,qCAAyB,EAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,kBAAkB,GACvB,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,iCAAiC,CAAC,IAAI,KAAK,CAAC;IAEjF,MAAM,aAAa,GAAG;QACrB,IAAI,EAAE,CAAC,KAA0B,EAAQ,EAAE;YAC1C,2DAA2D;YAC3D,gIAAgI;YAChI,2LAA2L;YAC3L,0EAA0E;YAC1E,IAAI,kBAAkB,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC/E,IAAI,kBAAkB,IAAI,CAAC,iCAAiC,IAAI,KAAK,CAAC,EAAE,CAAC;oBACxE,OAAO;gBACR,CAAC;gBACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;QACF,CAAC;QACD,kBAAkB,EAAE,CAAC,KAAgC,EAAQ,EAAE;YAC9D,IAAI,kBAAkB,IAAI,YAA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ft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseEvent } from \"@fluidframework/core-interfaces\";\n\nimport { loggerToMonitoringContext } from \"./config.js\";\nimport type {\n\tITelemetryGenericEventExt,\n\tTelemetryLoggerExt,\n} from \"./telemetryTypesUndeprecated.js\";\n\n/**\n * An object that contains a callback used in conjunction with the {@link createSampledLogger} utility function to provide custom logic for sampling events.\n *\n * @internal\n */\nexport interface IEventSampler {\n\t/**\n\t * @returns true if the event should be sampled or false if not\n\t */\n\tsample: () => boolean;\n}\n\n/**\n * A telemetry logger that has sampling capabilities\n *\n * @internal\n */\nexport interface ISampledTelemetryLogger extends TelemetryLoggerExt {\n\t/**\n\t * Indicates if the feature flag to disable sampling is set.\n\t *\n\t * @remarks Exposed to enable some advanced scenarios where the code using the sampled logger\n\t * could take advantage of skipping the execution of some logic when it can determine\n\t * it won't be necessary because the telemetry event that needs it wouldn't be\n\t * emitted anyway.\n\t */\n\tisSamplingDisabled: boolean;\n}\n\n/**\n * Wraps around an existing logger matching the {@link TelemetryLoggerExt} interface and provides the ability to only log a subset of events using a sampling strategy provided by an {@link IEventSampler}.\n * You can chose to not provide an event sampler which is effectively a no-op, meaning that it will be treated as if the sampler always returns true.\n *\n * @remarks\n * The sampling functionality uses the Fluid telemetry logging configuration along with the optionally provided event sampling callback to determine whether an event should\n * be logged or not.\n *\n * Configuration object parameters:\n * 'Fluid.Telemetry.DisableSampling': if this config value is set to true, all events will be unsampled and therefore logged.\n * Otherwise only a sample will be logged according to the provided event sampler callback.\n *\n * Note that the same sampler is used for all APIs of the returned logger. If you want separate events flowing through the returned logger to be sampled separately, the {@link IEventSampler} you provide should track them separately.\n *\n * @internal\n */\nexport function createSampledLogger(\n\tlogger: TelemetryLoggerExt,\n\teventSampler?: IEventSampler,\n\tskipLoggingWhenSamplingIsDisabled?: boolean,\n): ISampledTelemetryLogger {\n\tconst monitoringContext = loggerToMonitoringContext(logger);\n\tconst isSamplingDisabled =\n\t\tmonitoringContext.config.getBoolean(\"Fluid.Telemetry.DisableSampling\") ?? false;\n\n\tconst sampledLogger = {\n\t\tsend: (event: ITelemetryBaseEvent): void => {\n\t\t\t// The sampler uses the following logic for sending events:\n\t\t\t// 1. If isSamplingDisabled is true, then this means events should be unsampled. Therefore we send the event without any checks.\n\t\t\t// 2. If isSamplingDisabled is false, then event should be sampled using the event sampler, if the sampler is not defined just send all events, other use the eventSampler.sample() method.\n\t\t\t// 3. If skipLoggingWhenSamplingIsDisabled is true, then no event is sent.\n\t\t\tif (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {\n\t\t\t\tif (isSamplingDisabled && (skipLoggingWhenSamplingIsDisabled ?? false)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlogger.send(event);\n\t\t\t}\n\t\t},\n\t\tsendTelemetryEvent: (event: ITelemetryGenericEventExt): void => {\n\t\t\tif (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {\n\t\t\t\tif (isSamplingDisabled && (skipLoggingWhenSamplingIsDisabled ?? false)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlogger.sendTelemetryEvent(event);\n\t\t\t}\n\t\t},\n\t\tsendErrorEvent: (event: ITelemetryGenericEventExt): void => {\n\t\t\tif (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {\n\t\t\t\tif (isSamplingDisabled && (skipLoggingWhenSamplingIsDisabled ?? false)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlogger.sendErrorEvent(event);\n\t\t\t}\n\t\t},\n\t\tsendPerformanceEvent: (event: ITelemetryGenericEventExt): void => {\n\t\t\tif (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {\n\t\t\t\tif (isSamplingDisabled && (skipLoggingWhenSamplingIsDisabled ?? false)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlogger.sendPerformanceEvent(event);\n\t\t\t}\n\t\t},\n\t\tisSamplingDisabled,\n\t};\n\n\treturn sampledLogger;\n}\n\n/**\n * Runs the specified function and returns an object with the time it took to run as well as any output from it.\n * @remarks Useful in conjunction with {@link TelemetryEventBatcher}.\n *\n * @param codeToMeasure - The code to be executed and measured.\n * @returns The total duration of the code execution and whatever the passed-in code block returns.\n * @internal\n */\nexport function measure<T>(codeToMeasure: () => T): { duration: number; output: T } {\n\tconst start = performance.now();\n\tconst output = codeToMeasure();\n\tconst duration = performance.now() - start;\n\treturn { duration, output };\n}\n"]}
|
package/eslint.config.mts
CHANGED
package/internal.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate
|
|
8
|
+
* Generated by "flub generate node10Entrypoints" in @fluid-tools/build-cli.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export * from "./lib/
|
|
11
|
+
export * from "./lib/internal.js";
|
package/legacy.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate
|
|
8
|
+
* Generated by "flub generate node10Entrypoints" in @fluid-tools/build-cli.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
export * from "./lib/legacy.js";
|
package/lib/api.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export * from "./main.js";
|
|
6
|
+
export type { ITelemetryErrorEventExt, ITelemetryGenericEventExt, ITelemetryLoggerExt, ITelemetryPerformanceEventExt, TelemetryEventCategory, } from "./telemetryTypes.js";
|
|
7
|
+
import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
8
|
+
import type { ITelemetryLoggerPropertyBags } from "./logger.js";
|
|
9
|
+
import type { ITelemetryLoggerExt } from "./telemetryTypes.js";
|
|
10
|
+
/**
|
|
11
|
+
* Create a child logger based on the provided props object.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Passing in no props object (i.e. undefined) will return a logger that is effectively a no-op.
|
|
15
|
+
*
|
|
16
|
+
* @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.
|
|
17
|
+
*
|
|
18
|
+
* @legacy
|
|
19
|
+
* @beta
|
|
20
|
+
*/
|
|
21
|
+
export declare function createChildLogger(props?: {
|
|
22
|
+
logger?: ITelemetryBaseLogger;
|
|
23
|
+
namespace?: string;
|
|
24
|
+
properties?: ITelemetryLoggerPropertyBags;
|
|
25
|
+
}): ITelemetryLoggerExt;
|
|
26
|
+
//# sourceMappingURL=api.d.ts.map
|
package/lib/api.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,WAAW,CAAC;AAG1B,YAAY,EACX,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,6BAA6B,EAC7B,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE;IACzC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,4BAA4B,CAAC;CAC1C,GAAG,mBAAmB,CAEtB"}
|
package/lib/api.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
6
|
+
export * from "./main.js";
|
|
7
|
+
import { createChildLogger as createChildLoggerInternal } from "./logger.js";
|
|
8
|
+
/**
|
|
9
|
+
* Create a child logger based on the provided props object.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Passing in no props object (i.e. undefined) will return a logger that is effectively a no-op.
|
|
13
|
+
*
|
|
14
|
+
* @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.
|
|
15
|
+
*
|
|
16
|
+
* @legacy
|
|
17
|
+
* @beta
|
|
18
|
+
*/
|
|
19
|
+
export function createChildLogger(props) {
|
|
20
|
+
return createChildLoggerInternal(props);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=api.js.map
|
package/lib/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,gDAAgD;AAChD,cAAc,WAAW,CAAC;AAiB1B,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAG7E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAIjC;IACA,OAAO,yBAAyB,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line no-restricted-syntax\nexport * from \"./main.js\";\n\n// Additional APIs that are deprecated and thus left out of the common export set.\nexport type {\n\tITelemetryErrorEventExt,\n\tITelemetryGenericEventExt,\n\tITelemetryLoggerExt,\n\tITelemetryPerformanceEventExt,\n\tTelemetryEventCategory,\n} from \"./telemetryTypes.js\";\n\n// ----------------------------------------------------------------------------\n// Export `createChildLogger` helper without internal `TelemetryLoggerExt`\n\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\n\nimport type { ITelemetryLoggerPropertyBags } from \"./logger.js\";\nimport { createChildLogger as createChildLoggerInternal } from \"./logger.js\";\nimport type { ITelemetryLoggerExt } from \"./telemetryTypes.js\";\n\n/**\n * Create a child logger based on the provided props object.\n *\n * @remarks\n * Passing in no props object (i.e. undefined) will return a logger that is effectively a no-op.\n *\n * @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.\n *\n * @legacy\n * @beta\n */\nexport function createChildLogger(props?: {\n\tlogger?: ITelemetryBaseLogger;\n\tnamespace?: string;\n\tproperties?: ITelemetryLoggerPropertyBags;\n}): ITelemetryLoggerExt {\n\treturn createChildLoggerInternal(props);\n}\n"]}
|
package/lib/config.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import type { ConfigTypes, IConfigProviderBase, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { Lazy } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { createChildLogger } from "./logger.js";
|
|
8
|
-
import type { ITelemetryLoggerExt } from "./telemetryTypes.js";
|
|
8
|
+
import type { ITelemetryLoggerExt, TelemetryLoggerExt } from "./telemetryTypes.js";
|
|
9
9
|
/**
|
|
10
10
|
* Explicitly typed interface for reading configurations.
|
|
11
11
|
*
|
|
@@ -69,9 +69,9 @@ export declare class CachedConfigProvider implements IConfigProvider {
|
|
|
69
69
|
*
|
|
70
70
|
* @internal
|
|
71
71
|
*/
|
|
72
|
-
export interface MonitoringContext<L extends ITelemetryBaseLogger =
|
|
72
|
+
export interface MonitoringContext<L extends ITelemetryBaseLogger = TelemetryLoggerExt> {
|
|
73
73
|
config: IConfigProvider;
|
|
74
|
-
logger: L;
|
|
74
|
+
logger: L extends ITelemetryLoggerExt ? TelemetryLoggerExt : L;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Determines whether or not the provided object is a {@link MonitoringContext}.
|
|
@@ -79,13 +79,13 @@ export interface MonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLo
|
|
|
79
79
|
*
|
|
80
80
|
* @internal
|
|
81
81
|
*/
|
|
82
|
-
export declare function loggerIsMonitoringContext<L extends ITelemetryBaseLogger =
|
|
82
|
+
export declare function loggerIsMonitoringContext<L extends ITelemetryBaseLogger = TelemetryLoggerExt>(obj: L): obj is L & MonitoringContext<L>;
|
|
83
83
|
/**
|
|
84
84
|
* Creates a {@link MonitoringContext} from the provided logger, if it isn't already one.
|
|
85
85
|
*
|
|
86
86
|
* @internal
|
|
87
87
|
*/
|
|
88
|
-
export declare function loggerToMonitoringContext<L extends ITelemetryBaseLogger =
|
|
88
|
+
export declare function loggerToMonitoringContext<L extends ITelemetryBaseLogger = TelemetryLoggerExt>(logger: L): MonitoringContext<L>;
|
|
89
89
|
/**
|
|
90
90
|
* Creates a {@link MonitoringContext} from the provided logger.
|
|
91
91
|
*
|
|
@@ -97,7 +97,7 @@ export declare function loggerToMonitoringContext<L extends ITelemetryBaseLogger
|
|
|
97
97
|
*
|
|
98
98
|
* @internal
|
|
99
99
|
*/
|
|
100
|
-
export declare function mixinMonitoringContext<L extends ITelemetryBaseLogger =
|
|
100
|
+
export declare function mixinMonitoringContext<L extends ITelemetryBaseLogger = TelemetryLoggerExt>(logger: L, ...configs: (IConfigProviderBase | undefined)[]): MonitoringContext<L>;
|
|
101
101
|
/**
|
|
102
102
|
* Creates a child logger with a {@link MonitoringContext}.
|
|
103
103
|
*
|
package/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,WAA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CAAC,CAAC,SAAS,oBAAoB,GAAG,kBAAkB,EAC5F,MAAM,EAAE,CAAC,GACP,iBAAiB,CAAC,CAAC,CAAC,CAKtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,oBAAoB,GAAG,kBAAkB,EACzF,MAAM,EAAE,CAAC,EACT,GAAG,OAAO,EAAE,CAAC,mBAAmB,GAAG,SAAS,CAAC,EAAE,GAC7C,iBAAiB,CAAC,CAAC,CAAC,CAkBtB;AAOD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC3C,KAAK,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAC5C,iBAAiB,CAEnB;AAED;;KAEK;AACL,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MAAM,IAAI;KAClD,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAC9B,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,MAAM,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GAC3E,SAAS;CACZ,CAAC;AAEF;;;;;;;;;;KAUK;AACL,wBAAgB,6BAA6B,CAAC,CAAC,SAAS,MAAM,EAC7D,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAAC,EACrC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GACzB,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CA6BtB"}
|
package/lib/config.js
CHANGED
|
@@ -253,6 +253,8 @@ export function mixinMonitoringContext(logger, ...configs) {
|
|
|
253
253
|
*/
|
|
254
254
|
const mc = logger;
|
|
255
255
|
mc.config = new CachedConfigProvider(logger, ...configs);
|
|
256
|
+
// Cast is similar to `extractTelemetryLoggerExt` but preserves other
|
|
257
|
+
// logger types rather than just returning `TelemetryLoggerExt`.
|
|
256
258
|
mc.logger = logger;
|
|
257
259
|
return mc;
|
|
258
260
|
}
|