@fluidframework/telemetry-utils 2.3.0-288113 → 2.3.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/.eslintrc.cjs +1 -7
- package/CHANGELOG.md +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/errorLogging.js +1 -1
- package/dist/errorLogging.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +4 -2
- package/dist/logger.js.map +1 -1
- package/dist/mockLogger.js +1 -1
- package/dist/mockLogger.js.map +1 -1
- package/dist/telemetryEventBatcher.d.ts.map +1 -1
- package/dist/telemetryEventBatcher.js +3 -2
- package/dist/telemetryEventBatcher.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -4
- package/dist/utils.js.map +1 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +1 -0
- package/lib/config.js.map +1 -1
- package/lib/errorLogging.js +1 -1
- package/lib/errorLogging.js.map +1 -1
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +4 -2
- package/lib/logger.js.map +1 -1
- package/lib/mockLogger.js +1 -1
- package/lib/mockLogger.js.map +1 -1
- package/lib/telemetryEventBatcher.d.ts.map +1 -1
- package/lib/telemetryEventBatcher.js +3 -2
- package/lib/telemetryEventBatcher.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +4 -4
- package/lib/utils.js.map +1 -1
- package/package.json +12 -11
- package/src/config.ts +1 -0
- package/src/errorLogging.ts +1 -1
- package/src/logger.ts +6 -2
- package/src/mockLogger.ts +1 -1
- package/src/telemetryEventBatcher.ts +3 -5
- package/src/utils.ts +5 -5
|
@@ -82,11 +82,9 @@ export class TelemetryEventBatcher<TMetrics extends string> {
|
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
for (const key of Object.keys(this.dataSums) as TMetrics[]) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
6,
|
|
89
|
-
);
|
|
85
|
+
const dataSum = this.dataSums[key];
|
|
86
|
+
if (dataSum !== undefined) {
|
|
87
|
+
telemetryEvent[`avg_${key}`] = roundToDecimalPlaces(dataSum / this.counter, 6);
|
|
90
88
|
}
|
|
91
89
|
if (this.dataMaxes[key] !== undefined) {
|
|
92
90
|
telemetryEvent[`max_${key}`] = this.dataMaxes[key];
|
package/src/utils.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface IEventSampler {
|
|
|
17
17
|
/**
|
|
18
18
|
* @returns true if the event should be sampled or false if not
|
|
19
19
|
*/
|
|
20
|
-
sample: () => boolean
|
|
20
|
+
sample: () => boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -69,7 +69,7 @@ export function createSampledLogger(
|
|
|
69
69
|
// 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.
|
|
70
70
|
// 3. If skipLoggingWhenSamplingIsDisabled is true, then no event is sent.
|
|
71
71
|
if (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {
|
|
72
|
-
if (isSamplingDisabled && skipLoggingWhenSamplingIsDisabled) {
|
|
72
|
+
if (isSamplingDisabled && (skipLoggingWhenSamplingIsDisabled ?? false)) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
logger.send(event);
|
|
@@ -77,7 +77,7 @@ export function createSampledLogger(
|
|
|
77
77
|
},
|
|
78
78
|
sendTelemetryEvent: (event: ITelemetryGenericEventExt): void => {
|
|
79
79
|
if (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {
|
|
80
|
-
if (isSamplingDisabled && skipLoggingWhenSamplingIsDisabled) {
|
|
80
|
+
if (isSamplingDisabled && (skipLoggingWhenSamplingIsDisabled ?? false)) {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
logger.sendTelemetryEvent(event);
|
|
@@ -85,7 +85,7 @@ export function createSampledLogger(
|
|
|
85
85
|
},
|
|
86
86
|
sendErrorEvent: (event: ITelemetryGenericEventExt): void => {
|
|
87
87
|
if (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {
|
|
88
|
-
if (isSamplingDisabled && skipLoggingWhenSamplingIsDisabled) {
|
|
88
|
+
if (isSamplingDisabled && (skipLoggingWhenSamplingIsDisabled ?? false)) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
logger.sendErrorEvent(event);
|
|
@@ -93,7 +93,7 @@ export function createSampledLogger(
|
|
|
93
93
|
},
|
|
94
94
|
sendPerformanceEvent: (event: ITelemetryGenericEventExt): void => {
|
|
95
95
|
if (isSamplingDisabled || eventSampler === undefined || eventSampler.sample()) {
|
|
96
|
-
if (isSamplingDisabled && skipLoggingWhenSamplingIsDisabled) {
|
|
96
|
+
if (isSamplingDisabled && (skipLoggingWhenSamplingIsDisabled ?? false)) {
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
logger.sendPerformanceEvent(event);
|