@fluidframework/container-runtime 1.2.2 → 2.0.0-internal.1.0.0.81589
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/dist/blobManager.d.ts +81 -25
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +301 -100
- package/dist/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +46 -3
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +98 -79
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +32 -26
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +3 -4
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +16 -23
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +5 -2
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +11 -3
- package/dist/dataStores.js.map +1 -1
- package/dist/opProperties.d.ts +7 -0
- package/dist/opProperties.d.ts.map +1 -0
- package/dist/opProperties.js +19 -0
- package/dist/opProperties.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/runningSummarizer.d.ts +14 -4
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +68 -26
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/summarizer.d.ts +0 -2
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +1 -12
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerHeuristics.d.ts +26 -4
- package/dist/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summarizerHeuristics.js +95 -18
- package/dist/summarizerHeuristics.js.map +1 -1
- package/dist/summarizerTypes.d.ts +30 -10
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryCollection.js +1 -1
- package/dist/summaryCollection.js.map +1 -1
- package/dist/summaryFormat.d.ts +0 -5
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryGenerator.d.ts +1 -0
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js +11 -9
- package/dist/summaryGenerator.js.map +1 -1
- package/lib/blobManager.d.ts +81 -25
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +302 -101
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +46 -3
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +99 -80
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +32 -26
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +3 -4
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +17 -24
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStores.d.ts +5 -2
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +11 -3
- package/lib/dataStores.js.map +1 -1
- package/lib/opProperties.d.ts +7 -0
- package/lib/opProperties.d.ts.map +1 -0
- package/lib/opProperties.js +15 -0
- package/lib/opProperties.js.map +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/runningSummarizer.d.ts +14 -4
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +68 -26
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/summarizer.d.ts +0 -2
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +1 -12
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerHeuristics.d.ts +26 -4
- package/lib/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summarizerHeuristics.js +95 -18
- package/lib/summarizerHeuristics.js.map +1 -1
- package/lib/summarizerTypes.d.ts +30 -10
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryCollection.js +1 -1
- package/lib/summaryCollection.js.map +1 -1
- package/lib/summaryFormat.d.ts +0 -5
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryGenerator.d.ts +1 -0
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js +11 -9
- package/lib/summaryGenerator.js.map +1 -1
- package/package.json +45 -20
- package/src/blobManager.ts +360 -119
- package/src/containerRuntime.ts +165 -89
- package/src/dataStore.ts +53 -38
- package/src/dataStoreContext.ts +16 -23
- package/src/dataStores.ts +14 -3
- package/src/opProperties.ts +19 -0
- package/src/packageVersion.ts +1 -1
- package/src/runningSummarizer.ts +75 -22
- package/src/summarizer.ts +1 -18
- package/src/summarizerHeuristics.ts +133 -19
- package/src/summarizerTypes.ts +37 -10
- package/src/summaryCollection.ts +1 -1
- package/src/summaryFormat.ts +0 -6
- package/src/summaryGenerator.ts +40 -22
- package/dist/opTelemetry.d.ts +0 -22
- package/dist/opTelemetry.d.ts.map +0 -1
- package/dist/opTelemetry.js +0 -59
- package/dist/opTelemetry.js.map +0 -1
- package/lib/opTelemetry.d.ts +0 -22
- package/lib/opTelemetry.d.ts.map +0 -1
- package/lib/opTelemetry.js +0 -55
- package/lib/opTelemetry.js.map +0 -1
- package/src/opTelemetry.ts +0 -71
package/src/summarizerTypes.ts
CHANGED
|
@@ -21,6 +21,8 @@ import {
|
|
|
21
21
|
} from "@fluidframework/protocol-definitions";
|
|
22
22
|
import { ISummaryStats } from "@fluidframework/runtime-definitions";
|
|
23
23
|
import { ISummaryAckMessage, ISummaryNackMessage, ISummaryOpMessage } from "./summaryCollection";
|
|
24
|
+
import { SummarizeReason } from "./summaryGenerator";
|
|
25
|
+
import { ISummaryConfigurationHeuristics } from ".";
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* @deprecated - This will be removed in a later release.
|
|
@@ -98,7 +100,9 @@ export interface ISummarizerRuntime extends IConnectableRuntime {
|
|
|
98
100
|
/** clientId of parent (non-summarizing) container that owns summarizer container */
|
|
99
101
|
readonly summarizerClientId: string | undefined;
|
|
100
102
|
closeFn(): void;
|
|
103
|
+
/** @deprecated 1.0, please remove all implementations and usage */
|
|
101
104
|
on(event: "batchEnd", listener: (error: any, op: ISequencedDocumentMessage) => void): this;
|
|
105
|
+
/** @deprecated 1.0, please remove all implementations and usage */
|
|
102
106
|
removeListener(event: "batchEnd", listener: (error: any, op: ISequencedDocumentMessage) => void): this;
|
|
103
107
|
}
|
|
104
108
|
|
|
@@ -150,10 +154,6 @@ export interface IGeneratedSummaryStats extends ISummaryStats {
|
|
|
150
154
|
readonly gcTotalBlobsSize?: number;
|
|
151
155
|
/** The number of gc blobs in this summary. */
|
|
152
156
|
readonly gcBlobNodeCount?: number;
|
|
153
|
-
/** Sum of the sizes of all op contents since the last summary */
|
|
154
|
-
readonly opsSizesSinceLastSummary: number;
|
|
155
|
-
/** Number of non-system ops since the last summary. See {@link @fluidframework/protocol-base#isSystemMessage} */
|
|
156
|
-
readonly nonSystemOpsSinceLastSummary: number;
|
|
157
157
|
/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */
|
|
158
158
|
readonly summaryNumber: number;
|
|
159
159
|
}
|
|
@@ -361,6 +361,18 @@ export interface ISummarizeHeuristicData {
|
|
|
361
361
|
/** Most recent summary that received an ack */
|
|
362
362
|
readonly lastSuccessfulSummary: Readonly<ISummarizeAttempt>;
|
|
363
363
|
|
|
364
|
+
/** Number of runtime ops since last summary */
|
|
365
|
+
numRuntimeOps: number;
|
|
366
|
+
|
|
367
|
+
/** Number of non-runtime ops since last summary */
|
|
368
|
+
numNonRuntimeOps: number;
|
|
369
|
+
|
|
370
|
+
/** Cumulative size in bytes of all the ops since the last summary */
|
|
371
|
+
totalOpsSize: number;
|
|
372
|
+
|
|
373
|
+
/** Wether or not this instance contains adjusted metrics due to missing op data */
|
|
374
|
+
hasMissingOpData: boolean;
|
|
375
|
+
|
|
364
376
|
/**
|
|
365
377
|
* Updates lastAttempt and lastSuccessfulAttempt based on the last summary.
|
|
366
378
|
* @param lastSummary - last ack summary
|
|
@@ -381,7 +393,10 @@ export interface ISummarizeHeuristicData {
|
|
|
381
393
|
|
|
382
394
|
/** Responsible for running heuristics determining when to summarize. */
|
|
383
395
|
export interface ISummarizeHeuristicRunner {
|
|
384
|
-
/**
|
|
396
|
+
/** Start specific heuristic trackers (ex: idle timer) */
|
|
397
|
+
start(): void;
|
|
398
|
+
|
|
399
|
+
/** Runs the heuristics to determine if it should try to summarize */
|
|
385
400
|
run(): void;
|
|
386
401
|
|
|
387
402
|
/** Runs a different heuristic to check if it should summarize before closing */
|
|
@@ -408,6 +423,19 @@ export type ISummarizeTelemetryProperties =
|
|
|
408
423
|
Pick<ITelemetryProperties, ISummarizeTelemetryRequiredProperties> &
|
|
409
424
|
Partial<Pick<ITelemetryProperties, ISummarizeTelemetryOptionalProperties>>;
|
|
410
425
|
|
|
426
|
+
/** Strategy used to heuristically determine when we should run a summary */
|
|
427
|
+
export interface ISummaryHeuristicStrategy {
|
|
428
|
+
/** Summarize reason for this summarize heuristic strategy (ex: "maxTime") */
|
|
429
|
+
summarizeReason: Readonly<SummarizeReason>;
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Determines if this strategy's summarize criteria been met
|
|
433
|
+
* @param configuration - summary configuration we are to check against
|
|
434
|
+
* @param heuristicData - heuristic data used to confirm conditions are met
|
|
435
|
+
*/
|
|
436
|
+
shouldRunSummary(configuration: ISummaryConfigurationHeuristics, heuristicData: ISummarizeHeuristicData): boolean;
|
|
437
|
+
}
|
|
438
|
+
|
|
411
439
|
type SummaryGeneratorRequiredTelemetryProperties =
|
|
412
440
|
/** True to generate the full tree with no handle reuse optimizations */
|
|
413
441
|
"fullTree" |
|
|
@@ -428,11 +456,10 @@ type SummaryGeneratorOptionalTelemetryProperties =
|
|
|
428
456
|
/** Delta in sum of op sizes between the current reference sequence number and the reference
|
|
429
457
|
* sequence number of the last summary */
|
|
430
458
|
"opsSizesSinceLastSummary" |
|
|
431
|
-
/**
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
"nonSystemOpsSinceLastSummary" |
|
|
459
|
+
/** Delta between the number of non-runtime ops since the last summary */
|
|
460
|
+
"nonRuntimeOpsSinceLastSummary" |
|
|
461
|
+
/** Wether or not this instance contains adjusted metrics due to missing op data */
|
|
462
|
+
"hasMissingOpData" |
|
|
436
463
|
/** Time it took to generate the summary tree and stats. */
|
|
437
464
|
"generateDuration" |
|
|
438
465
|
/** The handle returned by storage pointing to the uploaded summary tree. */
|
package/src/summaryCollection.ts
CHANGED
|
@@ -370,7 +370,7 @@ export class SummaryCollection extends TypedEventEmitter<ISummaryCollectionOpEve
|
|
|
370
370
|
// Potential causes for it to be later than our initialSequenceNumber
|
|
371
371
|
// are that the summaryOp was nacked then acked, double-acked, or
|
|
372
372
|
// the summarySequenceNumber is incorrect.
|
|
373
|
-
this.logger.
|
|
373
|
+
this.logger.sendTelemetryEvent({
|
|
374
374
|
eventName: "SummaryAckWithoutOp",
|
|
375
375
|
sequenceNumber: op.sequenceNumber, // summary ack seq #
|
|
376
376
|
summarySequenceNumber: seq, // missing summary seq #
|
package/src/summaryFormat.ts
CHANGED
|
@@ -73,7 +73,6 @@ export function getAttributesFormatVersion(attributes: ReadFluidDataStoreAttribu
|
|
|
73
73
|
export function hasIsolatedChannels(attributes: ReadFluidDataStoreAttributes): boolean {
|
|
74
74
|
return !!attributes.summaryFormatVersion && !attributes.disableIsolatedChannels;
|
|
75
75
|
}
|
|
76
|
-
|
|
77
76
|
export interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGCMetadata {
|
|
78
77
|
readonly summaryFormatVersion: 1;
|
|
79
78
|
/** The last message processed at the time of summary. Only primitive property types are added to the summary. */
|
|
@@ -82,11 +81,6 @@ export interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGC
|
|
|
82
81
|
readonly disableIsolatedChannels?: true;
|
|
83
82
|
/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */
|
|
84
83
|
readonly summaryNumber?: number;
|
|
85
|
-
/**
|
|
86
|
-
* @deprecated - User summaryNumber instead.
|
|
87
|
-
* Counter of the last summary happened, increments every time we summarize
|
|
88
|
-
*/
|
|
89
|
-
readonly summaryCount?: number;
|
|
90
84
|
}
|
|
91
85
|
|
|
92
86
|
export interface ICreateContainerMetadata {
|
package/src/summaryGenerator.ts
CHANGED
|
@@ -264,28 +264,7 @@ export class SummaryGenerator {
|
|
|
264
264
|
opsSinceLastAttempt: referenceSequenceNumber - this.heuristicData.lastAttempt.refSequenceNumber,
|
|
265
265
|
opsSinceLastSummary,
|
|
266
266
|
};
|
|
267
|
-
|
|
268
|
-
summarizeTelemetryProps = {
|
|
269
|
-
...summarizeTelemetryProps,
|
|
270
|
-
...summaryData.summaryStats,
|
|
271
|
-
generateDuration: summaryData.generateDuration,
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
if (summaryData.stage !== "generate") {
|
|
275
|
-
summarizeTelemetryProps = {
|
|
276
|
-
...summarizeTelemetryProps,
|
|
277
|
-
handle: summaryData.handle,
|
|
278
|
-
uploadDuration: summaryData.uploadDuration,
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
if (summaryData.stage !== "upload") {
|
|
282
|
-
summarizeTelemetryProps = {
|
|
283
|
-
...summarizeTelemetryProps,
|
|
284
|
-
clientSequenceNumber: summaryData.clientSequenceNumber,
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
267
|
+
summarizeTelemetryProps = this.addSummaryDataToTelemetryProps(summaryData, summarizeTelemetryProps);
|
|
289
268
|
|
|
290
269
|
if (summaryData.stage !== "submit") {
|
|
291
270
|
return fail("submitSummaryFailure", summaryData.error, summarizeTelemetryProps);
|
|
@@ -408,6 +387,45 @@ export class SummaryGenerator {
|
|
|
408
387
|
}
|
|
409
388
|
}
|
|
410
389
|
|
|
390
|
+
private addSummaryDataToTelemetryProps(
|
|
391
|
+
summaryData: SubmitSummaryResult,
|
|
392
|
+
initialProps: SummaryGeneratorTelemetry,
|
|
393
|
+
): SummaryGeneratorTelemetry {
|
|
394
|
+
switch (summaryData.stage) {
|
|
395
|
+
case "base": return initialProps;
|
|
396
|
+
|
|
397
|
+
case "generate": return {
|
|
398
|
+
...initialProps,
|
|
399
|
+
...summaryData.summaryStats,
|
|
400
|
+
generateDuration: summaryData.generateDuration,
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
case "upload": return {
|
|
404
|
+
...initialProps,
|
|
405
|
+
...summaryData.summaryStats,
|
|
406
|
+
generateDuration: summaryData.generateDuration,
|
|
407
|
+
handle: summaryData.handle,
|
|
408
|
+
uploadDuration: summaryData.uploadDuration,
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
case "submit": return {
|
|
412
|
+
...initialProps,
|
|
413
|
+
...summaryData.summaryStats,
|
|
414
|
+
generateDuration: summaryData.generateDuration,
|
|
415
|
+
handle: summaryData.handle,
|
|
416
|
+
uploadDuration: summaryData.uploadDuration,
|
|
417
|
+
clientSequenceNumber: summaryData.clientSequenceNumber,
|
|
418
|
+
hasMissingOpData: this.heuristicData.hasMissingOpData,
|
|
419
|
+
opsSizesSinceLastSummary: this.heuristicData.totalOpsSize,
|
|
420
|
+
nonRuntimeOpsSinceLastSummary: this.heuristicData.numNonRuntimeOps,
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
default: assert(true, "Unexpected summary stage");
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return initialProps;
|
|
427
|
+
}
|
|
428
|
+
|
|
411
429
|
private summarizeTimerHandler(time: number, count: number) {
|
|
412
430
|
this.logger.sendPerformanceEvent({
|
|
413
431
|
eventName: "SummarizeTimeout",
|
package/dist/opTelemetry.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { IDeltaManager } from "@fluidframework/container-definitions";
|
|
6
|
-
import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
7
|
-
export declare class OpTracker {
|
|
8
|
-
/**
|
|
9
|
-
* Used for storing the message content size when
|
|
10
|
-
* the message is pushed onto the inbound queue.
|
|
11
|
-
*/
|
|
12
|
-
private readonly messageSize;
|
|
13
|
-
private _nonSystemOpCount;
|
|
14
|
-
get nonSystemOpCount(): number;
|
|
15
|
-
private _opsSizeAccumulator;
|
|
16
|
-
get opsSizeAccumulator(): number;
|
|
17
|
-
constructor(deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, disabled: boolean);
|
|
18
|
-
private static messageId;
|
|
19
|
-
private static messageHasData;
|
|
20
|
-
reset(): void;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=opTelemetry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opTelemetry.d.ts","sourceRoot":"","sources":["../src/opTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EACH,gBAAgB,EAChB,yBAAyB,EAE5B,MAAM,sCAAsC,CAAC;AAG9C,qBAAa,SAAS;IAClB;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;IACzD,OAAO,CAAC,iBAAiB,CAAa;IACtC,IAAW,gBAAgB,IAAI,MAAM,CAEpC;IAED,OAAO,CAAC,mBAAmB,CAAa;IACxC,IAAW,kBAAkB,IAAI,MAAM,CAEtC;gBAGG,YAAY,EAAE,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,EACxE,QAAQ,EAAE,OAAO;IA2BrB,OAAO,CAAC,MAAM,CAAC,SAAS;IAIxB,OAAO,CAAC,MAAM,CAAC,cAAc;IAItB,KAAK;CAIf"}
|
package/dist/opTelemetry.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.OpTracker = void 0;
|
|
8
|
-
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
9
|
-
class OpTracker {
|
|
10
|
-
constructor(deltaManager, disabled) {
|
|
11
|
-
/**
|
|
12
|
-
* Used for storing the message content size when
|
|
13
|
-
* the message is pushed onto the inbound queue.
|
|
14
|
-
*/
|
|
15
|
-
this.messageSize = new Map();
|
|
16
|
-
this._nonSystemOpCount = 0;
|
|
17
|
-
this._opsSizeAccumulator = 0;
|
|
18
|
-
if (disabled) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
// Record the message content size when we receive it.
|
|
22
|
-
// We should not log this value, as summarization can happen between the time the message
|
|
23
|
-
// is received and until it is processed (the 'op' event).
|
|
24
|
-
deltaManager.inbound.on("push", (message) => {
|
|
25
|
-
// Some messages my already have string contents at this point,
|
|
26
|
-
// so stringifying them again will add inaccurate overhead.
|
|
27
|
-
const messageContent = typeof message.contents === "string" ?
|
|
28
|
-
message.contents :
|
|
29
|
-
JSON.stringify(message.contents);
|
|
30
|
-
const messageData = OpTracker.messageHasData(message) ? message.data : "";
|
|
31
|
-
this.messageSize[OpTracker.messageId(message)] = messageContent.length + messageData.length;
|
|
32
|
-
});
|
|
33
|
-
deltaManager.on("op", (message) => {
|
|
34
|
-
var _a;
|
|
35
|
-
this._nonSystemOpCount += !(0, driver_utils_1.isRuntimeMessage)(message) ? 0 : 1;
|
|
36
|
-
const id = OpTracker.messageId(message);
|
|
37
|
-
this._opsSizeAccumulator += (_a = this.messageSize[id]) !== null && _a !== void 0 ? _a : 0;
|
|
38
|
-
this.messageSize.delete(id);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
get nonSystemOpCount() {
|
|
42
|
-
return this._nonSystemOpCount;
|
|
43
|
-
}
|
|
44
|
-
get opsSizeAccumulator() {
|
|
45
|
-
return this._opsSizeAccumulator;
|
|
46
|
-
}
|
|
47
|
-
static messageId(message) {
|
|
48
|
-
return message.sequenceNumber;
|
|
49
|
-
}
|
|
50
|
-
static messageHasData(message) {
|
|
51
|
-
return message.data !== undefined;
|
|
52
|
-
}
|
|
53
|
-
reset() {
|
|
54
|
-
this._nonSystemOpCount = 0;
|
|
55
|
-
this._opsSizeAccumulator = 0;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.OpTracker = OpTracker;
|
|
59
|
-
//# sourceMappingURL=opTelemetry.js.map
|
package/dist/opTelemetry.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opTelemetry.js","sourceRoot":"","sources":["../src/opTelemetry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,+DAAgE;AAEhE,MAAa,SAAS;IAgBlB,YACI,YAAwE,EACxE,QAAiB;QAjBrB;;;WAGG;QACc,gBAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;QACjD,sBAAiB,GAAW,CAAC,CAAC;QAK9B,wBAAmB,GAAW,CAAC,CAAC;QASpC,IAAI,QAAQ,EAAE;YACV,OAAO;SACV;QAED,sDAAsD;QACtD,yFAAyF;QACzF,0DAA0D;QAC1D,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,OAAkC,EAAE,EAAE;YACnE,+DAA+D;YAC/D,2DAA2D;YAC3D,MAAM,cAAc,GAAG,OAAO,OA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BAAiB,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;IACjC,CAAC;CACJ;AAzDD,8BAyDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n IDocumentMessage,\n ISequencedDocumentMessage,\n ISequencedDocumentSystemMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { isRuntimeMessage } from \"@fluidframework/driver-utils\";\n\nexport class OpTracker {\n /**\n * Used for storing the message content size when\n * the message is pushed onto the inbound queue.\n */\n private readonly messageSize = new Map<number, number>();\n private _nonSystemOpCount: number = 0;\n public get nonSystemOpCount(): number {\n return this._nonSystemOpCount;\n }\n\n private _opsSizeAccumulator: number = 0;\n public get opsSizeAccumulator(): number {\n return this._opsSizeAccumulator;\n }\n\n public constructor(\n deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n disabled: boolean,\n ) {\n if (disabled) {\n return;\n }\n\n // Record the message content size when we receive it.\n // We should not log this value, as summarization can happen between the time the message\n // is received and until it is processed (the 'op' event).\n deltaManager.inbound.on(\"push\", (message: ISequencedDocumentMessage) => {\n // Some messages my already have string contents at this point,\n // so stringifying them again will add inaccurate overhead.\n const messageContent = typeof message.contents === \"string\" ?\n message.contents :\n JSON.stringify(message.contents);\n const messageData = OpTracker.messageHasData(message) ? message.data : \"\";\n this.messageSize[OpTracker.messageId(message)] = messageContent.length + messageData.length;\n });\n\n deltaManager.on(\"op\", (message: ISequencedDocumentMessage) => {\n this._nonSystemOpCount += !isRuntimeMessage(message) ? 0 : 1;\n const id = OpTracker.messageId(message);\n this._opsSizeAccumulator += this.messageSize[id] ?? 0;\n this.messageSize.delete(id);\n });\n }\n\n private static messageId(message: ISequencedDocumentMessage): number {\n return message.sequenceNumber;\n }\n\n private static messageHasData(message: ISequencedDocumentMessage): message is ISequencedDocumentSystemMessage {\n return (message as ISequencedDocumentSystemMessage).data !== undefined;\n }\n\n public reset() {\n this._nonSystemOpCount = 0;\n this._opsSizeAccumulator = 0;\n }\n}\n"]}
|
package/lib/opTelemetry.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { IDeltaManager } from "@fluidframework/container-definitions";
|
|
6
|
-
import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
7
|
-
export declare class OpTracker {
|
|
8
|
-
/**
|
|
9
|
-
* Used for storing the message content size when
|
|
10
|
-
* the message is pushed onto the inbound queue.
|
|
11
|
-
*/
|
|
12
|
-
private readonly messageSize;
|
|
13
|
-
private _nonSystemOpCount;
|
|
14
|
-
get nonSystemOpCount(): number;
|
|
15
|
-
private _opsSizeAccumulator;
|
|
16
|
-
get opsSizeAccumulator(): number;
|
|
17
|
-
constructor(deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, disabled: boolean);
|
|
18
|
-
private static messageId;
|
|
19
|
-
private static messageHasData;
|
|
20
|
-
reset(): void;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=opTelemetry.d.ts.map
|
package/lib/opTelemetry.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opTelemetry.d.ts","sourceRoot":"","sources":["../src/opTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EACH,gBAAgB,EAChB,yBAAyB,EAE5B,MAAM,sCAAsC,CAAC;AAG9C,qBAAa,SAAS;IAClB;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;IACzD,OAAO,CAAC,iBAAiB,CAAa;IACtC,IAAW,gBAAgB,IAAI,MAAM,CAEpC;IAED,OAAO,CAAC,mBAAmB,CAAa;IACxC,IAAW,kBAAkB,IAAI,MAAM,CAEtC;gBAGG,YAAY,EAAE,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,EACxE,QAAQ,EAAE,OAAO;IA2BrB,OAAO,CAAC,MAAM,CAAC,SAAS;IAIxB,OAAO,CAAC,MAAM,CAAC,cAAc;IAItB,KAAK;CAIf"}
|
package/lib/opTelemetry.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { isRuntimeMessage } from "@fluidframework/driver-utils";
|
|
6
|
-
export class OpTracker {
|
|
7
|
-
constructor(deltaManager, disabled) {
|
|
8
|
-
/**
|
|
9
|
-
* Used for storing the message content size when
|
|
10
|
-
* the message is pushed onto the inbound queue.
|
|
11
|
-
*/
|
|
12
|
-
this.messageSize = new Map();
|
|
13
|
-
this._nonSystemOpCount = 0;
|
|
14
|
-
this._opsSizeAccumulator = 0;
|
|
15
|
-
if (disabled) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
// Record the message content size when we receive it.
|
|
19
|
-
// We should not log this value, as summarization can happen between the time the message
|
|
20
|
-
// is received and until it is processed (the 'op' event).
|
|
21
|
-
deltaManager.inbound.on("push", (message) => {
|
|
22
|
-
// Some messages my already have string contents at this point,
|
|
23
|
-
// so stringifying them again will add inaccurate overhead.
|
|
24
|
-
const messageContent = typeof message.contents === "string" ?
|
|
25
|
-
message.contents :
|
|
26
|
-
JSON.stringify(message.contents);
|
|
27
|
-
const messageData = OpTracker.messageHasData(message) ? message.data : "";
|
|
28
|
-
this.messageSize[OpTracker.messageId(message)] = messageContent.length + messageData.length;
|
|
29
|
-
});
|
|
30
|
-
deltaManager.on("op", (message) => {
|
|
31
|
-
var _a;
|
|
32
|
-
this._nonSystemOpCount += !isRuntimeMessage(message) ? 0 : 1;
|
|
33
|
-
const id = OpTracker.messageId(message);
|
|
34
|
-
this._opsSizeAccumulator += (_a = this.messageSize[id]) !== null && _a !== void 0 ? _a : 0;
|
|
35
|
-
this.messageSize.delete(id);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
get nonSystemOpCount() {
|
|
39
|
-
return this._nonSystemOpCount;
|
|
40
|
-
}
|
|
41
|
-
get opsSizeAccumulator() {
|
|
42
|
-
return this._opsSizeAccumulator;
|
|
43
|
-
}
|
|
44
|
-
static messageId(message) {
|
|
45
|
-
return message.sequenceNumber;
|
|
46
|
-
}
|
|
47
|
-
static messageHasData(message) {
|
|
48
|
-
return message.data !== undefined;
|
|
49
|
-
}
|
|
50
|
-
reset() {
|
|
51
|
-
this._nonSystemOpCount = 0;
|
|
52
|
-
this._opsSizeAccumulator = 0;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=opTelemetry.js.map
|
package/lib/opTelemetry.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opTelemetry.js","sourceRoot":"","sources":["../src/opTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,MAAM,OAAO,SAAS;IAgBlB,YACI,YAAwE,EACxE,QAAiB;QAjBrB;;;WAGG;QACc,gBAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;QACjD,sBAAiB,GAAW,CAAC,CAAC;QAK9B,wBAAmB,GAAW,CAAC,CAAC;QASpC,IAAI,QAAQ,EAAE;YACV,OAAO;SACV;QAED,sDAAsD;QACtD,yFAAyF;QACzF,0DAA0D;QAC1D,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,OAAkC,EAAE,EAAE;YACnE,+DAA+D;YAC/D,2DAA2D;YAC3D,MAAM,cAAc,GAAG,OAAO,OAAO,CAAC,QAAQ,KAAK,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3B,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;IACjC,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n IDocumentMessage,\n ISequencedDocumentMessage,\n ISequencedDocumentSystemMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { isRuntimeMessage } from \"@fluidframework/driver-utils\";\n\nexport class OpTracker {\n /**\n * Used for storing the message content size when\n * the message is pushed onto the inbound queue.\n */\n private readonly messageSize = new Map<number, number>();\n private _nonSystemOpCount: number = 0;\n public get nonSystemOpCount(): number {\n return this._nonSystemOpCount;\n }\n\n private _opsSizeAccumulator: number = 0;\n public get opsSizeAccumulator(): number {\n return this._opsSizeAccumulator;\n }\n\n public constructor(\n deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n disabled: boolean,\n ) {\n if (disabled) {\n return;\n }\n\n // Record the message content size when we receive it.\n // We should not log this value, as summarization can happen between the time the message\n // is received and until it is processed (the 'op' event).\n deltaManager.inbound.on(\"push\", (message: ISequencedDocumentMessage) => {\n // Some messages my already have string contents at this point,\n // so stringifying them again will add inaccurate overhead.\n const messageContent = typeof message.contents === \"string\" ?\n message.contents :\n JSON.stringify(message.contents);\n const messageData = OpTracker.messageHasData(message) ? message.data : \"\";\n this.messageSize[OpTracker.messageId(message)] = messageContent.length + messageData.length;\n });\n\n deltaManager.on(\"op\", (message: ISequencedDocumentMessage) => {\n this._nonSystemOpCount += !isRuntimeMessage(message) ? 0 : 1;\n const id = OpTracker.messageId(message);\n this._opsSizeAccumulator += this.messageSize[id] ?? 0;\n this.messageSize.delete(id);\n });\n }\n\n private static messageId(message: ISequencedDocumentMessage): number {\n return message.sequenceNumber;\n }\n\n private static messageHasData(message: ISequencedDocumentMessage): message is ISequencedDocumentSystemMessage {\n return (message as ISequencedDocumentSystemMessage).data !== undefined;\n }\n\n public reset() {\n this._nonSystemOpCount = 0;\n this._opsSizeAccumulator = 0;\n }\n}\n"]}
|
package/src/opTelemetry.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { IDeltaManager } from "@fluidframework/container-definitions";
|
|
7
|
-
import {
|
|
8
|
-
IDocumentMessage,
|
|
9
|
-
ISequencedDocumentMessage,
|
|
10
|
-
ISequencedDocumentSystemMessage,
|
|
11
|
-
} from "@fluidframework/protocol-definitions";
|
|
12
|
-
import { isRuntimeMessage } from "@fluidframework/driver-utils";
|
|
13
|
-
|
|
14
|
-
export class OpTracker {
|
|
15
|
-
/**
|
|
16
|
-
* Used for storing the message content size when
|
|
17
|
-
* the message is pushed onto the inbound queue.
|
|
18
|
-
*/
|
|
19
|
-
private readonly messageSize = new Map<number, number>();
|
|
20
|
-
private _nonSystemOpCount: number = 0;
|
|
21
|
-
public get nonSystemOpCount(): number {
|
|
22
|
-
return this._nonSystemOpCount;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
private _opsSizeAccumulator: number = 0;
|
|
26
|
-
public get opsSizeAccumulator(): number {
|
|
27
|
-
return this._opsSizeAccumulator;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public constructor(
|
|
31
|
-
deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,
|
|
32
|
-
disabled: boolean,
|
|
33
|
-
) {
|
|
34
|
-
if (disabled) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Record the message content size when we receive it.
|
|
39
|
-
// We should not log this value, as summarization can happen between the time the message
|
|
40
|
-
// is received and until it is processed (the 'op' event).
|
|
41
|
-
deltaManager.inbound.on("push", (message: ISequencedDocumentMessage) => {
|
|
42
|
-
// Some messages my already have string contents at this point,
|
|
43
|
-
// so stringifying them again will add inaccurate overhead.
|
|
44
|
-
const messageContent = typeof message.contents === "string" ?
|
|
45
|
-
message.contents :
|
|
46
|
-
JSON.stringify(message.contents);
|
|
47
|
-
const messageData = OpTracker.messageHasData(message) ? message.data : "";
|
|
48
|
-
this.messageSize[OpTracker.messageId(message)] = messageContent.length + messageData.length;
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
deltaManager.on("op", (message: ISequencedDocumentMessage) => {
|
|
52
|
-
this._nonSystemOpCount += !isRuntimeMessage(message) ? 0 : 1;
|
|
53
|
-
const id = OpTracker.messageId(message);
|
|
54
|
-
this._opsSizeAccumulator += this.messageSize[id] ?? 0;
|
|
55
|
-
this.messageSize.delete(id);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private static messageId(message: ISequencedDocumentMessage): number {
|
|
60
|
-
return message.sequenceNumber;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private static messageHasData(message: ISequencedDocumentMessage): message is ISequencedDocumentSystemMessage {
|
|
64
|
-
return (message as ISequencedDocumentSystemMessage).data !== undefined;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public reset() {
|
|
68
|
-
this._nonSystemOpCount = 0;
|
|
69
|
-
this._opsSizeAccumulator = 0;
|
|
70
|
-
}
|
|
71
|
-
}
|