@fluidframework/container-runtime 1.2.7 → 2.0.0-dev.1.3.0.96595
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/.mocharc.js +12 -0
- package/dist/batchManager.d.ts +37 -0
- package/dist/batchManager.d.ts.map +1 -0
- package/dist/batchManager.js +73 -0
- package/dist/batchManager.js.map +1 -0
- package/dist/batchTracker.d.ts +1 -2
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +2 -3
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +87 -25
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +317 -99
- package/dist/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +109 -124
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +349 -542
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.js +29 -24
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +20 -14
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +49 -58
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +12 -5
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +21 -20
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaScheduler.d.ts +6 -4
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +6 -4
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/garbageCollection.d.ts +74 -14
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +249 -170
- package/dist/garbageCollection.js.map +1 -1
- package/dist/gcSweepReadyUsageDetection.d.ts +53 -0
- package/dist/gcSweepReadyUsageDetection.d.ts.map +1 -0
- package/dist/gcSweepReadyUsageDetection.js +126 -0
- package/dist/gcSweepReadyUsageDetection.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/opProperties.d.ts +7 -0
- package/dist/opProperties.d.ts.map +1 -0
- package/dist/opProperties.js +20 -0
- package/dist/opProperties.js.map +1 -0
- package/dist/orderedClientElection.d.ts +28 -10
- package/dist/orderedClientElection.d.ts.map +1 -1
- package/dist/orderedClientElection.js +14 -4
- package/dist/orderedClientElection.js.map +1 -1
- 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/pendingStateManager.d.ts +0 -11
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +24 -46
- package/dist/pendingStateManager.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/scheduleManager.d.ts +31 -0
- package/dist/scheduleManager.d.ts.map +1 -0
- package/dist/scheduleManager.js +243 -0
- package/dist/scheduleManager.js.map +1 -0
- 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 +45 -18
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryCollection.d.ts +1 -0
- package/dist/summaryCollection.d.ts.map +1 -1
- package/dist/summaryCollection.js +31 -15
- 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/dist/summaryManager.d.ts +2 -2
- package/dist/summaryManager.d.ts.map +1 -1
- package/dist/summaryManager.js +22 -7
- package/dist/summaryManager.js.map +1 -1
- package/lib/batchManager.d.ts +37 -0
- package/lib/batchManager.d.ts.map +1 -0
- package/lib/batchManager.js +69 -0
- package/lib/batchManager.js.map +1 -0
- package/lib/batchTracker.d.ts +1 -2
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -3
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +87 -25
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +319 -101
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +109 -124
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +355 -547
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.js +29 -24
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +20 -14
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +46 -55
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStores.d.ts +12 -5
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +21 -20
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaScheduler.d.ts +6 -4
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +6 -4
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/garbageCollection.d.ts +74 -14
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +238 -160
- package/lib/garbageCollection.js.map +1 -1
- package/lib/gcSweepReadyUsageDetection.d.ts +53 -0
- package/lib/gcSweepReadyUsageDetection.d.ts.map +1 -0
- package/lib/gcSweepReadyUsageDetection.js +121 -0
- package/lib/gcSweepReadyUsageDetection.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/opProperties.d.ts +7 -0
- package/lib/opProperties.d.ts.map +1 -0
- package/lib/opProperties.js +16 -0
- package/lib/opProperties.js.map +1 -0
- package/lib/orderedClientElection.d.ts +28 -10
- package/lib/orderedClientElection.d.ts.map +1 -1
- package/lib/orderedClientElection.js +14 -4
- package/lib/orderedClientElection.js.map +1 -1
- 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/pendingStateManager.d.ts +0 -11
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +24 -46
- package/lib/pendingStateManager.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/scheduleManager.d.ts +31 -0
- package/lib/scheduleManager.d.ts.map +1 -0
- package/lib/scheduleManager.js +239 -0
- package/lib/scheduleManager.js.map +1 -0
- 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 +45 -18
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryCollection.d.ts +1 -0
- package/lib/summaryCollection.d.ts.map +1 -1
- package/lib/summaryCollection.js +31 -15
- 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/lib/summaryManager.d.ts +2 -2
- package/lib/summaryManager.d.ts.map +1 -1
- package/lib/summaryManager.js +22 -7
- package/lib/summaryManager.js.map +1 -1
- package/package.json +65 -24
- package/src/batchManager.ts +91 -0
- package/src/batchTracker.ts +2 -3
- package/src/blobManager.ts +385 -118
- package/src/containerRuntime.ts +529 -740
- package/src/dataStore.ts +49 -37
- package/src/dataStoreContext.ts +44 -56
- package/src/dataStores.ts +34 -30
- package/src/deltaScheduler.ts +6 -4
- package/src/garbageCollection.ts +297 -206
- package/src/gcSweepReadyUsageDetection.ts +139 -0
- package/src/index.ts +1 -2
- package/src/opProperties.ts +19 -0
- package/src/orderedClientElection.ts +31 -10
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +27 -59
- package/src/runningSummarizer.ts +75 -22
- package/src/scheduleManager.ts +314 -0
- package/src/summarizer.ts +1 -18
- package/src/summarizerHeuristics.ts +133 -19
- package/src/summarizerTypes.ts +53 -18
- package/src/summaryCollection.ts +33 -18
- package/src/summaryFormat.ts +0 -6
- package/src/summaryGenerator.ts +40 -22
- package/src/summaryManager.ts +22 -7
- 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,18 +21,20 @@ 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
|
-
* @deprecated
|
|
28
|
+
* @deprecated This will be removed in a later release.
|
|
27
29
|
*/
|
|
28
30
|
export const ISummarizer: keyof IProvideSummarizer = "ISummarizer";
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
|
-
* @deprecated
|
|
33
|
+
* @deprecated This will be removed in a later release.
|
|
32
34
|
*/
|
|
33
35
|
export interface IProvideSummarizer {
|
|
34
36
|
/**
|
|
35
|
-
* @deprecated
|
|
37
|
+
* @deprecated This will be removed in a later release.
|
|
36
38
|
*/
|
|
37
39
|
readonly ISummarizer: ISummarizer;
|
|
38
40
|
}
|
|
@@ -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
|
|
|
@@ -126,6 +130,7 @@ export interface IOnDemandSummarizeOptions extends ISummarizeOptions {
|
|
|
126
130
|
export interface IEnqueueSummarizeOptions extends IOnDemandSummarizeOptions {
|
|
127
131
|
/** If specified, The summarize attempt will not occur until after this sequence number. */
|
|
128
132
|
readonly afterSequenceNumber?: number;
|
|
133
|
+
|
|
129
134
|
/**
|
|
130
135
|
* True to override the existing enqueued summarize attempt if there is one.
|
|
131
136
|
* This will guarantee that this attempt gets enqueued. If override is false,
|
|
@@ -150,10 +155,6 @@ export interface IGeneratedSummaryStats extends ISummaryStats {
|
|
|
150
155
|
readonly gcTotalBlobsSize?: number;
|
|
151
156
|
/** The number of gc blobs in this summary. */
|
|
152
157
|
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
158
|
/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */
|
|
158
159
|
readonly summaryNumber: number;
|
|
159
160
|
}
|
|
@@ -204,11 +205,16 @@ export interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, "stag
|
|
|
204
205
|
* The result consists of 4 possible stages, each with its own data.
|
|
205
206
|
* The data is cumulative, so each stage will contain the data from the previous stages.
|
|
206
207
|
* If the final "submitted" stage is not reached, the result may contain the error object.
|
|
208
|
+
*
|
|
207
209
|
* Stages:
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
210
|
+
*
|
|
211
|
+
* 1. "base" - stopped before the summary tree was even generated, and the result only contains the base data
|
|
212
|
+
*
|
|
213
|
+
* 2. "generate" - the summary tree was generated, and the result will contain that tree + stats
|
|
214
|
+
*
|
|
215
|
+
* 3. "upload" - the summary was uploaded to storage, and the result contains the server-provided handle
|
|
216
|
+
*
|
|
217
|
+
* 4. "submit" - the summarize op was submitted, and the result contains the op client sequence number.
|
|
212
218
|
*/
|
|
213
219
|
export type SubmitSummaryResult =
|
|
214
220
|
| IBaseSummarizeResult
|
|
@@ -361,6 +367,18 @@ export interface ISummarizeHeuristicData {
|
|
|
361
367
|
/** Most recent summary that received an ack */
|
|
362
368
|
readonly lastSuccessfulSummary: Readonly<ISummarizeAttempt>;
|
|
363
369
|
|
|
370
|
+
/** Number of runtime ops since last summary */
|
|
371
|
+
numRuntimeOps: number;
|
|
372
|
+
|
|
373
|
+
/** Number of non-runtime ops since last summary */
|
|
374
|
+
numNonRuntimeOps: number;
|
|
375
|
+
|
|
376
|
+
/** Cumulative size in bytes of all the ops since the last summary */
|
|
377
|
+
totalOpsSize: number;
|
|
378
|
+
|
|
379
|
+
/** Wether or not this instance contains adjusted metrics due to missing op data */
|
|
380
|
+
hasMissingOpData: boolean;
|
|
381
|
+
|
|
364
382
|
/**
|
|
365
383
|
* Updates lastAttempt and lastSuccessfulAttempt based on the last summary.
|
|
366
384
|
* @param lastSummary - last ack summary
|
|
@@ -381,7 +399,10 @@ export interface ISummarizeHeuristicData {
|
|
|
381
399
|
|
|
382
400
|
/** Responsible for running heuristics determining when to summarize. */
|
|
383
401
|
export interface ISummarizeHeuristicRunner {
|
|
384
|
-
/**
|
|
402
|
+
/** Start specific heuristic trackers (ex: idle timer) */
|
|
403
|
+
start(): void;
|
|
404
|
+
|
|
405
|
+
/** Runs the heuristics to determine if it should try to summarize */
|
|
385
406
|
run(): void;
|
|
386
407
|
|
|
387
408
|
/** Runs a different heuristic to check if it should summarize before closing */
|
|
@@ -408,6 +429,19 @@ export type ISummarizeTelemetryProperties =
|
|
|
408
429
|
Pick<ITelemetryProperties, ISummarizeTelemetryRequiredProperties> &
|
|
409
430
|
Partial<Pick<ITelemetryProperties, ISummarizeTelemetryOptionalProperties>>;
|
|
410
431
|
|
|
432
|
+
/** Strategy used to heuristically determine when we should run a summary */
|
|
433
|
+
export interface ISummaryHeuristicStrategy {
|
|
434
|
+
/** Summarize reason for this summarize heuristic strategy (ex: "maxTime") */
|
|
435
|
+
summarizeReason: Readonly<SummarizeReason>;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Determines if this strategy's summarize criteria been met
|
|
439
|
+
* @param configuration - summary configuration we are to check against
|
|
440
|
+
* @param heuristicData - heuristic data used to confirm conditions are met
|
|
441
|
+
*/
|
|
442
|
+
shouldRunSummary(configuration: ISummaryConfigurationHeuristics, heuristicData: ISummarizeHeuristicData): boolean;
|
|
443
|
+
}
|
|
444
|
+
|
|
411
445
|
type SummaryGeneratorRequiredTelemetryProperties =
|
|
412
446
|
/** True to generate the full tree with no handle reuse optimizations */
|
|
413
447
|
"fullTree" |
|
|
@@ -425,14 +459,15 @@ type SummaryGeneratorOptionalTelemetryProperties =
|
|
|
425
459
|
"opsSinceLastAttempt" |
|
|
426
460
|
/** Delta between the current reference sequence number and the reference sequence number of the last summary */
|
|
427
461
|
"opsSinceLastSummary" |
|
|
428
|
-
/** Delta in sum of op sizes between the current reference sequence number and the reference
|
|
429
|
-
* sequence number of the last summary */
|
|
430
|
-
"opsSizesSinceLastSummary" |
|
|
431
462
|
/**
|
|
432
|
-
* Delta between the
|
|
433
|
-
*
|
|
463
|
+
* Delta in sum of op sizes between the current reference sequence number and the reference
|
|
464
|
+
* sequence number of the last summary
|
|
434
465
|
*/
|
|
435
|
-
"
|
|
466
|
+
"opsSizesSinceLastSummary" |
|
|
467
|
+
/** Delta between the number of non-runtime ops since the last summary */
|
|
468
|
+
"nonRuntimeOpsSinceLastSummary" |
|
|
469
|
+
/** Wether or not this instance contains adjusted metrics due to missing op data */
|
|
470
|
+
"hasMissingOpData" |
|
|
436
471
|
/** Time it took to generate the summary tree and stats. */
|
|
437
472
|
"generateDuration" |
|
|
438
473
|
/** The handle returned by storage pointing to the uploaded summary tree. */
|
package/src/summaryCollection.ts
CHANGED
|
@@ -239,9 +239,7 @@ export class SummaryCollection extends TypedEventEmitter<ISummaryCollectionOpEve
|
|
|
239
239
|
private readonly logger: ITelemetryLogger,
|
|
240
240
|
) {
|
|
241
241
|
super();
|
|
242
|
-
this.deltaManager.on(
|
|
243
|
-
"op",
|
|
244
|
-
(op) => this.handleOp(op));
|
|
242
|
+
this.deltaManager.on("op", (op) => this.handleOp(op));
|
|
245
243
|
}
|
|
246
244
|
|
|
247
245
|
/**
|
|
@@ -295,24 +293,41 @@ export class SummaryCollection extends TypedEventEmitter<ISummaryCollectionOpEve
|
|
|
295
293
|
return this.lastAck;
|
|
296
294
|
}
|
|
297
295
|
|
|
296
|
+
private parseContent(op: ISequencedDocumentMessage) {
|
|
297
|
+
// back-compat: ADO #1385: Make this unconditional in the future,
|
|
298
|
+
// when Container.processRemoteMessage stops parsing contents. That said, we should move to
|
|
299
|
+
// listen for "op" events from ContainerRuntime, and parsing may not be required at all if
|
|
300
|
+
// ContainerRuntime.process() would parse it for all types of ops.
|
|
301
|
+
// Can make either of those changes only when LTS moves to a version that has no content
|
|
302
|
+
// parsing in loader layer!
|
|
303
|
+
if (typeof op.contents === "string") {
|
|
304
|
+
op.contents = JSON.parse(op.contents);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
298
308
|
/**
|
|
299
309
|
* Handler for ops; only handles ops relating to summaries.
|
|
300
310
|
* @param op - op message to handle
|
|
301
311
|
*/
|
|
302
|
-
private handleOp(
|
|
312
|
+
private handleOp(opArg: ISequencedDocumentMessage) {
|
|
313
|
+
const op = { ...opArg };
|
|
314
|
+
|
|
303
315
|
switch (op.type) {
|
|
304
|
-
case MessageType.Summarize:
|
|
305
|
-
this.
|
|
306
|
-
return;
|
|
307
|
-
|
|
308
|
-
case MessageType.
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
+
case MessageType.Summarize:
|
|
317
|
+
this.parseContent(op);
|
|
318
|
+
return this.handleSummaryOp(op as ISummaryOpMessage);
|
|
319
|
+
case MessageType.SummaryAck:
|
|
320
|
+
case MessageType.SummaryNack:
|
|
321
|
+
// Old files (prior to PR #10077) may not contain this info
|
|
322
|
+
// back-compat: ADO #1385: remove cast when ISequencedDocumentMessage changes are propagated
|
|
323
|
+
if ((op as any).data !== undefined) {
|
|
324
|
+
op.contents = JSON.parse((op as any).data);
|
|
325
|
+
} else {
|
|
326
|
+
this.parseContent(op);
|
|
327
|
+
}
|
|
328
|
+
return op.type === MessageType.SummaryAck
|
|
329
|
+
? this.handleSummaryAck(op as ISummaryAckMessage)
|
|
330
|
+
: this.handleSummaryNack(op as ISummaryNackMessage);
|
|
316
331
|
default: {
|
|
317
332
|
// If the difference between timestamp of current op and last summary op is greater than
|
|
318
333
|
// the maxAckWaitTime, then we need to inform summarizer to not wait and summarize
|
|
@@ -366,11 +381,11 @@ export class SummaryCollection extends TypedEventEmitter<ISummaryCollectionOpEve
|
|
|
366
381
|
// from. i.e. initialSequenceNumber > summarySequenceNumber.
|
|
367
382
|
// We really don't care about it for now, since it is older than
|
|
368
383
|
// the one we loaded from.
|
|
369
|
-
if (seq
|
|
384
|
+
if (seq > this.deltaManager.initialSequenceNumber) {
|
|
370
385
|
// Potential causes for it to be later than our initialSequenceNumber
|
|
371
386
|
// are that the summaryOp was nacked then acked, double-acked, or
|
|
372
387
|
// the summarySequenceNumber is incorrect.
|
|
373
|
-
this.logger.
|
|
388
|
+
this.logger.sendTelemetryEvent({
|
|
374
389
|
eventName: "SummaryAckWithoutOp",
|
|
375
390
|
sequenceNumber: op.sequenceNumber, // summary ack seq #
|
|
376
391
|
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, 0x397 /* 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/src/summaryManager.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
SummarizerStopReason,
|
|
15
15
|
} from "./summarizerTypes";
|
|
16
16
|
import { SummaryCollection } from "./summaryCollection";
|
|
17
|
+
import { Summarizer } from "./summarizer";
|
|
17
18
|
|
|
18
19
|
const defaultInitialDelayMs = 5000;
|
|
19
20
|
const defaultOpsToBypassInitialDelay = 4000;
|
|
@@ -198,8 +199,12 @@ export class SummaryManager implements IDisposable {
|
|
|
198
199
|
// a summarizer to kick off lastSummary. Without that, we would not be able to summarize and get
|
|
199
200
|
// document out of broken state if it has too many ops and ordering service keeps nacking main
|
|
200
201
|
// container (and thus it goes into cycle of reconnects)
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
// If we can't run the LastSummary, simply return as to avoid paying the cost of launching
|
|
203
|
+
// the summarizer at all.
|
|
204
|
+
const shouldSummarizeStateEarlyStage = this.getShouldSummarizeState();
|
|
205
|
+
if (startWithInitialDelay &&
|
|
206
|
+
shouldSummarizeStateEarlyStage.shouldSummarize === false) {
|
|
207
|
+
return `early exit ${shouldSummarizeStateEarlyStage.stopReason}`;
|
|
203
208
|
}
|
|
204
209
|
|
|
205
210
|
// We transition to Running before requesting the summarizer, because after requesting we can't predict
|
|
@@ -213,11 +218,21 @@ export class SummaryManager implements IDisposable {
|
|
|
213
218
|
this.summarizer = summarizer;
|
|
214
219
|
|
|
215
220
|
// Re-validate that it need to be running. Due to asynchrony, it may be not the case anymore
|
|
221
|
+
// If we can't run the LastSummary, simply return as to avoid paying the cost of launching
|
|
222
|
+
// the summarizer at all.
|
|
216
223
|
const shouldSummarizeState = this.getShouldSummarizeState();
|
|
217
224
|
if (shouldSummarizeState.shouldSummarize === false) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
225
|
+
// In order to allow the last summary to run, we not only need a stop reason that would
|
|
226
|
+
// allow it but also, startWithInitialDelay to be false (start the summarization immediately),
|
|
227
|
+
// which would happen when we have a high enough number of unsummarized ops.
|
|
228
|
+
if (startWithInitialDelay || !Summarizer.stopReasonCanRunLastSummary(shouldSummarizeState.stopReason)) {
|
|
229
|
+
this.state = SummaryManagerState.Starting;
|
|
230
|
+
summarizer.stop(shouldSummarizeState.stopReason);
|
|
231
|
+
return `early exit after starting summarizer ${shouldSummarizeState.stopReason}`;
|
|
232
|
+
}
|
|
233
|
+
this.logger.sendTelemetryEvent({
|
|
234
|
+
eventName: "LastAttemptToSummarize",
|
|
235
|
+
});
|
|
221
236
|
}
|
|
222
237
|
|
|
223
238
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -287,8 +302,8 @@ export class SummaryManager implements IDisposable {
|
|
|
287
302
|
|
|
288
303
|
/**
|
|
289
304
|
* Implements initial delay before creating summarizer
|
|
290
|
-
* @returns true
|
|
291
|
-
*
|
|
305
|
+
* @returns `true`, if creation is delayed due to heuristics (not many ops to summarize).
|
|
306
|
+
* `false` if summarizer should start immediately due to too many unsummarized ops.
|
|
292
307
|
*/
|
|
293
308
|
private async delayBeforeCreatingSummarizer(): Promise<boolean> {
|
|
294
309
|
// throttle creation of new summarizer containers to prevent spamming the server with websocket connections
|
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,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;gBACzD,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAClB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACrC,MAAM,WAAW,GAAG,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1E,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;QAChG,CAAC,CAAC,CAAC;QAEH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAkC,EAAE,EAAE;;YACzD,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAA,+BAAgB,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7D,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACxC,IAAI,CAAC,mBAAmB,IAAI,MAAA,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,mCAAI,CAAC,CAAC;YACtD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACP,CAAC;IApCD,IAAW,gBAAgB;QACvB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;IAGD,IAAW,kBAAkB;QACzB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACpC,CAAC;IA+BO,MAAM,CAAC,SAAS,CAAC,OAAkC;QACvD,OAAO,OAAO,CAAC,cAAc,CAAC;IAClC,CAAC;IAEO,MAAM,CAAC,cAAc,CAAC,OAAkC;QAC5D,OAAQ,OAA2C,CAAC,IAAI,KAAK,SAAS,CAAC;IAC3E,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,iBAAiB,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,QAAQ,CAAC,CAAC;gBACzD,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAClB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACrC,MAAM,WAAW,GAAG,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1E,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;QAChG,CAAC,CAAC,CAAC;QAEH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAkC,EAAE,EAAE;;YACzD,IAAI,CAAC,iBAAiB,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7D,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACxC,IAAI,CAAC,mBAAmB,IAAI,MAAA,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,mCAAI,CAAC,CAAC;YACtD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACP,CAAC;IApCD,IAAW,gBAAgB;QACvB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;IAGD,IAAW,kBAAkB;QACzB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACpC,CAAC;IA+BO,MAAM,CAAC,SAAS,CAAC,OAAkC;QACvD,OAAO,OAAO,CAAC,cAAc,CAAC;IAClC,CAAC;IAEO,MAAM,CAAC,cAAc,CAAC,OAAkC;QAC5D,OAAQ,OAA2C,CAAC,IAAI,KAAK,SAAS,CAAC;IAC3E,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,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
|
-
}
|