@fluidframework/container-runtime 2.0.0-internal.8.0.1 → 2.0.0-rc.1.0.1
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 +34 -0
- package/README.md +1 -7
- package/api-extractor-esm.json +4 -0
- package/api-extractor-lint.json +1 -10
- package/api-extractor.json +1 -9
- package/api-report/container-runtime.api.md +18 -17
- package/dist/blobManager.d.ts +8 -3
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +15 -4
- package/dist/blobManager.js.map +1 -1
- package/dist/container-runtime-alpha.d.ts +265 -17
- package/dist/container-runtime-beta.d.ts +0 -42
- package/dist/container-runtime-public.d.ts +0 -42
- package/dist/container-runtime-untrimmed.d.ts +32 -17
- package/dist/containerRuntime.d.ts +8 -4
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +15 -29
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +5 -2
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +10 -3
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +10 -3
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +51 -8
- package/dist/dataStores.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +15 -4
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +26 -19
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +29 -6
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +5 -3
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +13 -6
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +18 -9
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/index.d.ts +1 -1
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +2 -1
- package/dist/gc/index.js.map +1 -1
- package/dist/messageTypes.d.ts +1 -1
- package/dist/messageTypes.js +1 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +1 -1
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +4 -4
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +4 -1
- package/dist/opLifecycle/outbox.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/summary/runWhileConnectedCoordinator.d.ts +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +5 -0
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +46 -17
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +1 -1
- package/dist/summary/summarizer.js +1 -1
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +3 -1
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +7 -7
- package/dist/summary/summaryCollection.js +1 -1
- package/dist/summary/summaryCollection.js.map +1 -1
- package/lib/{batchTracker.d.ts → batchTracker.d.mts} +1 -1
- package/lib/batchTracker.d.mts.map +1 -0
- package/lib/{batchTracker.js → batchTracker.mjs} +1 -1
- package/lib/batchTracker.mjs.map +1 -0
- package/lib/{blobManager.d.ts → blobManager.d.mts} +9 -4
- package/lib/blobManager.d.mts.map +1 -0
- package/lib/{blobManager.js → blobManager.mjs} +17 -6
- package/lib/blobManager.mjs.map +1 -0
- package/lib/{connectionTelemetry.d.ts → connectionTelemetry.d.mts} +1 -1
- package/lib/connectionTelemetry.d.mts.map +1 -0
- package/lib/{connectionTelemetry.js → connectionTelemetry.mjs} +1 -1
- package/lib/connectionTelemetry.mjs.map +1 -0
- package/lib/{container-runtime-alpha.d.ts → container-runtime-alpha.d.mts} +265 -17
- package/lib/{container-runtime-beta.d.ts → container-runtime-beta.d.mts} +0 -42
- package/lib/{container-runtime-public.d.ts → container-runtime-public.d.mts} +0 -42
- package/lib/{container-runtime-untrimmed.d.ts → container-runtime-untrimmed.d.mts} +32 -17
- package/lib/{containerHandleContext.d.ts → containerHandleContext.d.mts} +2 -2
- package/lib/containerHandleContext.d.mts.map +1 -0
- package/lib/{containerHandleContext.js → containerHandleContext.mjs} +1 -1
- package/lib/containerHandleContext.mjs.map +1 -0
- package/lib/{containerRuntime.d.ts → containerRuntime.d.mts} +14 -14
- package/lib/containerRuntime.d.mts.map +1 -0
- package/lib/{containerRuntime.js → containerRuntime.mjs} +31 -22
- package/lib/containerRuntime.mjs.map +1 -0
- package/lib/{dataStore.d.ts → dataStore.d.mts} +3 -3
- package/lib/dataStore.d.mts.map +1 -0
- package/lib/{dataStore.js → dataStore.mjs} +1 -1
- package/lib/dataStore.mjs.map +1 -0
- package/lib/{dataStoreContext.d.ts → dataStoreContext.d.mts} +7 -4
- package/lib/dataStoreContext.d.mts.map +1 -0
- package/lib/{dataStoreContext.js → dataStoreContext.mjs} +13 -6
- package/lib/dataStoreContext.mjs.map +1 -0
- package/lib/{dataStoreContexts.d.ts → dataStoreContexts.d.mts} +2 -2
- package/lib/dataStoreContexts.d.mts.map +1 -0
- package/lib/{dataStoreContexts.js → dataStoreContexts.mjs} +1 -1
- package/lib/dataStoreContexts.mjs.map +1 -0
- package/lib/{dataStoreRegistry.d.ts → dataStoreRegistry.d.mts} +1 -1
- package/lib/dataStoreRegistry.d.mts.map +1 -0
- package/lib/{dataStoreRegistry.js → dataStoreRegistry.mjs} +1 -5
- package/lib/dataStoreRegistry.mjs.map +1 -0
- package/lib/{dataStores.d.ts → dataStores.d.mts} +17 -10
- package/lib/dataStores.d.mts.map +1 -0
- package/lib/{dataStores.js → dataStores.mjs} +58 -16
- package/lib/dataStores.mjs.map +1 -0
- package/lib/{deltaManagerProxyBase.d.ts → deltaManagerProxyBase.d.mts} +1 -1
- package/lib/deltaManagerProxyBase.d.mts.map +1 -0
- package/lib/{deltaManagerProxyBase.js → deltaManagerProxyBase.mjs} +1 -1
- package/lib/deltaManagerProxyBase.mjs.map +1 -0
- package/lib/{deltaManagerSummarizerProxy.d.ts → deltaManagerSummarizerProxy.d.mts} +2 -2
- package/lib/deltaManagerSummarizerProxy.d.mts.map +1 -0
- package/lib/{deltaManagerSummarizerProxy.js → deltaManagerSummarizerProxy.mjs} +3 -3
- package/lib/deltaManagerSummarizerProxy.mjs.map +1 -0
- package/lib/{deltaScheduler.d.ts → deltaScheduler.d.mts} +1 -1
- package/lib/deltaScheduler.d.mts.map +1 -0
- package/lib/{deltaScheduler.js → deltaScheduler.mjs} +1 -1
- package/lib/deltaScheduler.mjs.map +1 -0
- package/lib/{error.d.ts → error.d.mts} +1 -1
- package/lib/error.d.mts.map +1 -0
- package/lib/{error.js → error.mjs} +1 -1
- package/lib/error.mjs.map +1 -0
- package/lib/gc/{garbageCollection.d.ts → garbageCollection.d.mts} +5 -5
- package/lib/gc/garbageCollection.d.mts.map +1 -0
- package/lib/gc/{garbageCollection.js → garbageCollection.mjs} +28 -17
- package/lib/gc/garbageCollection.mjs.map +1 -0
- package/lib/gc/{gcConfigs.d.ts → gcConfigs.d.mts} +3 -3
- package/lib/gc/gcConfigs.d.mts.map +1 -0
- package/lib/gc/{gcConfigs.js → gcConfigs.mjs} +29 -22
- package/lib/gc/gcConfigs.mjs.map +1 -0
- package/lib/gc/{gcDefinitions.d.ts → gcDefinitions.d.mts} +33 -10
- package/lib/gc/gcDefinitions.d.mts.map +1 -0
- package/lib/gc/{gcDefinitions.js → gcDefinitions.mjs} +5 -3
- package/lib/gc/gcDefinitions.mjs.map +1 -0
- package/lib/gc/{gcHelpers.d.ts → gcHelpers.d.mts} +3 -3
- package/lib/gc/{gcHelpers.d.ts.map → gcHelpers.d.mts.map} +1 -1
- package/lib/gc/{gcHelpers.js → gcHelpers.mjs} +1 -1
- package/lib/gc/gcHelpers.mjs.map +1 -0
- package/lib/gc/{gcReferenceGraphAlgorithm.d.ts → gcReferenceGraphAlgorithm.d.mts} +2 -2
- package/lib/gc/gcReferenceGraphAlgorithm.d.mts.map +1 -0
- package/lib/gc/{gcReferenceGraphAlgorithm.js → gcReferenceGraphAlgorithm.mjs} +1 -1
- package/lib/gc/gcReferenceGraphAlgorithm.mjs.map +1 -0
- package/lib/gc/{gcSummaryDefinitions.d.ts → gcSummaryDefinitions.d.mts} +1 -1
- package/lib/gc/gcSummaryDefinitions.d.mts.map +1 -0
- package/lib/gc/{gcSummaryDefinitions.js → gcSummaryDefinitions.mjs} +1 -1
- package/lib/gc/gcSummaryDefinitions.mjs.map +1 -0
- package/lib/gc/{gcSummaryStateTracker.d.ts → gcSummaryStateTracker.d.mts} +4 -4
- package/lib/gc/gcSummaryStateTracker.d.mts.map +1 -0
- package/lib/gc/{gcSummaryStateTracker.js → gcSummaryStateTracker.mjs} +2 -2
- package/lib/gc/gcSummaryStateTracker.mjs.map +1 -0
- package/lib/gc/{gcTelemetry.d.ts → gcTelemetry.d.mts} +18 -11
- package/lib/gc/gcTelemetry.d.mts.map +1 -0
- package/lib/gc/{gcTelemetry.js → gcTelemetry.mjs} +20 -11
- package/lib/gc/gcTelemetry.mjs.map +1 -0
- package/lib/gc/{gcUnreferencedStateTracker.d.ts → gcUnreferencedStateTracker.d.mts} +2 -2
- package/lib/gc/gcUnreferencedStateTracker.d.mts.map +1 -0
- package/lib/gc/{gcUnreferencedStateTracker.js → gcUnreferencedStateTracker.mjs} +2 -2
- package/lib/gc/gcUnreferencedStateTracker.mjs.map +1 -0
- package/lib/gc/{index.d.ts → index.d.mts} +9 -9
- package/lib/gc/index.d.mts.map +1 -0
- package/lib/gc/{index.js → index.mjs} +8 -8
- package/lib/gc/index.mjs.map +1 -0
- package/lib/{index.d.ts → index.d.mts} +8 -8
- package/lib/index.d.mts.map +1 -0
- package/lib/{index.js → index.mjs} +7 -9
- package/lib/index.mjs.map +1 -0
- package/lib/{messageTypes.d.ts → messageTypes.d.mts} +5 -5
- package/lib/messageTypes.d.mts.map +1 -0
- package/lib/{messageTypes.js → messageTypes.mjs} +2 -2
- package/lib/messageTypes.mjs.map +1 -0
- package/lib/{metadata.d.ts → metadata.d.mts} +1 -1
- package/lib/metadata.d.mts.map +1 -0
- package/lib/{metadata.js → metadata.mjs} +1 -1
- package/lib/metadata.mjs.map +1 -0
- package/lib/opLifecycle/{batchManager.d.ts → batchManager.d.mts} +3 -3
- package/lib/opLifecycle/batchManager.d.mts.map +1 -0
- package/lib/opLifecycle/{batchManager.js → batchManager.mjs} +1 -1
- package/lib/opLifecycle/batchManager.mjs.map +1 -0
- package/lib/opLifecycle/{definitions.d.ts → definitions.d.mts} +3 -3
- package/lib/opLifecycle/definitions.d.mts.map +1 -0
- package/lib/opLifecycle/{definitions.js → definitions.mjs} +1 -1
- package/lib/opLifecycle/definitions.mjs.map +1 -0
- package/lib/opLifecycle/index.d.mts +13 -0
- package/lib/opLifecycle/index.d.mts.map +1 -0
- package/lib/opLifecycle/index.mjs +12 -0
- package/lib/opLifecycle/index.mjs.map +1 -0
- package/lib/opLifecycle/{opCompressor.d.ts → opCompressor.d.mts} +2 -2
- package/lib/opLifecycle/opCompressor.d.mts.map +1 -0
- package/lib/opLifecycle/{opCompressor.js → opCompressor.mjs} +3 -3
- package/lib/opLifecycle/opCompressor.mjs.map +1 -0
- package/lib/opLifecycle/{opDecompressor.d.ts → opDecompressor.d.mts} +2 -2
- package/lib/opLifecycle/opDecompressor.d.mts.map +1 -0
- package/lib/opLifecycle/{opDecompressor.js → opDecompressor.mjs} +2 -2
- package/lib/opLifecycle/opDecompressor.mjs.map +1 -0
- package/lib/opLifecycle/{opGroupingManager.d.ts → opGroupingManager.d.mts} +2 -2
- package/lib/opLifecycle/opGroupingManager.d.mts.map +1 -0
- package/lib/opLifecycle/{opGroupingManager.js → opGroupingManager.mjs} +1 -1
- package/lib/opLifecycle/opGroupingManager.mjs.map +1 -0
- package/lib/opLifecycle/{opSplitter.d.ts → opSplitter.d.mts} +2 -2
- package/lib/opLifecycle/opSplitter.d.mts.map +1 -0
- package/lib/opLifecycle/{opSplitter.js → opSplitter.mjs} +3 -3
- package/lib/opLifecycle/opSplitter.mjs.map +1 -0
- package/lib/opLifecycle/{outbox.d.ts → outbox.d.mts} +11 -11
- package/lib/opLifecycle/outbox.d.mts.map +1 -0
- package/lib/opLifecycle/{outbox.js → outbox.mjs} +6 -3
- package/lib/opLifecycle/outbox.mjs.map +1 -0
- package/lib/opLifecycle/{remoteMessageProcessor.d.ts → remoteMessageProcessor.d.mts} +5 -5
- package/lib/opLifecycle/remoteMessageProcessor.d.mts.map +1 -0
- package/lib/opLifecycle/{remoteMessageProcessor.js → remoteMessageProcessor.mjs} +2 -2
- package/lib/opLifecycle/remoteMessageProcessor.mjs.map +1 -0
- package/lib/{opProperties.d.ts → opProperties.d.mts} +1 -1
- package/lib/opProperties.d.mts.map +1 -0
- package/lib/{opProperties.js → opProperties.mjs} +1 -1
- package/lib/opProperties.mjs.map +1 -0
- package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
- package/lib/packageVersion.d.mts.map +1 -0
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/{pendingStateManager.d.ts → pendingStateManager.d.mts} +2 -2
- package/lib/pendingStateManager.d.mts.map +1 -0
- package/lib/{pendingStateManager.js → pendingStateManager.mjs} +2 -2
- package/lib/pendingStateManager.mjs.map +1 -0
- package/lib/{scheduleManager.d.ts → scheduleManager.d.mts} +1 -5
- package/lib/scheduleManager.d.mts.map +1 -0
- package/lib/{scheduleManager.js → scheduleManager.mjs} +3 -3
- package/lib/scheduleManager.mjs.map +1 -0
- package/lib/{storageServiceWithAttachBlobs.d.ts → storageServiceWithAttachBlobs.d.mts} +1 -1
- package/lib/storageServiceWithAttachBlobs.d.mts.map +1 -0
- package/lib/{storageServiceWithAttachBlobs.js → storageServiceWithAttachBlobs.mjs} +1 -1
- package/lib/storageServiceWithAttachBlobs.mjs.map +1 -0
- package/lib/summary/{index.d.ts → index.d.mts} +13 -13
- package/lib/summary/index.d.mts.map +1 -0
- package/lib/summary/{index.js → index.mjs} +12 -12
- package/lib/summary/index.mjs.map +1 -0
- package/lib/summary/{orderedClientElection.d.ts → orderedClientElection.d.mts} +1 -5
- package/lib/summary/orderedClientElection.d.mts.map +1 -0
- package/lib/summary/{orderedClientElection.js → orderedClientElection.mjs} +2 -2
- package/lib/summary/orderedClientElection.mjs.map +1 -0
- package/lib/summary/{runWhileConnectedCoordinator.d.ts → runWhileConnectedCoordinator.d.mts} +3 -3
- package/lib/summary/runWhileConnectedCoordinator.d.mts.map +1 -0
- package/lib/summary/{runWhileConnectedCoordinator.js → runWhileConnectedCoordinator.mjs} +1 -1
- package/lib/summary/runWhileConnectedCoordinator.mjs.map +1 -0
- package/lib/summary/{runningSummarizer.d.ts → runningSummarizer.d.mts} +10 -5
- package/lib/summary/runningSummarizer.d.mts.map +1 -0
- package/lib/summary/{runningSummarizer.js → runningSummarizer.mjs} +50 -21
- package/lib/summary/runningSummarizer.mjs.map +1 -0
- package/lib/summary/{summarizer.d.ts → summarizer.d.mts} +6 -6
- package/lib/summary/summarizer.d.mts.map +1 -0
- package/lib/summary/{summarizer.js → summarizer.mjs} +5 -5
- package/lib/summary/summarizer.mjs.map +1 -0
- package/lib/summary/{summarizerClientElection.d.ts → summarizerClientElection.d.mts} +3 -3
- package/lib/summary/summarizerClientElection.d.mts.map +1 -0
- package/lib/summary/{summarizerClientElection.js → summarizerClientElection.mjs} +1 -1
- package/lib/summary/summarizerClientElection.mjs.map +1 -0
- package/lib/summary/{summarizerHeuristics.d.ts → summarizerHeuristics.d.mts} +4 -4
- package/lib/summary/summarizerHeuristics.d.mts.map +1 -0
- package/lib/summary/{summarizerHeuristics.js → summarizerHeuristics.mjs} +1 -1
- package/lib/summary/summarizerHeuristics.mjs.map +1 -0
- package/lib/summary/summarizerNode/{index.d.ts → index.d.mts} +4 -4
- package/lib/summary/summarizerNode/index.d.mts.map +1 -0
- package/lib/summary/summarizerNode/{index.js → index.mjs} +3 -3
- package/lib/summary/summarizerNode/index.mjs.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNode.d.ts → summarizerNode.d.mts} +2 -2
- package/lib/summary/summarizerNode/summarizerNode.d.mts.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNode.js → summarizerNode.mjs} +2 -2
- package/lib/summary/summarizerNode/summarizerNode.mjs.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeUtils.d.ts → summarizerNodeUtils.d.mts} +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.mts.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeUtils.js → summarizerNodeUtils.mjs} +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.mjs.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeWithGc.d.ts → summarizerNodeWithGc.d.mts} +3 -3
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.mts.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeWithGc.js → summarizerNodeWithGc.mjs} +4 -4
- package/lib/summary/summarizerNode/summarizerNodeWithGc.mjs.map +1 -0
- package/lib/summary/{summarizerTypes.d.ts → summarizerTypes.d.mts} +7 -5
- package/lib/summary/summarizerTypes.d.mts.map +1 -0
- package/lib/summary/{summarizerTypes.js → summarizerTypes.mjs} +1 -1
- package/lib/summary/summarizerTypes.mjs.map +1 -0
- package/lib/summary/{summaryCollection.d.ts → summaryCollection.d.mts} +8 -8
- package/lib/summary/summaryCollection.d.mts.map +1 -0
- package/lib/summary/{summaryCollection.js → summaryCollection.mjs} +2 -2
- package/lib/summary/summaryCollection.mjs.map +1 -0
- package/lib/summary/{summaryFormat.d.ts → summaryFormat.d.mts} +2 -2
- package/lib/summary/summaryFormat.d.mts.map +1 -0
- package/lib/summary/{summaryFormat.js → summaryFormat.mjs} +1 -1
- package/lib/summary/summaryFormat.mjs.map +1 -0
- package/lib/summary/{summaryGenerator.d.ts → summaryGenerator.d.mts} +3 -3
- package/lib/summary/summaryGenerator.d.mts.map +1 -0
- package/lib/summary/{summaryGenerator.js → summaryGenerator.mjs} +1 -1
- package/lib/summary/summaryGenerator.mjs.map +1 -0
- package/lib/summary/{summaryManager.d.ts → summaryManager.d.mts} +5 -5
- package/lib/summary/summaryManager.d.mts.map +1 -0
- package/lib/summary/{summaryManager.js → summaryManager.mjs} +2 -2
- package/lib/summary/summaryManager.mjs.map +1 -0
- package/lib/{throttler.d.ts → throttler.d.mts} +1 -1
- package/lib/throttler.d.mts.map +1 -0
- package/lib/{throttler.js → throttler.mjs} +1 -1
- package/lib/throttler.mjs.map +1 -0
- package/package.json +145 -39
- package/src/blobManager.ts +15 -4
- package/src/containerRuntime.ts +15 -4
- package/src/dataStoreContext.ts +11 -4
- package/src/dataStores.ts +61 -7
- package/src/gc/garbageCollection.ts +18 -4
- package/src/gc/gcConfigs.ts +28 -20
- package/src/gc/gcDefinitions.ts +30 -6
- package/src/gc/gcTelemetry.ts +19 -9
- package/src/gc/index.ts +3 -0
- package/src/messageTypes.ts +1 -1
- package/src/opLifecycle/definitions.ts +1 -1
- package/src/opLifecycle/outbox.ts +5 -2
- package/src/packageVersion.ts +1 -1
- package/src/summary/runWhileConnectedCoordinator.ts +1 -1
- package/src/summary/runningSummarizer.ts +58 -25
- package/src/summary/summarizer.ts +1 -1
- package/src/summary/summarizerTypes.ts +3 -1
- package/src/summary/summaryCollection.ts +7 -7
- package/tsconfig.json +6 -4
- package/lib/batchTracker.d.ts.map +0 -1
- package/lib/batchTracker.js.map +0 -1
- package/lib/blobManager.d.ts.map +0 -1
- package/lib/blobManager.js.map +0 -1
- package/lib/connectionTelemetry.d.ts.map +0 -1
- package/lib/connectionTelemetry.js.map +0 -1
- package/lib/containerHandleContext.d.ts.map +0 -1
- package/lib/containerHandleContext.js.map +0 -1
- package/lib/containerRuntime.d.ts.map +0 -1
- package/lib/containerRuntime.js.map +0 -1
- package/lib/dataStore.d.ts.map +0 -1
- package/lib/dataStore.js.map +0 -1
- package/lib/dataStoreContext.d.ts.map +0 -1
- package/lib/dataStoreContext.js.map +0 -1
- package/lib/dataStoreContexts.d.ts.map +0 -1
- package/lib/dataStoreContexts.js.map +0 -1
- package/lib/dataStoreRegistry.d.ts.map +0 -1
- package/lib/dataStoreRegistry.js.map +0 -1
- package/lib/dataStores.d.ts.map +0 -1
- package/lib/dataStores.js.map +0 -1
- package/lib/deltaManagerProxyBase.d.ts.map +0 -1
- package/lib/deltaManagerProxyBase.js.map +0 -1
- package/lib/deltaManagerSummarizerProxy.d.ts.map +0 -1
- package/lib/deltaManagerSummarizerProxy.js.map +0 -1
- package/lib/deltaScheduler.d.ts.map +0 -1
- package/lib/deltaScheduler.js.map +0 -1
- package/lib/error.d.ts.map +0 -1
- package/lib/error.js.map +0 -1
- package/lib/gc/garbageCollection.d.ts.map +0 -1
- package/lib/gc/garbageCollection.js.map +0 -1
- package/lib/gc/gcConfigs.d.ts.map +0 -1
- package/lib/gc/gcConfigs.js.map +0 -1
- package/lib/gc/gcDefinitions.d.ts.map +0 -1
- package/lib/gc/gcDefinitions.js.map +0 -1
- package/lib/gc/gcHelpers.js.map +0 -1
- package/lib/gc/gcReferenceGraphAlgorithm.d.ts.map +0 -1
- package/lib/gc/gcReferenceGraphAlgorithm.js.map +0 -1
- package/lib/gc/gcSummaryDefinitions.d.ts.map +0 -1
- package/lib/gc/gcSummaryDefinitions.js.map +0 -1
- package/lib/gc/gcSummaryStateTracker.d.ts.map +0 -1
- package/lib/gc/gcSummaryStateTracker.js.map +0 -1
- package/lib/gc/gcTelemetry.d.ts.map +0 -1
- package/lib/gc/gcTelemetry.js.map +0 -1
- package/lib/gc/gcUnreferencedStateTracker.d.ts.map +0 -1
- package/lib/gc/gcUnreferencedStateTracker.js.map +0 -1
- package/lib/gc/index.d.ts.map +0 -1
- package/lib/gc/index.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/messageTypes.d.ts.map +0 -1
- package/lib/messageTypes.js.map +0 -1
- package/lib/metadata.d.ts.map +0 -1
- package/lib/metadata.js.map +0 -1
- package/lib/opLifecycle/batchManager.d.ts.map +0 -1
- package/lib/opLifecycle/batchManager.js.map +0 -1
- package/lib/opLifecycle/definitions.d.ts.map +0 -1
- package/lib/opLifecycle/definitions.js.map +0 -1
- package/lib/opLifecycle/index.d.ts +0 -13
- package/lib/opLifecycle/index.d.ts.map +0 -1
- package/lib/opLifecycle/index.js +0 -12
- package/lib/opLifecycle/index.js.map +0 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +0 -1
- package/lib/opLifecycle/opCompressor.js.map +0 -1
- package/lib/opLifecycle/opDecompressor.d.ts.map +0 -1
- package/lib/opLifecycle/opDecompressor.js.map +0 -1
- package/lib/opLifecycle/opGroupingManager.d.ts.map +0 -1
- package/lib/opLifecycle/opGroupingManager.js.map +0 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +0 -1
- package/lib/opLifecycle/opSplitter.js.map +0 -1
- package/lib/opLifecycle/outbox.d.ts.map +0 -1
- package/lib/opLifecycle/outbox.js.map +0 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +0 -1
- package/lib/opLifecycle/remoteMessageProcessor.js.map +0 -1
- package/lib/opProperties.d.ts.map +0 -1
- package/lib/opProperties.js.map +0 -1
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js.map +0 -1
- package/lib/pendingStateManager.d.ts.map +0 -1
- package/lib/pendingStateManager.js.map +0 -1
- package/lib/scheduleManager.d.ts.map +0 -1
- package/lib/scheduleManager.js.map +0 -1
- package/lib/storageServiceWithAttachBlobs.d.ts.map +0 -1
- package/lib/storageServiceWithAttachBlobs.js.map +0 -1
- package/lib/summary/index.d.ts.map +0 -1
- package/lib/summary/index.js.map +0 -1
- package/lib/summary/orderedClientElection.d.ts.map +0 -1
- package/lib/summary/orderedClientElection.js.map +0 -1
- package/lib/summary/runWhileConnectedCoordinator.d.ts.map +0 -1
- package/lib/summary/runWhileConnectedCoordinator.js.map +0 -1
- package/lib/summary/runningSummarizer.d.ts.map +0 -1
- package/lib/summary/runningSummarizer.js.map +0 -1
- package/lib/summary/summarizer.d.ts.map +0 -1
- package/lib/summary/summarizer.js.map +0 -1
- package/lib/summary/summarizerClientElection.d.ts.map +0 -1
- package/lib/summary/summarizerClientElection.js.map +0 -1
- package/lib/summary/summarizerHeuristics.d.ts.map +0 -1
- package/lib/summary/summarizerHeuristics.js.map +0 -1
- package/lib/summary/summarizerNode/index.d.ts.map +0 -1
- package/lib/summary/summarizerNode/index.js.map +0 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +0 -1
- package/lib/summary/summarizerNode/summarizerNode.js.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +0 -1
- package/lib/summary/summarizerTypes.d.ts.map +0 -1
- package/lib/summary/summarizerTypes.js.map +0 -1
- package/lib/summary/summaryCollection.d.ts.map +0 -1
- package/lib/summary/summaryCollection.js.map +0 -1
- package/lib/summary/summaryFormat.d.ts.map +0 -1
- package/lib/summary/summaryFormat.js.map +0 -1
- package/lib/summary/summaryGenerator.d.ts.map +0 -1
- package/lib/summary/summaryGenerator.js.map +0 -1
- package/lib/summary/summaryManager.d.ts.map +0 -1
- package/lib/summary/summaryManager.js.map +0 -1
- package/lib/throttler.d.ts.map +0 -1
- package/lib/throttler.js.map +0 -1
- package/tsconfig.esnext.json +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runningSummarizer.js","sourceRoot":"","sources":["../../src/summary/runningSummarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qEAMyC;AACzC,2DAAmF;AACnF,+DAAiE;AACjE,2EAAsE;AACtE,+EAA8F;AAE9F,kDAAyC;AACzC,iEAAkE;AAqBlE,yDAK4B;AAE5B,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAE7D;;;GAGG;AACU,QAAA,kBAAkB,GAAG,CAAC,CAAC;AACpC;;;GAGG;AACU,QAAA,mCAAmC,GAAG,CAAC,CAAC;AAErD;;;;;;GAMG;AACH,MAAa,iBAAkB,SAAQ,gCAAoC;IACnE,MAAM,CAAC,KAAK,CAAC,KAAK,CACxB,MAA4B,EAC5B,cAAqC,EACrC,aAAoC,EACpC,qBAAuF,EACvF,+BAAsF,EACtF,aAAsC,EACtC,iBAAoC,EACpC,iBAA4C,EAC5C,sBAA8D,EAC9D,OAA2B;QAE3B,MAAM,UAAU,GAAG,IAAI,iBAAiB,CACvC,MAAM,EACN,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,+BAA+B,EAC/B,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,OAAO,CACP,CAAC;QAEF,0GAA0G;QAC1G,4FAA4F;QAC5F,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,gBAAgB,EAAE,CAAC;QAE1D,MAAM,UAAU,CAAC,SAAS,EAAE,CAAC;QAE7B,qCAAqC;QACrC,sGAAsG;QACtG,UAAU,CAAC,0BAA0B,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACpE,IAAA,mCAAiB,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC,cAAc,CAC3C,EAAE,SAAS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gBACV,eAAe,EAAE,IAAI;gBACrB,UAAU,EAAE,IAAI;aACf;YACH,CAAC,CAAC,OAAO,CAAC;IACZ,CAAC;IAEO,qBAAqB;QAC5B,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;SACb;QACD,IACC,IAAI,CAAC,eAAe,KAAK,SAAS;YAClC,IAAI,CAAC,aAAa,CAAC,oBAAoB,GAAG,IAAI,CAAC,eAAe,CAAC,mBAAmB;YAClF,IAAI,CAAC,eAAe,KAAK,SAAS,EACjC;YACD,uFAAuF;YACvF,OAAO,KAAK,CAAC;SACb;QACD,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC;QAC1E,+FAA+F;QAC/F,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,IAAI,CAAC,gBAAgB,CACpB,EAAE,eAAe,EAAE,mBAAmB,MAAM,EAAE,EAAE,EAChD,gBAAgB,EAChB,cAAc,CACd,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IAEO,sBAAsB;QAC7B,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE;YACvC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,IAAI,CACvC,uCAAuC,EACvC,SAAS,CACT,CAAC;YACF,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;SACjC;IACF,CAAC;CACD;AAp1BD,8CAo1BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport {\n\tisFluidError,\n\tMonitoringContext,\n\tcreateChildMonitoringContext,\n\tcreateChildLogger,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert, delay, Deferred, PromiseTimer } from \"@fluidframework/core-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryConfiguration } from \"../containerRuntime\";\nimport { opSize } from \"../opProperties\";\nimport { SummarizeHeuristicRunner } from \"./summarizerHeuristics\";\nimport {\n\tIEnqueueSummarizeOptions,\n\tISummarizeOptions,\n\tISummarizeHeuristicData,\n\tISummarizeHeuristicRunner,\n\tIOnDemandSummarizeOptions,\n\tEnqueueSummarizeResult,\n\tSummarizerStopReason,\n\tISubmitSummaryOptions,\n\tSubmitSummaryResult,\n\tISummaryCancellationToken,\n\tISummarizeResults,\n\tISummarizeTelemetryProperties,\n\tISummarizerRuntime,\n\tISummarizeRunnerTelemetry,\n\tIRefreshSummaryAckOptions,\n\tISummarizerEvents,\n\tISummarizeEventProps,\n} from \"./summarizerTypes\";\nimport { IAckedSummary, IClientSummaryWatcher, SummaryCollection } from \"./summaryCollection\";\nimport {\n\traceTimer,\n\tSummarizeReason,\n\tSummarizeResultBuilder,\n\tSummaryGenerator,\n} from \"./summaryGenerator\";\n\nconst maxSummarizeAckWaitTime = 10 * 60 * 1000; // 10 minutes\n\n/**\n * The maximum number of summarization attempts that will be done by default in case of failures\n * that can be retried.\n */\nexport const defaultMaxAttempts = 2;\n/**\n * The default value for maximum number of summarization attempts that will be done for summarization failures where\n * submit fails and the failure can be retried.\n */\nexport const defaultMaxAttemptsForSubmitFailures = 5;\n\n/**\n * An instance of RunningSummarizer manages the heuristics for summarizing.\n * Until disposed, the instance of RunningSummarizer can assume that it is\n * in a state of running, meaning it is connected and initialized. It keeps\n * track of summaries that it is generating as they are broadcast and acked/nacked.\n * This object is created and controlled by Summarizer object.\n */\nexport class RunningSummarizer extends TypedEventEmitter<ISummarizerEvents> implements IDisposable {\n\tpublic static async start(\n\t\tlogger: ITelemetryBaseLogger,\n\t\tsummaryWatcher: IClientSummaryWatcher,\n\t\tconfiguration: ISummaryConfiguration,\n\t\tsubmitSummaryCallback: (options: ISubmitSummaryOptions) => Promise<SubmitSummaryResult>,\n\t\trefreshLatestSummaryAckCallback: (options: IRefreshSummaryAckOptions) => Promise<void>,\n\t\theuristicData: ISummarizeHeuristicData,\n\t\tsummaryCollection: SummaryCollection,\n\t\tcancellationToken: ISummaryCancellationToken,\n\t\tstopSummarizerCallback: (reason: SummarizerStopReason) => void,\n\t\truntime: ISummarizerRuntime,\n\t): Promise<RunningSummarizer> {\n\t\tconst summarizer = new RunningSummarizer(\n\t\t\tlogger,\n\t\t\tsummaryWatcher,\n\t\t\tconfiguration,\n\t\t\tsubmitSummaryCallback,\n\t\t\trefreshLatestSummaryAckCallback,\n\t\t\theuristicData,\n\t\t\tsummaryCollection,\n\t\t\tcancellationToken,\n\t\t\tstopSummarizerCallback,\n\t\t\truntime,\n\t\t);\n\n\t\t// Before doing any heuristics or proceeding with its refreshing, if there is a summary ack received while\n\t\t// this summarizer catches up, let's refresh state before proceeding with the summarization.\n\t\tconst lastAckRefSeq = await summarizer.handleSummaryAck();\n\n\t\tawait summarizer.waitStart();\n\n\t\t// Handle summary acks asynchronously\n\t\t// Note: no exceptions are thrown from processIncomingSummaryAcks handler as it handles all exceptions\n\t\tsummarizer.processIncomingSummaryAcks(lastAckRefSeq).catch((error) => {\n\t\t\tcreateChildLogger({ logger }).sendErrorEvent(\n\t\t\t\t{ eventName: \"HandleSummaryAckFatalError\" },\n\t\t\t\terror,\n\t\t\t);\n\t\t});\n\n\t\t// Update heuristic counts\n\t\t// By the time we get here, there are potentially ops missing from the heuristic summary counts\n\t\t// Examples of where this could happen:\n\t\t// 1. Op is processed during the time that we are initiating the RunningSummarizer instance but before we\n\t\t// listen for the op events (will get missed by the handlers in the current workflow)\n\t\t// 2. Op was sequenced after the last time we summarized (op sequence number > summarize ref sequence number)\n\t\tconst diff =\n\t\t\truntime.deltaManager.lastSequenceNumber -\n\t\t\t(heuristicData.lastSuccessfulSummary.refSequenceNumber +\n\t\t\t\theuristicData.numNonRuntimeOps +\n\t\t\t\theuristicData.numRuntimeOps);\n\t\theuristicData.hasMissingOpData = diff > 0;\n\n\t\tif (heuristicData.hasMissingOpData) {\n\t\t\t// Split the diff 50-50 and increment the counts appropriately\n\t\t\theuristicData.numNonRuntimeOps += Math.ceil(diff / 2);\n\t\t\theuristicData.numRuntimeOps += Math.floor(diff / 2);\n\t\t}\n\n\t\t// Update last seq number (in case the handlers haven't processed anything yet)\n\t\theuristicData.lastOpSequenceNumber = runtime.deltaManager.lastSequenceNumber;\n\n\t\t// Start heuristics\n\t\tsummarizer.heuristicRunner?.start();\n\t\tsummarizer.heuristicRunner?.run();\n\n\t\treturn summarizer;\n\t}\n\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\tprivate stopping = false;\n\tprivate _disposed = false;\n\tprivate summarizingLock: Promise<void> | undefined;\n\tprivate tryWhileSummarizing = false;\n\tprivate readonly pendingAckTimer: PromiseTimer;\n\tprivate heuristicRunner?: ISummarizeHeuristicRunner;\n\tprivate readonly generator: SummaryGenerator;\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate enqueuedSummary:\n\t\t| {\n\t\t\t\treason: SummarizeReason;\n\t\t\t\tafterSequenceNumber: number;\n\t\t\t\tsummarizeOptions: ISummarizeOptions;\n\t\t\t\treadonly resultsBuilder: SummarizeResultBuilder;\n\t\t }\n\t\t| undefined;\n\tprivate summarizeCount = 0;\n\tprivate totalSuccessfulAttempts = 0;\n\tprivate initialized = false;\n\n\tprivate readonly runtimeListener;\n\n\t/** The maximum number of summary attempts to do when submit summary fails. */\n\tprivate readonly maxAttemptsForSubmitFailures: number;\n\n\tprivate constructor(\n\t\tbaseLogger: ITelemetryBaseLogger,\n\t\tprivate readonly summaryWatcher: IClientSummaryWatcher,\n\t\tprivate readonly configuration: ISummaryConfiguration,\n\t\tprivate readonly submitSummaryCallback: (\n\t\t\toptions: ISubmitSummaryOptions,\n\t\t) => Promise<SubmitSummaryResult>,\n\t\tprivate readonly refreshLatestSummaryAckCallback: (\n\t\t\toptions: IRefreshSummaryAckOptions,\n\t\t) => Promise<void>,\n\t\tprivate readonly heuristicData: ISummarizeHeuristicData,\n\t\tprivate readonly summaryCollection: SummaryCollection,\n\t\tprivate readonly cancellationToken: ISummaryCancellationToken,\n\t\tprivate readonly stopSummarizerCallback: (reason: SummarizerStopReason) => void,\n\t\tprivate readonly runtime: ISummarizerRuntime,\n\t) {\n\t\tsuper();\n\n\t\tconst telemetryProps: ISummarizeRunnerTelemetry = {\n\t\t\tsummarizeCount: () => this.summarizeCount,\n\t\t\tsummarizerSuccessfulAttempts: () => this.totalSuccessfulAttempts,\n\t\t};\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: baseLogger,\n\t\t\tnamespace: \"Running\",\n\t\t\tproperties: {\n\t\t\t\tall: telemetryProps,\n\t\t\t},\n\t\t});\n\n\t\tif (configuration.state !== \"disableHeuristics\") {\n\t\t\tassert(\n\t\t\t\tthis.configuration.state === \"enabled\",\n\t\t\t\t0x2ea /* \"Configuration state should be enabled\" */,\n\t\t\t);\n\t\t\tthis.heuristicRunner = new SummarizeHeuristicRunner(\n\t\t\t\theuristicData,\n\t\t\t\tthis.configuration,\n\t\t\t\t(reason) => this.trySummarize(reason),\n\t\t\t\tthis.mc.logger,\n\t\t\t);\n\t\t}\n\n\t\tassert(\n\t\t\tthis.configuration.state !== \"disabled\",\n\t\t\t0x2eb /* \"Summary not supported with configuration disabled\" */,\n\t\t);\n\n\t\t// Cap the maximum amount of time client will wait for a summarize op ack to maxSummarizeAckWaitTime\n\t\t// configuration.maxAckWaitTime is composed from defaults, server values, and runtime overrides\n\n\t\tconst maxAckWaitTime = Math.min(this.configuration.maxAckWaitTime, maxSummarizeAckWaitTime);\n\n\t\tthis.pendingAckTimer = new PromiseTimer(maxAckWaitTime, () => {\n\t\t\t// Note: summarizeCount (from ChildLogger definition) may be 0,\n\t\t\t// since this code path is hit when RunningSummarizer first starts up,\n\t\t\t// before this instance has kicked off a new summarize run.\n\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\teventName: \"SummaryAckWaitTimeout\",\n\t\t\t\tmessage: \"Pending summary ack not received in time\",\n\t\t\t\tmaxAckWaitTime,\n\t\t\t\treferenceSequenceNumber: this.heuristicData.lastAttempt.refSequenceNumber,\n\t\t\t\tsummarySequenceNumber: this.heuristicData.lastAttempt.summarySequenceNumber,\n\t\t\t\ttimePending: Date.now() - this.heuristicData.lastAttempt.summaryTime,\n\t\t\t});\n\t\t});\n\t\t// Set up pending ack timeout by op timestamp differences for previous summaries.\n\t\tsummaryCollection.setPendingAckTimerTimeoutCallback(maxAckWaitTime, () => {\n\t\t\tif (this.pendingAckTimer.hasTimer) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"MissingSummaryAckFoundByOps\",\n\t\t\t\t\treferenceSequenceNumber: this.heuristicData.lastAttempt.refSequenceNumber,\n\t\t\t\t\tsummarySequenceNumber: this.heuristicData.lastAttempt.summarySequenceNumber,\n\t\t\t\t});\n\t\t\t\tthis.pendingAckTimer.clear();\n\t\t\t}\n\t\t});\n\n\t\tthis.generator = new SummaryGenerator(\n\t\t\tthis.pendingAckTimer,\n\t\t\tthis.heuristicData,\n\t\t\tthis.submitSummaryCallback,\n\t\t\t() => {\n\t\t\t\tthis.totalSuccessfulAttempts++;\n\t\t\t},\n\t\t\tthis.summaryWatcher,\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\t// Listen to runtime for ops\n\t\tthis.runtimeListener = (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => {\n\t\t\tthis.handleOp(op, runtimeMessage === true);\n\t\t};\n\t\tthis.runtime.on(\"op\", this.runtimeListener);\n\n\t\t// The max attempts for submit failures can be overridden via a feature flag. This allows us to\n\t\t// tweak this as per telemetry data until we arrive at a stable number.\n\t\t// If its set to a number higher than `defaultMaxAttemptsForSubmitFailures`, it will be ignored.\n\t\tconst overrideMaxAttempts = this.mc.config.getNumber(\n\t\t\t\"Fluid.Summarizer.AttemptsForSubmitFailures\",\n\t\t);\n\t\tthis.maxAttemptsForSubmitFailures =\n\t\t\toverrideMaxAttempts && overrideMaxAttempts < defaultMaxAttemptsForSubmitFailures\n\t\t\t\t? overrideMaxAttempts\n\t\t\t\t: defaultMaxAttemptsForSubmitFailures;\n\t}\n\n\tprivate async handleSummaryAck(): Promise<number> {\n\t\tconst lastAck: IAckedSummary | undefined = this.summaryCollection.latestAck;\n\t\tlet refSequenceNumber = -1;\n\t\t// In case we haven't received the lastestAck yet, just return.\n\t\tif (lastAck !== undefined) {\n\t\t\trefSequenceNumber = lastAck.summaryOp.referenceSequenceNumber;\n\t\t\tconst summaryLogger = this.tryGetCorrelatedLogger(refSequenceNumber) ?? this.mc.logger;\n\t\t\tconst summaryOpHandle = lastAck.summaryOp.contents.handle;\n\t\t\tconst summaryAckHandle = lastAck.summaryAck.contents.handle;\n\t\t\twhile (this.summarizingLock !== undefined) {\n\t\t\t\tsummaryLogger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"RefreshAttemptWithSummarizerRunning\",\n\t\t\t\t\treferenceSequenceNumber: refSequenceNumber,\n\t\t\t\t\tproposalHandle: summaryOpHandle,\n\t\t\t\t\tackHandle: summaryAckHandle,\n\t\t\t\t});\n\t\t\t\tawait this.summarizingLock;\n\t\t\t}\n\n\t\t\t// Make sure we block any summarizer from being executed/enqueued while\n\t\t\t// executing the refreshLatestSummaryAck.\n\t\t\t// https://dev.azure.com/fluidframework/internal/_workitems/edit/779\n\t\t\tawait this.lockedSummaryAction(\n\t\t\t\t() => {},\n\t\t\t\tasync () =>\n\t\t\t\t\tthis.refreshLatestSummaryAckCallback({\n\t\t\t\t\t\tproposalHandle: summaryOpHandle,\n\t\t\t\t\t\tackHandle: summaryAckHandle,\n\t\t\t\t\t\tsummaryRefSeq: refSequenceNumber,\n\t\t\t\t\t\tsummaryLogger,\n\t\t\t\t\t}).catch(async (error) => {\n\t\t\t\t\t\t// If the error is 404, so maybe the fetched version no longer exists on server. We just\n\t\t\t\t\t\t// ignore this error in that case, as that means we will have another summaryAck for the\n\t\t\t\t\t\t// latest version with which we will refresh the state. However in case of single commit\n\t\t\t\t\t\t// summary, we might me missing a summary ack, so in that case we are still fine as the\n\t\t\t\t\t\t// code in `submitSummary` function in container runtime, will refresh the latest state\n\t\t\t\t\t\t// by calling `prefetchLatestSummaryThenClose`. We will load the next summarizer from the\n\t\t\t\t\t\t// updated state and be fine.\n\t\t\t\t\t\tconst isIgnoredError =\n\t\t\t\t\t\t\tisFluidError(error) &&\n\t\t\t\t\t\t\terror.errorType === DriverErrorTypes.fileNotFoundOrAccessDeniedError;\n\n\t\t\t\t\t\tsummaryLogger.sendTelemetryEvent(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\teventName: isIgnoredError\n\t\t\t\t\t\t\t\t\t? \"HandleSummaryAckErrorIgnored\"\n\t\t\t\t\t\t\t\t\t: \"HandleLastSummaryAckError\",\n\t\t\t\t\t\t\t\treferenceSequenceNumber: refSequenceNumber,\n\t\t\t\t\t\t\t\tproposalHandle: summaryOpHandle,\n\t\t\t\t\t\t\t\tackHandle: summaryAckHandle,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t() => {},\n\t\t\t);\n\t\t\trefSequenceNumber++;\n\t\t}\n\t\treturn refSequenceNumber;\n\t}\n\n\t/**\n\t * Responsible for receiving and processing all the summaryAcks.\n\t * In case there was a summary ack processed by the running summarizer before processIncomingSummaryAcks is called,\n\t * it will wait for the summary ack that is newer than the one indicated by the lastAckRefSeq.\n\t * @param lastAckRefSeq - Identifies the minimum reference sequence number the summarizer needs to wait for.\n\t * In case of a negative number, the summarizer will wait for ANY summary ack that is greater than the deltaManager's initial sequence number,\n\t * and, in case of a positive one, it will wait for a summary ack that is greater than this current reference sequence number.\n\t */\n\tprivate async processIncomingSummaryAcks(lastAckRefSeq: number) {\n\t\tlet refSequenceNumber =\n\t\t\tlastAckRefSeq > 0 ? lastAckRefSeq : this.runtime.deltaManager.initialSequenceNumber;\n\t\twhile (!this.disposed) {\n\t\t\tconst summaryLogger = this.tryGetCorrelatedLogger(refSequenceNumber) ?? this.mc.logger;\n\n\t\t\t// Initialize ack with undefined if exception happens inside of waitSummaryAck on second iteration,\n\t\t\t// we record undefined, not previous handles.\n\t\t\tawait this.summaryCollection.waitSummaryAck(refSequenceNumber);\n\n\t\t\tsummaryLogger.sendTelemetryEvent({\n\t\t\t\teventName: \"processIncomingSummaryAcks\",\n\t\t\t\treferenceSequenceNumber: refSequenceNumber,\n\t\t\t\tlastAckRefSeq,\n\t\t\t});\n\n\t\t\trefSequenceNumber = await this.handleSummaryAck();\n\t\t\t// A valid Summary Ack must have been processed.\n\t\t\tassert(refSequenceNumber >= 0, 0x58f /* Invalid ref sequence number */);\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.runtime.off(\"op\", this.runtimeListener);\n\t\tthis.summaryWatcher.dispose();\n\t\tthis.heuristicRunner?.dispose();\n\t\tthis.heuristicRunner = undefined;\n\t\tthis.generator.dispose();\n\t\tthis.pendingAckTimer.clear();\n\t\tthis.disposeEnqueuedSummary();\n\t\tthis._disposed = true;\n\t\tthis.stopping = true;\n\t}\n\n\t/**\n\t * RunningSummarizer's logger includes the sequenced index of the current summary on each event.\n\t * If some other Summarizer code wants that event on their logs they can get it here,\n\t * but only if they're logging about that same summary.\n\t * @param summaryOpRefSeq - RefSeq number of the summary op, to ensure the log correlation will be correct\n\t */\n\tpublic tryGetCorrelatedLogger = (summaryOpRefSeq) =>\n\t\tthis.heuristicData.lastAttempt.refSequenceNumber === summaryOpRefSeq\n\t\t\t? this.mc.logger\n\t\t\t: undefined;\n\n\t/** We only want a single heuristic runner micro-task (will provide better optimized grouping of ops) */\n\tprivate heuristicRunnerMicroTaskExists = false;\n\n\tpublic handleOp(op: ISequencedDocumentMessage, runtimeMessage: boolean) {\n\t\tthis.heuristicData.lastOpSequenceNumber = op.sequenceNumber;\n\n\t\tif (runtimeMessage) {\n\t\t\tthis.heuristicData.numRuntimeOps++;\n\t\t} else {\n\t\t\tthis.heuristicData.numNonRuntimeOps++;\n\t\t}\n\n\t\tthis.heuristicData.totalOpsSize += opSize(op);\n\n\t\t// Check for enqueued on-demand summaries; Intentionally do nothing otherwise\n\t\tif (\n\t\t\tthis.initialized &&\n\t\t\tthis.opCanTriggerSummary(op, runtimeMessage) &&\n\t\t\t!this.tryRunEnqueuedSummary() &&\n\t\t\t!this.heuristicRunnerMicroTaskExists\n\t\t) {\n\t\t\tthis.heuristicRunnerMicroTaskExists = true;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\tPromise.resolve()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis.heuristicRunner?.run();\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tthis.heuristicRunnerMicroTaskExists = false;\n\t\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Can the given op trigger a summary?\n\t * # Currently always prevents summaries for Summarize and SummaryAck/Nack ops\n\t * @param op - op to check\n\t * @returns true if this op can trigger a summary\n\t */\n\tprivate opCanTriggerSummary(op: ISequencedDocumentMessage, runtimeMessage: boolean): boolean {\n\t\tswitch (op.type) {\n\t\t\tcase MessageType.Summarize:\n\t\t\tcase MessageType.SummaryAck:\n\t\t\tcase MessageType.SummaryNack:\n\t\t\t\treturn false;\n\t\t\tdefault:\n\t\t\t\treturn runtimeMessage || this.nonRuntimeOpCanTriggerSummary();\n\t\t}\n\t}\n\n\tprivate nonRuntimeOpCanTriggerSummary(): boolean {\n\t\tconst opsSinceLastAck =\n\t\t\tthis.heuristicData.lastOpSequenceNumber -\n\t\t\tthis.heuristicData.lastSuccessfulSummary.refSequenceNumber;\n\t\treturn (\n\t\t\tthis.configuration.state === \"enabled\" &&\n\t\t\t(this.configuration.nonRuntimeHeuristicThreshold === undefined ||\n\t\t\t\tthis.configuration.nonRuntimeHeuristicThreshold <= opsSinceLastAck)\n\t\t);\n\t}\n\n\tpublic async waitStop(allowLastSummary: boolean): Promise<void> {\n\t\tif (this.stopping) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.stopping = true;\n\n\t\tthis.disposeEnqueuedSummary();\n\n\t\t// This will try to run lastSummary if needed.\n\t\tif (allowLastSummary && this.heuristicRunner?.shouldRunLastSummary()) {\n\t\t\tif (this.summarizingLock === undefined) {\n\t\t\t\tthis.trySummarizeOnce(\n\t\t\t\t\t// summarizeProps\n\t\t\t\t\t{ summarizeReason: \"lastSummary\" },\n\t\t\t\t\t// ISummarizeOptions, using defaults: { refreshLatestAck: false, fullTree: false }\n\t\t\t\t\t{},\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Note that trySummarizeOnce() call above returns right away, without waiting.\n\t\t// So we need to wait for its completion, otherwise it would be destroyed right away.\n\t\t// That said, if summary lock was taken upfront, this wait might wait on multiple retries to\n\t\t// submit summary. We should reconsider this flow and make summarizer move to exit faster.\n\t\t// This resolves when the current pending summary gets an ack or fails.\n\t\tawait this.summarizingLock;\n\t}\n\n\tprivate async waitStart() {\n\t\t// Wait no longer than ack timeout for all pending\n\t\tconst waitStartResult = await raceTimer(\n\t\t\tthis.summaryWatcher.waitFlushed(),\n\t\t\tthis.pendingAckTimer.start(),\n\t\t);\n\t\tthis.pendingAckTimer.clear();\n\n\t\t// Remove pending ack wait timeout by op timestamp comparison, because\n\t\t// it has race conditions with summaries submitted by this same client.\n\t\tthis.summaryCollection.unsetPendingAckTimerTimeoutCallback();\n\n\t\tif (waitStartResult.result === \"done\" && waitStartResult.value !== undefined) {\n\t\t\tthis.heuristicData.updateWithLastSummaryAckInfo({\n\t\t\t\trefSequenceNumber: waitStartResult.value.summaryOp.referenceSequenceNumber,\n\t\t\t\t// This will be the Summarizer starting point so only use timestamps from client's machine.\n\t\t\t\tsummaryTime: Date.now(),\n\t\t\t\tsummarySequenceNumber: waitStartResult.value.summaryOp.sequenceNumber,\n\t\t\t});\n\t\t}\n\t\tthis.initialized = true;\n\t}\n\n\tprivate beforeSummaryAction() {\n\t\tthis.summarizeCount++;\n\t}\n\n\tprivate afterSummaryAction() {\n\t\tconst retry = this.tryWhileSummarizing;\n\t\tthis.tryWhileSummarizing = false;\n\n\t\t// After summarizing, we should check to see if we need to summarize again.\n\t\t// Rerun the heuristics and check for enqueued summaries.\n\t\tif (!this.stopping && !this.tryRunEnqueuedSummary() && retry) {\n\t\t\tthis.heuristicRunner?.run();\n\t\t}\n\t}\n\n\t/**\n\t * Runs single summary action that prevents any other concurrent actions.\n\t * Assumes that caller checked upfront for lack of concurrent action (this.summarizingLock)\n\t * before calling this API. I.e. caller is responsible for either erroring out or waiting on this promise.\n\t * @param before - set of instructions to run before running the action.\n\t * @param action - action to perform.\n\t * @param after - set of instructions to run after running the action.\n\t * @returns The result of the action.\n\t */\n\tprivate async lockedSummaryAction<T>(\n\t\tbefore: () => void,\n\t\taction: () => Promise<T>,\n\t\tafter: () => void,\n\t) {\n\t\tassert(\n\t\t\tthis.summarizingLock === undefined,\n\t\t\t0x25b /* \"Caller is responsible for checking lock\" */,\n\t\t);\n\n\t\tconst summarizingLock = new Deferred<void>();\n\t\tthis.summarizingLock = summarizingLock.promise;\n\n\t\tbefore();\n\n\t\treturn action().finally(() => {\n\t\t\tsummarizingLock.resolve();\n\t\t\tthis.summarizingLock = undefined;\n\t\t\tafter();\n\t\t});\n\t}\n\n\t/**\n\t * Runs single summarize attempt\n\t * @param summarizeProps - props to log with each telemetry event associated with this attempt\n\t * @param options - summary options\n\t * @param cancellationToken - cancellation token to use to be able to cancel this summary, if needed\n\t * @param resultsBuilder - optional, result builder to use.\n\t * @returns ISummarizeResult - result of running a summary.\n\t */\n\tprivate trySummarizeOnce(\n\t\tsummarizeProps: ISummarizeTelemetryProperties,\n\t\toptions: ISummarizeOptions,\n\t\tresultsBuilder = new SummarizeResultBuilder(),\n\t): ISummarizeResults {\n\t\tthis.lockedSummaryAction(\n\t\t\t() => {\n\t\t\t\tthis.beforeSummaryAction();\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst summaryLogger = createChildLogger({\n\t\t\t\t\tlogger: this.mc.logger,\n\t\t\t\t\tproperties: { all: summarizeProps },\n\t\t\t\t});\n\t\t\t\tconst summaryOptions: ISubmitSummaryOptions = {\n\t\t\t\t\t...options,\n\t\t\t\t\tsummaryLogger,\n\t\t\t\t\tcancellationToken: this.cancellationToken,\n\t\t\t\t};\n\t\t\t\tconst summarizeResult = this.generator.summarize(summaryOptions, resultsBuilder);\n\t\t\t\t// ensure we wait till the end of the process\n\t\t\t\treturn summarizeResult.receivedSummaryAckOrNack;\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis.afterSummaryAction();\n\t\t\t},\n\t\t).catch((error) => {\n\t\t\t// SummaryGenerator.summarize() does not throw exceptions - it converts them to failed result\n\t\t\t// on resultsBuilder\n\t\t\t// We do not care about exceptions on receivedSummaryAckOrNack - caller should check results\n\t\t\t// and take a appropriate action.\n\t\t});\n\n\t\treturn resultsBuilder.build();\n\t}\n\n\t/** Heuristics summarize attempt. */\n\tprivate trySummarize(reason: SummarizeReason): void {\n\t\tif (this.summarizingLock !== undefined) {\n\t\t\t// lockedSummaryAction() will retry heuristic-based summary at the end of current attempt\n\t\t\t// if it's still needed\n\t\t\tthis.tryWhileSummarizing = true;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.lockedSummaryAction(\n\t\t\t() => {\n\t\t\t\tthis.beforeSummaryAction();\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\treturn this.mc.config.getBoolean(\"Fluid.Summarizer.UseDynamicRetries\")\n\t\t\t\t\t? this.trySummarizeWithRetries(reason)\n\t\t\t\t\t: this.trySummarizeWithStaticAttempts(reason);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis.afterSummaryAction();\n\t\t\t},\n\t\t).catch((error) => {\n\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"UnexpectedSummarizeError\" }, error);\n\t\t});\n\t}\n\n\t/**\n\t * Tries to summarize 2 times with pre-defined summary options. If an attempt fails with \"retryAfterSeconds\"\n\t * param, that attempt is tried once more.\n\t */\n\tprivate async trySummarizeWithStaticAttempts(reason: SummarizeReason) {\n\t\tconst attemptOptions: ISummarizeOptions[] = [\n\t\t\t{ refreshLatestAck: false, fullTree: false },\n\t\t\t{ refreshLatestAck: true, fullTree: false },\n\t\t];\n\t\tlet summaryAttempts = 0;\n\t\tlet summaryAttemptsPerPhase = 0;\n\t\tlet summaryAttemptPhase = 0;\n\t\twhile (summaryAttemptPhase < attemptOptions.length) {\n\t\t\tif (this.cancellationToken.cancelled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// We only want to attempt 1 summary when reason is \"lastSummary\"\n\t\t\tif (++summaryAttempts > 1 && reason === \"lastSummary\") {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsummaryAttemptsPerPhase++;\n\n\t\t\tconst summarizeOptions = attemptOptions[summaryAttemptPhase];\n\t\t\tconst summarizeProps: ISummarizeTelemetryProperties = {\n\t\t\t\tsummarizeReason: reason,\n\t\t\t\tsummaryAttempts,\n\t\t\t\tsummaryAttemptsPerPhase,\n\t\t\t\tsummaryAttemptPhase: summaryAttemptPhase + 1, // make everything 1-based\n\t\t\t\t...summarizeOptions,\n\t\t\t};\n\t\t\tconst summaryLogger = createChildLogger({\n\t\t\t\tlogger: this.mc.logger,\n\t\t\t\tproperties: { all: summarizeProps },\n\t\t\t});\n\t\t\tconst summaryOptions: ISubmitSummaryOptions = {\n\t\t\t\t...summarizeOptions,\n\t\t\t\tsummaryLogger,\n\t\t\t\tcancellationToken: this.cancellationToken,\n\t\t\t};\n\n\t\t\t// Note: no need to account for cancellationToken.waitCancelled here, as\n\t\t\t// this is accounted SummaryGenerator.summarizeCore that controls receivedSummaryAckOrNack.\n\t\t\tconst resultSummarize = this.generator.summarize(summaryOptions);\n\t\t\tconst ackNackResult = await resultSummarize.receivedSummaryAckOrNack;\n\t\t\tif (ackNackResult.success) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Check for retryDelay that can come from summaryNack, upload summary or submit summary flows.\n\t\t\t// Retry the same step only once per retryAfter response.\n\t\t\tconst submitResult = await resultSummarize.summarySubmitted;\n\t\t\tconst delaySeconds = !submitResult.success\n\t\t\t\t? submitResult.data?.retryAfterSeconds\n\t\t\t\t: ackNackResult.data?.retryAfterSeconds;\n\t\t\tif (delaySeconds === undefined || summaryAttemptsPerPhase > 1) {\n\t\t\t\tsummaryAttemptPhase++;\n\t\t\t\tsummaryAttemptsPerPhase = 0;\n\t\t\t}\n\n\t\t\tif (delaySeconds !== undefined) {\n\t\t\t\tthis.mc.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"SummarizeAttemptDelay\",\n\t\t\t\t\tduration: delaySeconds,\n\t\t\t\t\tsummaryNackDelay: ackNackResult.data?.retryAfterSeconds !== undefined,\n\t\t\t\t\t...summarizeProps,\n\t\t\t\t});\n\t\t\t\tawait delay(delaySeconds * 1000);\n\t\t\t}\n\t\t}\n\t\tthis.stopSummarizerCallback(\"failToSummarize\");\n\t}\n\n\t/**\n\t * Tries to summarize with retries where retry is based on the failure params.\n\t * For example, summarization may be retried for failures with \"retryAfterSeconds\" param.\n\t */\n\tprivate async trySummarizeWithRetries(reason: SummarizeReason) {\n\t\t// Helper to set summarize options, telemetry properties and call summarize.\n\t\tconst attemptSummarize = (attemptNumber: number, finalAttempt: boolean) => {\n\t\t\tconst summarizeOptions: ISummarizeOptions = {\n\t\t\t\tfullTree: false,\n\t\t\t};\n\t\t\tconst summarizeProps: ISummarizeTelemetryProperties = {\n\t\t\t\tsummarizeReason: reason,\n\t\t\t\tsummaryAttempts: attemptNumber,\n\t\t\t\t...summarizeOptions,\n\t\t\t\tfinalAttempt,\n\t\t\t};\n\t\t\tconst summaryLogger = createChildLogger({\n\t\t\t\tlogger: this.mc.logger,\n\t\t\t\tproperties: { all: summarizeProps },\n\t\t\t});\n\t\t\tconst summaryOptions: ISubmitSummaryOptions = {\n\t\t\t\t...summarizeOptions,\n\t\t\t\tsummaryLogger,\n\t\t\t\tcancellationToken: this.cancellationToken,\n\t\t\t\tfinalAttempt,\n\t\t\t};\n\t\t\tconst summarizeResult = this.generator.summarize(summaryOptions);\n\t\t\treturn { summarizeProps, summarizeResult };\n\t\t};\n\n\t\t// The max number of attempts are based on the stage at which summarization failed. If it fails before it is\n\t\t// submitted, a different value is used compared to if it fails after submission. Usually, in the former case,\n\t\t// we would retry more often as its cheaper and retries are likely to succeed.\n\t\t// This makes it harder to predict how many attempts would actually happen as that depends on how far an attempt\n\t\t// made. To keep things simple, the max attempts is reset after every attempt based on where it failed. This may\n\t\t// result in some failures not being retried depending on what happened before this attempt. That's fine because\n\t\t// such scenarios are very unlikely and even if it happens, it would resolve when a new summarizer starts over.\n\t\t// For example - When failure switches from one the submit failures to nack failure, only one more retry will\n\t\t// happen irrespective of the value of `defaultMaxAttempts`.\n\t\tlet maxAttempts = defaultMaxAttempts;\n\t\tlet currentAttempt = 0;\n\t\tlet retryAfterSeconds: number | undefined;\n\t\tlet done = false;\n\t\tlet result: \"success\" | \"failure\" | \"canceled\" = \"success\";\n\t\tdo {\n\t\t\tcurrentAttempt++;\n\t\t\tif (this.cancellationToken.cancelled) {\n\t\t\t\tresult = \"canceled\";\n\t\t\t\tdone = true;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst { summarizeProps, summarizeResult } = attemptSummarize(\n\t\t\t\tcurrentAttempt,\n\t\t\t\tfalse /* finalAttempt */,\n\t\t\t);\n\n\t\t\t// Ack / nack is the final step, so if it succeeds we're done.\n\t\t\tconst ackNackResult = await summarizeResult.receivedSummaryAckOrNack;\n\t\t\tif (ackNackResult.success) {\n\t\t\t\tresult = \"success\";\n\t\t\t\tdone = true;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Update max attempts and retry params from the failure result.\n\t\t\t// If submit summary failed, use the params from \"summarySubmitted\" result. Else, use the params\n\t\t\t// from \"receivedSummaryAckOrNack\" result.\n\t\t\t// Note: Check \"summarySubmitted\" result first because if it fails, ack nack would fail as well.\n\t\t\tconst submitSummaryResult = await summarizeResult.summarySubmitted;\n\t\t\tif (!submitSummaryResult.success) {\n\t\t\t\tmaxAttempts = this.maxAttemptsForSubmitFailures;\n\t\t\t\tretryAfterSeconds = submitSummaryResult.data?.retryAfterSeconds;\n\t\t\t} else {\n\t\t\t\tmaxAttempts = defaultMaxAttempts;\n\t\t\t\tretryAfterSeconds = ackNackResult.data?.retryAfterSeconds;\n\t\t\t}\n\n\t\t\t// Emit \"summarize\" event for this failed attempt.\n\t\t\tresult = \"failure\";\n\t\t\tconst eventProps: ISummarizeEventProps = {\n\t\t\t\tresult,\n\t\t\t\tcurrentAttempt,\n\t\t\t\tmaxAttempts,\n\t\t\t\terror: ackNackResult.error,\n\t\t\t};\n\t\t\tthis.emit(\"summarize\", eventProps);\n\n\t\t\t// If the failure doesn't have \"retryAfterSeconds\" or the max number of attempts have been done, we're done.\n\t\t\tif (retryAfterSeconds === undefined || currentAttempt >= maxAttempts - 1) {\n\t\t\t\tdone = true;\n\t\t\t}\n\n\t\t\t// If the failure has \"retryAfterSeconds\", add a delay of that time. In this case, a final attempt will\n\t\t\t// take place and we need to wait for \"retryAfterSeconds\" before that.\n\t\t\tif (retryAfterSeconds !== undefined) {\n\t\t\t\tthis.mc.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"SummarizeAttemptDelay\",\n\t\t\t\t\tduration: retryAfterSeconds,\n\t\t\t\t\tsummaryNackDelay: ackNackResult.data?.retryAfterSeconds !== undefined,\n\t\t\t\t\tstage: submitSummaryResult.data?.stage,\n\t\t\t\t\tdynamicRetries: true, // To differentiate this telemetry from regular retry logic\n\t\t\t\t\t...summarizeProps,\n\t\t\t\t});\n\t\t\t\tawait delay(retryAfterSeconds * 1000);\n\t\t\t}\n\t\t} while (!done);\n\n\t\t// If summarize attempt did not fail, emit \"summarize\" event and return. A failed attempt may be retried below.\n\t\tif (result !== \"failure\") {\n\t\t\tthis.emit(\"summarize\", { result, currentAttempt, maxAttempts });\n\t\t\treturn;\n\t\t}\n\n\t\t// If summarization wasn't successful above and the failure contains \"retryAfterSeconds\", perform one last\n\t\t// attempt. This gives a chance to the runtime to perform additional steps in the last attempt.\n\t\tif (retryAfterSeconds !== undefined) {\n\t\t\tconst { summarizeResult } = attemptSummarize(++currentAttempt, true /* finalAttempt */);\n\t\t\t// Ack / nack is the final step, so if it succeeds we're done.\n\t\t\tconst ackNackResult = await summarizeResult.receivedSummaryAckOrNack;\n\t\t\tresult = ackNackResult.success ? \"success\" : \"failure\";\n\t\t\tconst eventProps: ISummarizeEventProps = {\n\t\t\t\tresult,\n\t\t\t\tcurrentAttempt,\n\t\t\t\tmaxAttempts,\n\t\t\t\terror: ackNackResult.success ? undefined : ackNackResult.error,\n\t\t\t};\n\t\t\tthis.emit(\"summarize\", eventProps);\n\t\t}\n\n\t\t// If summarization is still unsuccessful, stop the summarizer.\n\t\tif (result === \"failure\") {\n\t\t\tthis.stopSummarizerCallback(\"failToSummarize\");\n\t\t}\n\t}\n\n\t/** {@inheritdoc (ISummarizer:interface).summarizeOnDemand} */\n\tpublic summarizeOnDemand(\n\t\toptions: IOnDemandSummarizeOptions,\n\t\tresultsBuilder: SummarizeResultBuilder = new SummarizeResultBuilder(),\n\t): ISummarizeResults {\n\t\tif (this.stopping) {\n\t\t\tresultsBuilder.fail(\"RunningSummarizer stopped or disposed\", undefined);\n\t\t\treturn resultsBuilder.build();\n\t\t}\n\t\t// Check for concurrent summary attempts. If one is found,\n\t\t// return a promise that caller can await before trying again.\n\t\tif (this.summarizingLock !== undefined) {\n\t\t\t// The heuristics are blocking concurrent summarize attempts.\n\t\t\tthrow new UsageError(\"Attempted to run an already-running summarizer on demand\");\n\t\t}\n\n\t\tconst { reason, ...summarizeOptions } = options;\n\t\tconst result = this.trySummarizeOnce(\n\t\t\t{ summarizeReason: `onDemand/${reason}` },\n\t\t\tsummarizeOptions,\n\t\t\tresultsBuilder,\n\t\t);\n\t\treturn result;\n\t}\n\n\t/** {@inheritdoc (ISummarizer:interface).enqueueSummarize} */\n\tpublic enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n\t\tconst { reason, afterSequenceNumber = 0, override = false, ...summarizeOptions } = options;\n\t\tlet overridden = false;\n\t\tif (this.enqueuedSummary !== undefined) {\n\t\t\tif (!override) {\n\t\t\t\treturn { alreadyEnqueued: true };\n\t\t\t}\n\t\t\t// Override existing enqueued summarize attempt.\n\t\t\tthis.enqueuedSummary.resultsBuilder.fail(\n\t\t\t\t\"Aborted; overridden by another enqueue summarize attempt\",\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\tthis.enqueuedSummary = undefined;\n\t\t\toverridden = true;\n\t\t}\n\n\t\tthis.enqueuedSummary = {\n\t\t\treason: `enqueue;${reason}`,\n\t\t\tafterSequenceNumber,\n\t\t\tsummarizeOptions,\n\t\t\tresultsBuilder: new SummarizeResultBuilder(),\n\t\t};\n\t\tconst results = this.enqueuedSummary.resultsBuilder.build();\n\t\tthis.tryRunEnqueuedSummary();\n\t\treturn overridden\n\t\t\t? {\n\t\t\t\t\t...results,\n\t\t\t\t\talreadyEnqueued: true,\n\t\t\t\t\toverridden: true,\n\t\t\t }\n\t\t\t: results;\n\t}\n\n\tprivate tryRunEnqueuedSummary() {\n\t\tif (this.stopping) {\n\t\t\tthis.disposeEnqueuedSummary();\n\t\t\treturn false;\n\t\t}\n\t\tif (\n\t\t\tthis.enqueuedSummary === undefined ||\n\t\t\tthis.heuristicData.lastOpSequenceNumber < this.enqueuedSummary.afterSequenceNumber ||\n\t\t\tthis.summarizingLock !== undefined\n\t\t) {\n\t\t\t// If no enqueued summary is ready or a summary is already in progress, take no action.\n\t\t\treturn false;\n\t\t}\n\t\tconst { reason, resultsBuilder, summarizeOptions } = this.enqueuedSummary;\n\t\t// Set to undefined first, so that subsequent enqueue attempt while summarize will occur later.\n\t\tthis.enqueuedSummary = undefined;\n\t\tthis.trySummarizeOnce(\n\t\t\t{ summarizeReason: `enqueuedSummary/${reason}` },\n\t\t\tsummarizeOptions,\n\t\t\tresultsBuilder,\n\t\t);\n\t\treturn true;\n\t}\n\n\tprivate disposeEnqueuedSummary() {\n\t\tif (this.enqueuedSummary !== undefined) {\n\t\t\tthis.enqueuedSummary.resultsBuilder.fail(\n\t\t\t\t\"RunningSummarizer stopped or disposed\",\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\tthis.enqueuedSummary = undefined;\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"runningSummarizer.js","sourceRoot":"","sources":["../../src/summary/runningSummarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qEAMyC;AACzC,2DAAmF;AACnF,+DAAiE;AACjE,2EAAsE;AACtE,+EAA8F;AAE9F,kDAAyC;AACzC,iEAAkE;AAqBlE,yDAK4B;AAE5B,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAE7D;;;GAGG;AACU,QAAA,kBAAkB,GAAG,CAAC,CAAC;AACpC;;;GAGG;AACU,QAAA,mCAAmC,GAAG,CAAC,CAAC;AAErD;;;;;;GAMG;AACH,MAAa,iBAAkB,SAAQ,gCAAoC;IACnE,MAAM,CAAC,KAAK,CAAC,KAAK,CACxB,MAA4B,EAC5B,cAAqC,EACrC,aAAoC,EACpC,qBAAuF,EACvF,+BAAsF,EACtF,aAAsC,EACtC,iBAAoC,EACpC,iBAA4C,EAC5C,sBAA8D,EAC9D,OAA2B;QAE3B,MAAM,UAAU,GAAG,IAAI,iBAAiB,CACvC,MAAM,EACN,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,+BAA+B,EAC/B,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,OAAO,CACP,CAAC;QAEF,0GAA0G;QAC1G,4FAA4F;QAC5F,MAAM,aAAa,GAAG,MAAM,UAAU,C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ACF,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QAC5D,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC7B,OAAO,UAAU;YAChB,CAAC,CAAC;gBACA,GAAG,OAAO;gBACV,eAAe,EAAE,IAAI;gBACrB,UAAU,EAAE,IAAI;aACf;YACH,CAAC,CAAC,OAAO,CAAC;IACZ,CAAC;IAEO,qBAAqB;QAC5B,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;SACb;QACD,IACC,IAAI,CAAC,eAAe,KAAK,SAAS;YAClC,IAAI,CAAC,aAAa,CAAC,oBAAoB,GAAG,IAAI,CAAC,eAAe,CAAC,mBAAmB;YAClF,IAAI,CAAC,eAAe,KAAK,SAAS,EACjC;YACD,uFAAuF;YACvF,OAAO,KAAK,CAAC;SACb;QACD,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC;QAC1E,+FAA+F;QAC/F,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,IAAI,CAAC,gBAAgB,CACpB,EAAE,eAAe,EAAE,mBAAmB,MAAM,EAAE,EAAE,EAChD,gBAAgB,EAChB,cAAc,CACd,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IAEO,sBAAsB;QAC7B,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE;YACvC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,IAAI,CACvC,uCAAuC,EACvC,SAAS,CACT,CAAC;YACF,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;SACjC;IACF,CAAC;CACD;AAr3BD,8CAq3BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport {\n\tisFluidError,\n\tMonitoringContext,\n\tcreateChildMonitoringContext,\n\tcreateChildLogger,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert, delay, Deferred, PromiseTimer } from \"@fluidframework/core-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryConfiguration } from \"../containerRuntime\";\nimport { opSize } from \"../opProperties\";\nimport { SummarizeHeuristicRunner } from \"./summarizerHeuristics\";\nimport {\n\tIEnqueueSummarizeOptions,\n\tISummarizeOptions,\n\tISummarizeHeuristicData,\n\tISummarizeHeuristicRunner,\n\tIOnDemandSummarizeOptions,\n\tEnqueueSummarizeResult,\n\tSummarizerStopReason,\n\tISubmitSummaryOptions,\n\tSubmitSummaryResult,\n\tISummaryCancellationToken,\n\tISummarizeResults,\n\tISummarizeTelemetryProperties,\n\tISummarizerRuntime,\n\tISummarizeRunnerTelemetry,\n\tIRefreshSummaryAckOptions,\n\tISummarizerEvents,\n\tISummarizeEventProps,\n} from \"./summarizerTypes\";\nimport { IAckedSummary, IClientSummaryWatcher, SummaryCollection } from \"./summaryCollection\";\nimport {\n\traceTimer,\n\tSummarizeReason,\n\tSummarizeResultBuilder,\n\tSummaryGenerator,\n} from \"./summaryGenerator\";\n\nconst maxSummarizeAckWaitTime = 10 * 60 * 1000; // 10 minutes\n\n/**\n * The maximum number of summarization attempts that will be done by default in case of failures\n * that can be retried.\n */\nexport const defaultMaxAttempts = 2;\n/**\n * The default value for maximum number of summarization attempts that will be done for summarization failures where\n * submit fails and the failure can be retried.\n */\nexport const defaultMaxAttemptsForSubmitFailures = 5;\n\n/**\n * An instance of RunningSummarizer manages the heuristics for summarizing.\n * Until disposed, the instance of RunningSummarizer can assume that it is\n * in a state of running, meaning it is connected and initialized. It keeps\n * track of summaries that it is generating as they are broadcast and acked/nacked.\n * This object is created and controlled by Summarizer object.\n */\nexport class RunningSummarizer extends TypedEventEmitter<ISummarizerEvents> implements IDisposable {\n\tpublic static async start(\n\t\tlogger: ITelemetryBaseLogger,\n\t\tsummaryWatcher: IClientSummaryWatcher,\n\t\tconfiguration: ISummaryConfiguration,\n\t\tsubmitSummaryCallback: (options: ISubmitSummaryOptions) => Promise<SubmitSummaryResult>,\n\t\trefreshLatestSummaryAckCallback: (options: IRefreshSummaryAckOptions) => Promise<void>,\n\t\theuristicData: ISummarizeHeuristicData,\n\t\tsummaryCollection: SummaryCollection,\n\t\tcancellationToken: ISummaryCancellationToken,\n\t\tstopSummarizerCallback: (reason: SummarizerStopReason) => void,\n\t\truntime: ISummarizerRuntime,\n\t): Promise<RunningSummarizer> {\n\t\tconst summarizer = new RunningSummarizer(\n\t\t\tlogger,\n\t\t\tsummaryWatcher,\n\t\t\tconfiguration,\n\t\t\tsubmitSummaryCallback,\n\t\t\trefreshLatestSummaryAckCallback,\n\t\t\theuristicData,\n\t\t\tsummaryCollection,\n\t\t\tcancellationToken,\n\t\t\tstopSummarizerCallback,\n\t\t\truntime,\n\t\t);\n\n\t\t// Before doing any heuristics or proceeding with its refreshing, if there is a summary ack received while\n\t\t// this summarizer catches up, let's refresh state before proceeding with the summarization.\n\t\tconst lastAckRefSeq = await summarizer.handleSummaryAck();\n\n\t\tawait summarizer.waitStart();\n\n\t\t// Handle summary acks asynchronously\n\t\t// Note: no exceptions are thrown from processIncomingSummaryAcks handler as it handles all exceptions\n\t\tsummarizer.processIncomingSummaryAcks(lastAckRefSeq).catch((error) => {\n\t\t\tcreateChildLogger({ logger }).sendErrorEvent(\n\t\t\t\t{ eventName: \"HandleSummaryAckFatalError\" },\n\t\t\t\terror,\n\t\t\t);\n\t\t});\n\n\t\t// Update heuristic counts\n\t\t// By the time we get here, there are potentially ops missing from the heuristic summary counts\n\t\t// Examples of where this could happen:\n\t\t// 1. Op is processed during the time that we are initiating the RunningSummarizer instance but before we\n\t\t// listen for the op events (will get missed by the handlers in the current workflow)\n\t\t// 2. Op was sequenced after the last time we summarized (op sequence number > summarize ref sequence number)\n\t\tconst diff =\n\t\t\truntime.deltaManager.lastSequenceNumber -\n\t\t\t(heuristicData.lastSuccessfulSummary.refSequenceNumber +\n\t\t\t\theuristicData.numNonRuntimeOps +\n\t\t\t\theuristicData.numRuntimeOps);\n\t\theuristicData.hasMissingOpData = diff > 0;\n\n\t\tif (heuristicData.hasMissingOpData) {\n\t\t\t// Split the diff 50-50 and increment the counts appropriately\n\t\t\theuristicData.numNonRuntimeOps += Math.ceil(diff / 2);\n\t\t\theuristicData.numRuntimeOps += Math.floor(diff / 2);\n\t\t}\n\n\t\t// Update last seq number (in case the handlers haven't processed anything yet)\n\t\theuristicData.lastOpSequenceNumber = runtime.deltaManager.lastSequenceNumber;\n\n\t\t// Start heuristics\n\t\tsummarizer.heuristicRunner?.start();\n\t\tsummarizer.heuristicRunner?.run();\n\n\t\treturn summarizer;\n\t}\n\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\tprivate stopping = false;\n\tprivate _disposed = false;\n\tprivate summarizingLock: Promise<void> | undefined;\n\tprivate tryWhileSummarizing = false;\n\tprivate readonly pendingAckTimer: PromiseTimer;\n\tprivate heuristicRunner?: ISummarizeHeuristicRunner;\n\tprivate readonly generator: SummaryGenerator;\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate enqueuedSummary:\n\t\t| {\n\t\t\t\treason: SummarizeReason;\n\t\t\t\tafterSequenceNumber: number;\n\t\t\t\tsummarizeOptions: ISummarizeOptions;\n\t\t\t\treadonly resultsBuilder: SummarizeResultBuilder;\n\t\t }\n\t\t| undefined;\n\tprivate summarizeCount = 0;\n\tprivate totalSuccessfulAttempts = 0;\n\tprivate initialized = false;\n\n\tprivate readonly runtimeListener;\n\n\t/** The maximum number of summary attempts to do when submit summary fails. */\n\tprivate readonly maxAttemptsForSubmitFailures: number;\n\n\tprivate constructor(\n\t\tbaseLogger: ITelemetryBaseLogger,\n\t\tprivate readonly summaryWatcher: IClientSummaryWatcher,\n\t\tprivate readonly configuration: ISummaryConfiguration,\n\t\tprivate readonly submitSummaryCallback: (\n\t\t\toptions: ISubmitSummaryOptions,\n\t\t) => Promise<SubmitSummaryResult>,\n\t\tprivate readonly refreshLatestSummaryAckCallback: (\n\t\t\toptions: IRefreshSummaryAckOptions,\n\t\t) => Promise<void>,\n\t\tprivate readonly heuristicData: ISummarizeHeuristicData,\n\t\tprivate readonly summaryCollection: SummaryCollection,\n\t\tprivate readonly cancellationToken: ISummaryCancellationToken,\n\t\tprivate readonly stopSummarizerCallback: (reason: SummarizerStopReason) => void,\n\t\tprivate readonly runtime: ISummarizerRuntime,\n\t) {\n\t\tsuper();\n\n\t\tconst telemetryProps: ISummarizeRunnerTelemetry = {\n\t\t\tsummarizeCount: () => this.summarizeCount,\n\t\t\tsummarizerSuccessfulAttempts: () => this.totalSuccessfulAttempts,\n\t\t};\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: baseLogger,\n\t\t\tnamespace: \"Running\",\n\t\t\tproperties: {\n\t\t\t\tall: telemetryProps,\n\t\t\t},\n\t\t});\n\n\t\tif (configuration.state !== \"disableHeuristics\") {\n\t\t\tassert(\n\t\t\t\tthis.configuration.state === \"enabled\",\n\t\t\t\t0x2ea /* \"Configuration state should be enabled\" */,\n\t\t\t);\n\t\t\tthis.heuristicRunner = new SummarizeHeuristicRunner(\n\t\t\t\theuristicData,\n\t\t\t\tthis.configuration,\n\t\t\t\t(reason) => this.trySummarize(reason),\n\t\t\t\tthis.mc.logger,\n\t\t\t);\n\t\t}\n\n\t\tassert(\n\t\t\tthis.configuration.state !== \"disabled\",\n\t\t\t0x2eb /* \"Summary not supported with configuration disabled\" */,\n\t\t);\n\n\t\t// Cap the maximum amount of time client will wait for a summarize op ack to maxSummarizeAckWaitTime\n\t\t// configuration.maxAckWaitTime is composed from defaults, server values, and runtime overrides\n\n\t\tconst maxAckWaitTime = Math.min(this.configuration.maxAckWaitTime, maxSummarizeAckWaitTime);\n\n\t\tthis.pendingAckTimer = new PromiseTimer(maxAckWaitTime, () => {\n\t\t\t// Note: summarizeCount (from ChildLogger definition) may be 0,\n\t\t\t// since this code path is hit when RunningSummarizer first starts up,\n\t\t\t// before this instance has kicked off a new summarize run.\n\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\teventName: \"SummaryAckWaitTimeout\",\n\t\t\t\tmessage: \"Pending summary ack not received in time\",\n\t\t\t\tmaxAckWaitTime,\n\t\t\t\treferenceSequenceNumber: this.heuristicData.lastAttempt.refSequenceNumber,\n\t\t\t\tsummarySequenceNumber: this.heuristicData.lastAttempt.summarySequenceNumber,\n\t\t\t\ttimePending: Date.now() - this.heuristicData.lastAttempt.summaryTime,\n\t\t\t});\n\t\t});\n\t\t// Set up pending ack timeout by op timestamp differences for previous summaries.\n\t\tsummaryCollection.setPendingAckTimerTimeoutCallback(maxAckWaitTime, () => {\n\t\t\tif (this.pendingAckTimer.hasTimer) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"MissingSummaryAckFoundByOps\",\n\t\t\t\t\treferenceSequenceNumber: this.heuristicData.lastAttempt.refSequenceNumber,\n\t\t\t\t\tsummarySequenceNumber: this.heuristicData.lastAttempt.summarySequenceNumber,\n\t\t\t\t});\n\t\t\t\tthis.pendingAckTimer.clear();\n\t\t\t}\n\t\t});\n\n\t\tthis.generator = new SummaryGenerator(\n\t\t\tthis.pendingAckTimer,\n\t\t\tthis.heuristicData,\n\t\t\tthis.submitSummaryCallback,\n\t\t\t() => {\n\t\t\t\tthis.totalSuccessfulAttempts++;\n\t\t\t},\n\t\t\tthis.summaryWatcher,\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\t// Listen to runtime for ops\n\t\tthis.runtimeListener = (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => {\n\t\t\tthis.handleOp(op, runtimeMessage === true);\n\t\t};\n\t\tthis.runtime.on(\"op\", this.runtimeListener);\n\n\t\t// The max attempts for submit failures can be overridden via a feature flag. This allows us to\n\t\t// tweak this as per telemetry data until we arrive at a stable number.\n\t\t// If its set to a number higher than `defaultMaxAttemptsForSubmitFailures`, it will be ignored.\n\t\tconst overrideMaxAttempts = this.mc.config.getNumber(\n\t\t\t\"Fluid.Summarizer.AttemptsForSubmitFailures\",\n\t\t);\n\t\tthis.maxAttemptsForSubmitFailures =\n\t\t\toverrideMaxAttempts && overrideMaxAttempts < defaultMaxAttemptsForSubmitFailures\n\t\t\t\t? overrideMaxAttempts\n\t\t\t\t: defaultMaxAttemptsForSubmitFailures;\n\t}\n\n\tprivate async handleSummaryAck(): Promise<number> {\n\t\tconst lastAck: IAckedSummary | undefined = this.summaryCollection.latestAck;\n\t\tlet refSequenceNumber = -1;\n\t\t// In case we haven't received the lastestAck yet, just return.\n\t\tif (lastAck !== undefined) {\n\t\t\trefSequenceNumber = lastAck.summaryOp.referenceSequenceNumber;\n\t\t\tconst summaryLogger = this.tryGetCorrelatedLogger(refSequenceNumber) ?? this.mc.logger;\n\t\t\tconst summaryOpHandle = lastAck.summaryOp.contents.handle;\n\t\t\tconst summaryAckHandle = lastAck.summaryAck.contents.handle;\n\t\t\twhile (this.summarizingLock !== undefined) {\n\t\t\t\tsummaryLogger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"RefreshAttemptWithSummarizerRunning\",\n\t\t\t\t\treferenceSequenceNumber: refSequenceNumber,\n\t\t\t\t\tproposalHandle: summaryOpHandle,\n\t\t\t\t\tackHandle: summaryAckHandle,\n\t\t\t\t});\n\t\t\t\tawait this.summarizingLock;\n\t\t\t}\n\n\t\t\t// Make sure we block any summarizer from being executed/enqueued while\n\t\t\t// executing the refreshLatestSummaryAck.\n\t\t\t// https://dev.azure.com/fluidframework/internal/_workitems/edit/779\n\t\t\tawait this.lockedSummaryAction(\n\t\t\t\t() => {},\n\t\t\t\tasync () =>\n\t\t\t\t\tthis.refreshLatestSummaryAckCallback({\n\t\t\t\t\t\tproposalHandle: summaryOpHandle,\n\t\t\t\t\t\tackHandle: summaryAckHandle,\n\t\t\t\t\t\tsummaryRefSeq: refSequenceNumber,\n\t\t\t\t\t\tsummaryLogger,\n\t\t\t\t\t}).catch(async (error) => {\n\t\t\t\t\t\t// If the error is 404, so maybe the fetched version no longer exists on server. We just\n\t\t\t\t\t\t// ignore this error in that case, as that means we will have another summaryAck for the\n\t\t\t\t\t\t// latest version with which we will refresh the state. However in case of single commit\n\t\t\t\t\t\t// summary, we might me missing a summary ack, so in that case we are still fine as the\n\t\t\t\t\t\t// code in `submitSummary` function in container runtime, will refresh the latest state\n\t\t\t\t\t\t// by calling `prefetchLatestSummaryThenClose`. We will load the next summarizer from the\n\t\t\t\t\t\t// updated state and be fine.\n\t\t\t\t\t\tconst isIgnoredError =\n\t\t\t\t\t\t\tisFluidError(error) &&\n\t\t\t\t\t\t\terror.errorType === DriverErrorTypes.fileNotFoundOrAccessDeniedError;\n\n\t\t\t\t\t\tsummaryLogger.sendTelemetryEvent(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\teventName: isIgnoredError\n\t\t\t\t\t\t\t\t\t? \"HandleSummaryAckErrorIgnored\"\n\t\t\t\t\t\t\t\t\t: \"HandleLastSummaryAckError\",\n\t\t\t\t\t\t\t\treferenceSequenceNumber: refSequenceNumber,\n\t\t\t\t\t\t\t\tproposalHandle: summaryOpHandle,\n\t\t\t\t\t\t\t\tackHandle: summaryAckHandle,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t() => {},\n\t\t\t);\n\t\t\trefSequenceNumber++;\n\t\t}\n\t\treturn refSequenceNumber;\n\t}\n\n\t/**\n\t * Responsible for receiving and processing all the summaryAcks.\n\t * In case there was a summary ack processed by the running summarizer before processIncomingSummaryAcks is called,\n\t * it will wait for the summary ack that is newer than the one indicated by the lastAckRefSeq.\n\t * @param lastAckRefSeq - Identifies the minimum reference sequence number the summarizer needs to wait for.\n\t * In case of a negative number, the summarizer will wait for ANY summary ack that is greater than the deltaManager's initial sequence number,\n\t * and, in case of a positive one, it will wait for a summary ack that is greater than this current reference sequence number.\n\t */\n\tprivate async processIncomingSummaryAcks(lastAckRefSeq: number) {\n\t\tlet refSequenceNumber =\n\t\t\tlastAckRefSeq > 0 ? lastAckRefSeq : this.runtime.deltaManager.initialSequenceNumber;\n\t\twhile (!this.disposed) {\n\t\t\tconst summaryLogger = this.tryGetCorrelatedLogger(refSequenceNumber) ?? this.mc.logger;\n\n\t\t\t// Initialize ack with undefined if exception happens inside of waitSummaryAck on second iteration,\n\t\t\t// we record undefined, not previous handles.\n\t\t\tawait this.summaryCollection.waitSummaryAck(refSequenceNumber);\n\n\t\t\tsummaryLogger.sendTelemetryEvent({\n\t\t\t\teventName: \"processIncomingSummaryAcks\",\n\t\t\t\treferenceSequenceNumber: refSequenceNumber,\n\t\t\t\tlastAckRefSeq,\n\t\t\t});\n\n\t\t\trefSequenceNumber = await this.handleSummaryAck();\n\t\t\t// A valid Summary Ack must have been processed.\n\t\t\tassert(refSequenceNumber >= 0, 0x58f /* Invalid ref sequence number */);\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.runtime.off(\"op\", this.runtimeListener);\n\t\tthis.summaryWatcher.dispose();\n\t\tthis.heuristicRunner?.dispose();\n\t\tthis.heuristicRunner = undefined;\n\t\tthis.generator.dispose();\n\t\tthis.pendingAckTimer.clear();\n\t\tthis.disposeEnqueuedSummary();\n\t\tthis._disposed = true;\n\t\tthis.stopping = true;\n\t}\n\n\t/**\n\t * RunningSummarizer's logger includes the sequenced index of the current summary on each event.\n\t * If some other Summarizer code wants that event on their logs they can get it here,\n\t * but only if they're logging about that same summary.\n\t * @param summaryOpRefSeq - RefSeq number of the summary op, to ensure the log correlation will be correct\n\t */\n\tpublic tryGetCorrelatedLogger = (summaryOpRefSeq) =>\n\t\tthis.heuristicData.lastAttempt.refSequenceNumber === summaryOpRefSeq\n\t\t\t? this.mc.logger\n\t\t\t: undefined;\n\n\t/** We only want a single heuristic runner micro-task (will provide better optimized grouping of ops) */\n\tprivate heuristicRunnerMicroTaskExists = false;\n\n\tpublic handleOp(op: ISequencedDocumentMessage, runtimeMessage: boolean) {\n\t\tthis.heuristicData.lastOpSequenceNumber = op.sequenceNumber;\n\n\t\tif (runtimeMessage) {\n\t\t\tthis.heuristicData.numRuntimeOps++;\n\t\t} else {\n\t\t\tthis.heuristicData.numNonRuntimeOps++;\n\t\t}\n\n\t\tthis.heuristicData.totalOpsSize += opSize(op);\n\n\t\t// Check for enqueued on-demand summaries; Intentionally do nothing otherwise\n\t\tif (\n\t\t\tthis.initialized &&\n\t\t\tthis.opCanTriggerSummary(op, runtimeMessage) &&\n\t\t\t!this.tryRunEnqueuedSummary() &&\n\t\t\t!this.heuristicRunnerMicroTaskExists\n\t\t) {\n\t\t\tthis.heuristicRunnerMicroTaskExists = true;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\tPromise.resolve()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis.heuristicRunner?.run();\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tthis.heuristicRunnerMicroTaskExists = false;\n\t\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Can the given op trigger a summary?\n\t * # Currently always prevents summaries for Summarize and SummaryAck/Nack ops\n\t * @param op - op to check\n\t * @returns true if this op can trigger a summary\n\t */\n\tprivate opCanTriggerSummary(op: ISequencedDocumentMessage, runtimeMessage: boolean): boolean {\n\t\tswitch (op.type) {\n\t\t\tcase MessageType.Summarize:\n\t\t\tcase MessageType.SummaryAck:\n\t\t\tcase MessageType.SummaryNack:\n\t\t\t\treturn false;\n\t\t\tdefault:\n\t\t\t\treturn runtimeMessage || this.nonRuntimeOpCanTriggerSummary();\n\t\t}\n\t}\n\n\tprivate nonRuntimeOpCanTriggerSummary(): boolean {\n\t\tconst opsSinceLastAck =\n\t\t\tthis.heuristicData.lastOpSequenceNumber -\n\t\t\tthis.heuristicData.lastSuccessfulSummary.refSequenceNumber;\n\t\treturn (\n\t\t\tthis.configuration.state === \"enabled\" &&\n\t\t\t(this.configuration.nonRuntimeHeuristicThreshold === undefined ||\n\t\t\t\tthis.configuration.nonRuntimeHeuristicThreshold <= opsSinceLastAck)\n\t\t);\n\t}\n\n\tpublic async waitStop(allowLastSummary: boolean): Promise<void> {\n\t\tif (this.stopping) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.stopping = true;\n\n\t\tthis.disposeEnqueuedSummary();\n\n\t\t// This will try to run lastSummary if needed.\n\t\tif (allowLastSummary && this.heuristicRunner?.shouldRunLastSummary()) {\n\t\t\tif (this.summarizingLock === undefined) {\n\t\t\t\tthis.trySummarizeOnce(\n\t\t\t\t\t// summarizeProps\n\t\t\t\t\t{ summarizeReason: \"lastSummary\" },\n\t\t\t\t\t// ISummarizeOptions, using defaults: { refreshLatestAck: false, fullTree: false }\n\t\t\t\t\t{},\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Note that trySummarizeOnce() call above returns right away, without waiting.\n\t\t// So we need to wait for its completion, otherwise it would be destroyed right away.\n\t\t// That said, if summary lock was taken upfront, this wait might wait on multiple retries to\n\t\t// submit summary. We should reconsider this flow and make summarizer move to exit faster.\n\t\t// This resolves when the current pending summary gets an ack or fails.\n\t\tawait this.summarizingLock;\n\t}\n\n\tprivate async waitStart() {\n\t\t// Wait no longer than ack timeout for all pending\n\t\tconst waitStartResult = await raceTimer(\n\t\t\tthis.summaryWatcher.waitFlushed(),\n\t\t\tthis.pendingAckTimer.start(),\n\t\t);\n\t\tthis.pendingAckTimer.clear();\n\n\t\t// Remove pending ack wait timeout by op timestamp comparison, because\n\t\t// it has race conditions with summaries submitted by this same client.\n\t\tthis.summaryCollection.unsetPendingAckTimerTimeoutCallback();\n\n\t\tif (waitStartResult.result === \"done\" && waitStartResult.value !== undefined) {\n\t\t\tthis.heuristicData.updateWithLastSummaryAckInfo({\n\t\t\t\trefSequenceNumber: waitStartResult.value.summaryOp.referenceSequenceNumber,\n\t\t\t\t// This will be the Summarizer starting point so only use timestamps from client's machine.\n\t\t\t\tsummaryTime: Date.now(),\n\t\t\t\tsummarySequenceNumber: waitStartResult.value.summaryOp.sequenceNumber,\n\t\t\t});\n\t\t}\n\t\tthis.initialized = true;\n\t}\n\n\tprivate beforeSummaryAction() {\n\t\tthis.summarizeCount++;\n\t}\n\n\tprivate afterSummaryAction() {\n\t\tconst retry = this.tryWhileSummarizing;\n\t\tthis.tryWhileSummarizing = false;\n\n\t\t// After summarizing, we should check to see if we need to summarize again.\n\t\t// Rerun the heuristics and check for enqueued summaries.\n\t\tif (!this.stopping && !this.tryRunEnqueuedSummary() && retry) {\n\t\t\tthis.heuristicRunner?.run();\n\t\t}\n\t}\n\n\t/**\n\t * Runs single summary action that prevents any other concurrent actions.\n\t * Assumes that caller checked upfront for lack of concurrent action (this.summarizingLock)\n\t * before calling this API. I.e. caller is responsible for either erroring out or waiting on this promise.\n\t * @param before - set of instructions to run before running the action.\n\t * @param action - action to perform.\n\t * @param after - set of instructions to run after running the action.\n\t * @returns The result of the action.\n\t */\n\tprivate async lockedSummaryAction<T>(\n\t\tbefore: () => void,\n\t\taction: () => Promise<T>,\n\t\tafter: () => void,\n\t) {\n\t\tassert(\n\t\t\tthis.summarizingLock === undefined,\n\t\t\t0x25b /* \"Caller is responsible for checking lock\" */,\n\t\t);\n\n\t\tconst summarizingLock = new Deferred<void>();\n\t\tthis.summarizingLock = summarizingLock.promise;\n\n\t\tbefore();\n\n\t\treturn action().finally(() => {\n\t\t\tsummarizingLock.resolve();\n\t\t\tthis.summarizingLock = undefined;\n\t\t\tafter();\n\t\t});\n\t}\n\n\t/**\n\t * Runs single summarize attempt\n\t * @param summarizeProps - props to log with each telemetry event associated with this attempt\n\t * @param options - summary options\n\t * @param cancellationToken - cancellation token to use to be able to cancel this summary, if needed\n\t * @param resultsBuilder - optional, result builder to use.\n\t * @returns ISummarizeResult - result of running a summary.\n\t */\n\tprivate trySummarizeOnce(\n\t\tsummarizeProps: ISummarizeTelemetryProperties,\n\t\toptions: ISummarizeOptions,\n\t\tresultsBuilder = new SummarizeResultBuilder(),\n\t): ISummarizeResults {\n\t\tthis.lockedSummaryAction(\n\t\t\t() => {\n\t\t\t\tthis.beforeSummaryAction();\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst summaryLogger = createChildLogger({\n\t\t\t\t\tlogger: this.mc.logger,\n\t\t\t\t\tproperties: { all: summarizeProps },\n\t\t\t\t});\n\t\t\t\tconst summaryOptions: ISubmitSummaryOptions = {\n\t\t\t\t\t...options,\n\t\t\t\t\tsummaryLogger,\n\t\t\t\t\tcancellationToken: this.cancellationToken,\n\t\t\t\t};\n\t\t\t\tconst summarizeResult = this.generator.summarize(summaryOptions, resultsBuilder);\n\t\t\t\t// ensure we wait till the end of the process\n\t\t\t\treturn summarizeResult.receivedSummaryAckOrNack;\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis.afterSummaryAction();\n\t\t\t},\n\t\t).catch((error) => {\n\t\t\t// SummaryGenerator.summarize() does not throw exceptions - it converts them to failed result\n\t\t\t// on resultsBuilder\n\t\t\t// We do not care about exceptions on receivedSummaryAckOrNack - caller should check results\n\t\t\t// and take a appropriate action.\n\t\t});\n\n\t\treturn resultsBuilder.build();\n\t}\n\n\t/** Heuristics summarize attempt. */\n\tprivate trySummarize(reason: SummarizeReason): void {\n\t\tif (this.summarizingLock !== undefined) {\n\t\t\t// lockedSummaryAction() will retry heuristic-based summary at the end of current attempt\n\t\t\t// if it's still needed\n\t\t\tthis.tryWhileSummarizing = true;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.lockedSummaryAction(\n\t\t\t() => {\n\t\t\t\tthis.beforeSummaryAction();\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\treturn this.mc.config.getBoolean(\"Fluid.Summarizer.UseDynamicRetries\")\n\t\t\t\t\t? this.trySummarizeWithRetries(reason)\n\t\t\t\t\t: this.trySummarizeWithStaticAttempts(reason);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis.afterSummaryAction();\n\t\t\t},\n\t\t).catch((error) => {\n\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"UnexpectedSummarizeError\" }, error);\n\t\t});\n\t}\n\n\t/**\n\t * Tries to summarize 2 times with pre-defined summary options. If an attempt fails with \"retryAfterSeconds\"\n\t * param, that attempt is tried once more.\n\t */\n\tprivate async trySummarizeWithStaticAttempts(reason: SummarizeReason) {\n\t\tconst attemptOptions: ISummarizeOptions[] = [\n\t\t\t{ refreshLatestAck: false, fullTree: false },\n\t\t\t{ refreshLatestAck: true, fullTree: false },\n\t\t];\n\t\tlet summaryAttempts = 0;\n\t\tlet summaryAttemptsPerPhase = 0;\n\t\tlet summaryAttemptPhase = 0;\n\t\twhile (summaryAttemptPhase < attemptOptions.length) {\n\t\t\tif (this.cancellationToken.cancelled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// We only want to attempt 1 summary when reason is \"lastSummary\"\n\t\t\tif (++summaryAttempts > 1 && reason === \"lastSummary\") {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsummaryAttemptsPerPhase++;\n\n\t\t\tconst summarizeOptions = attemptOptions[summaryAttemptPhase];\n\t\t\tconst summarizeProps: ISummarizeTelemetryProperties = {\n\t\t\t\tsummarizeReason: reason,\n\t\t\t\tsummaryAttempts,\n\t\t\t\tsummaryAttemptsPerPhase,\n\t\t\t\tsummaryAttemptPhase: summaryAttemptPhase + 1, // make everything 1-based\n\t\t\t\t...summarizeOptions,\n\t\t\t};\n\t\t\tconst summaryLogger = createChildLogger({\n\t\t\t\tlogger: this.mc.logger,\n\t\t\t\tproperties: { all: summarizeProps },\n\t\t\t});\n\t\t\tconst summaryOptions: ISubmitSummaryOptions = {\n\t\t\t\t...summarizeOptions,\n\t\t\t\tsummaryLogger,\n\t\t\t\tcancellationToken: this.cancellationToken,\n\t\t\t};\n\n\t\t\t// Note: no need to account for cancellationToken.waitCancelled here, as\n\t\t\t// this is accounted SummaryGenerator.summarizeCore that controls receivedSummaryAckOrNack.\n\t\t\tconst resultSummarize = this.generator.summarize(summaryOptions);\n\t\t\tconst ackNackResult = await resultSummarize.receivedSummaryAckOrNack;\n\t\t\tif (ackNackResult.success) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Check for retryDelay that can come from summaryNack, upload summary or submit summary flows.\n\t\t\t// Retry the same step only once per retryAfter response.\n\t\t\tconst submitResult = await resultSummarize.summarySubmitted;\n\t\t\tconst delaySeconds = !submitResult.success\n\t\t\t\t? submitResult.data?.retryAfterSeconds\n\t\t\t\t: ackNackResult.data?.retryAfterSeconds;\n\t\t\tif (delaySeconds === undefined || summaryAttemptsPerPhase > 1) {\n\t\t\t\tsummaryAttemptPhase++;\n\t\t\t\tsummaryAttemptsPerPhase = 0;\n\t\t\t}\n\n\t\t\tif (delaySeconds !== undefined) {\n\t\t\t\tthis.mc.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"SummarizeAttemptDelay\",\n\t\t\t\t\tduration: delaySeconds,\n\t\t\t\t\tsummaryNackDelay: ackNackResult.data?.retryAfterSeconds !== undefined,\n\t\t\t\t\t...summarizeProps,\n\t\t\t\t});\n\t\t\t\tawait delay(delaySeconds * 1000);\n\t\t\t}\n\t\t}\n\t\tthis.stopSummarizerCallback(\"failToSummarize\");\n\t}\n\n\t/**\n\t * Tries to summarize with retries where retry is based on the failure params.\n\t * For example, summarization may be retried for failures with \"retryAfterSeconds\" param.\n\t */\n\tprivate async trySummarizeWithRetries(\n\t\treason: SummarizeReason,\n\t): Promise<ISummarizeResults | undefined> {\n\t\t// Helper to set summarize options, telemetry properties and call summarize.\n\t\tconst attemptSummarize = (attemptNumber: number, finalAttempt: boolean) => {\n\t\t\tconst summarizeOptions: ISummarizeOptions = {\n\t\t\t\tfullTree: false,\n\t\t\t};\n\t\t\tconst summarizeProps: ISummarizeTelemetryProperties = {\n\t\t\t\tsummarizeReason: reason,\n\t\t\t\tsummaryAttempts: attemptNumber,\n\t\t\t\t...summarizeOptions,\n\t\t\t\tfinalAttempt,\n\t\t\t};\n\t\t\tconst summaryLogger = createChildLogger({\n\t\t\t\tlogger: this.mc.logger,\n\t\t\t\tproperties: { all: summarizeProps },\n\t\t\t});\n\t\t\tconst summaryOptions: ISubmitSummaryOptions = {\n\t\t\t\t...summarizeOptions,\n\t\t\t\tsummaryLogger,\n\t\t\t\tcancellationToken: this.cancellationToken,\n\t\t\t\tfinalAttempt,\n\t\t\t};\n\t\t\tconst summarizeResult = this.generator.summarize(summaryOptions);\n\t\t\treturn { summarizeProps, summarizeResult };\n\t\t};\n\n\t\t// The max number of attempts are based on the stage at which summarization failed. If it fails before it is\n\t\t// submitted, a different value is used compared to if it fails after submission. Usually, in the former case,\n\t\t// we would retry more often as its cheaper and retries are likely to succeed.\n\t\t// This makes it harder to predict how many attempts would actually happen as that depends on how far an attempt\n\t\t// made. To keep things simple, the max attempts is reset after every attempt based on where it failed. This may\n\t\t// result in some failures not being retried depending on what happened before this attempt. That's fine because\n\t\t// such scenarios are very unlikely and even if it happens, it would resolve when a new summarizer starts over.\n\t\t// For example - When failure switches from one the submit failures to nack failure, only one more retry will\n\t\t// happen irrespective of the value of `defaultMaxAttempts`.\n\t\tlet maxAttempts = defaultMaxAttempts;\n\t\tlet currentAttempt = 0;\n\t\tlet retryAfterSeconds: number | undefined;\n\t\tlet done = false;\n\t\tlet status: \"success\" | \"failure\" | \"canceled\" = \"success\";\n\t\tlet results: ISummarizeResults | undefined;\n\t\tdo {\n\t\t\tcurrentAttempt++;\n\t\t\tif (this.cancellationToken.cancelled) {\n\t\t\t\tstatus = \"canceled\";\n\t\t\t\tdone = true;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst attemptResult = attemptSummarize(currentAttempt, false /* finalAttempt */);\n\t\t\tresults = attemptResult.summarizeResult;\n\n\t\t\t// Ack / nack is the final step, so if it succeeds we're done.\n\t\t\tconst ackNackResult = await results.receivedSummaryAckOrNack;\n\t\t\tif (ackNackResult.success) {\n\t\t\t\tstatus = \"success\";\n\t\t\t\tdone = true;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Update max attempts and retry params from the failure result.\n\t\t\t// If submit summary failed, use the params from \"summarySubmitted\" result. Else, use the params\n\t\t\t// from \"receivedSummaryAckOrNack\" result.\n\t\t\t// Note: Check \"summarySubmitted\" result first because if it fails, ack nack would fail as well.\n\t\t\tconst submitSummaryResult = await results.summarySubmitted;\n\t\t\tif (!submitSummaryResult.success) {\n\t\t\t\tmaxAttempts = this.maxAttemptsForSubmitFailures;\n\t\t\t\tretryAfterSeconds = submitSummaryResult.data?.retryAfterSeconds;\n\t\t\t} else {\n\t\t\t\tmaxAttempts = defaultMaxAttempts;\n\t\t\t\tretryAfterSeconds = ackNackResult.data?.retryAfterSeconds;\n\t\t\t}\n\n\t\t\t// Emit \"summarize\" event for this failed attempt.\n\t\t\tstatus = \"failure\";\n\t\t\tconst eventProps: ISummarizeEventProps = {\n\t\t\t\tresult: status,\n\t\t\t\tcurrentAttempt,\n\t\t\t\tmaxAttempts,\n\t\t\t\terror: ackNackResult.error,\n\t\t\t};\n\t\t\tthis.emit(\"summarize\", eventProps);\n\n\t\t\t// If the failure doesn't have \"retryAfterSeconds\" or the max number of attempts have been done, we're done.\n\t\t\tif (retryAfterSeconds === undefined || currentAttempt >= maxAttempts - 1) {\n\t\t\t\tdone = true;\n\t\t\t}\n\n\t\t\t// If the failure has \"retryAfterSeconds\", add a delay of that time. In this case, a final attempt will\n\t\t\t// take place and we need to wait for \"retryAfterSeconds\" before that.\n\t\t\tif (retryAfterSeconds !== undefined) {\n\t\t\t\tthis.mc.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"SummarizeAttemptDelay\",\n\t\t\t\t\tduration: retryAfterSeconds,\n\t\t\t\t\tsummaryNackDelay: ackNackResult.data?.retryAfterSeconds !== undefined,\n\t\t\t\t\tstage: submitSummaryResult.data?.stage,\n\t\t\t\t\tdynamicRetries: true, // To differentiate this telemetry from regular retry logic\n\t\t\t\t\t...attemptResult.summarizeProps,\n\t\t\t\t});\n\t\t\t\tawait delay(retryAfterSeconds * 1000);\n\t\t\t}\n\t\t} while (!done);\n\n\t\t// If summarize attempt did not fail, emit \"summarize\" event and return. A failed attempt may be retried below.\n\t\tif (status !== \"failure\") {\n\t\t\tthis.emit(\"summarize\", { result: status, currentAttempt, maxAttempts });\n\t\t\treturn results;\n\t\t}\n\n\t\t// If summarization wasn't successful above and the failure contains \"retryAfterSeconds\", perform one last\n\t\t// attempt. This gives a chance to the runtime to perform additional steps in the last attempt.\n\t\tif (retryAfterSeconds !== undefined) {\n\t\t\tconst { summarizeResult } = attemptSummarize(++currentAttempt, true /* finalAttempt */);\n\t\t\t// Ack / nack is the final step, so if it succeeds we're done.\n\t\t\tconst ackNackResult = await summarizeResult.receivedSummaryAckOrNack;\n\t\t\tstatus = ackNackResult.success ? \"success\" : \"failure\";\n\t\t\tconst eventProps: ISummarizeEventProps = {\n\t\t\t\tresult: status,\n\t\t\t\tcurrentAttempt,\n\t\t\t\tmaxAttempts,\n\t\t\t\terror: ackNackResult.success ? undefined : ackNackResult.error,\n\t\t\t};\n\t\t\tthis.emit(\"summarize\", eventProps);\n\t\t\tresults = summarizeResult;\n\t\t}\n\n\t\t// If summarization is still unsuccessful, stop the summarizer.\n\t\tif (status === \"failure\") {\n\t\t\tthis.stopSummarizerCallback(\"failToSummarize\");\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Attempts to generate a summary on demand with retries in case of failures. The retry logic is the same\n\t * as heuristics based summaries.\n\t */\n\tprivate async summarizeOnDemandWithRetries(\n\t\treason: SummarizeReason,\n\t\tresultsBuilder: SummarizeResultBuilder,\n\t) {\n\t\tconst results = await this.trySummarizeWithRetries(reason);\n\t\tif (results === undefined) {\n\t\t\tresultsBuilder.fail(\"Summarization was canceled\", undefined);\n\t\t\treturn resultsBuilder.build();\n\t\t}\n\t\tconst submitResult = await results.summarySubmitted;\n\t\tconst summaryOpBroadcastedResult = await results.summaryOpBroadcasted;\n\t\tconst ackNackResult = await results.receivedSummaryAckOrNack;\n\t\tresultsBuilder.summarySubmitted.resolve(submitResult);\n\t\tresultsBuilder.summaryOpBroadcasted.resolve(summaryOpBroadcastedResult);\n\t\tresultsBuilder.receivedSummaryAckOrNack.resolve(ackNackResult);\n\t\treturn resultsBuilder.build();\n\t}\n\n\t/** {@inheritdoc (ISummarizer:interface).summarizeOnDemand} */\n\tpublic summarizeOnDemand(\n\t\toptions: IOnDemandSummarizeOptions,\n\t\tresultsBuilder: SummarizeResultBuilder = new SummarizeResultBuilder(),\n\t): ISummarizeResults {\n\t\tif (this.stopping) {\n\t\t\tresultsBuilder.fail(\"RunningSummarizer stopped or disposed\", undefined);\n\t\t\treturn resultsBuilder.build();\n\t\t}\n\t\t// Check for concurrent summary attempts. If one is found,\n\t\t// return a promise that caller can await before trying again.\n\t\tif (this.summarizingLock !== undefined) {\n\t\t\t// The heuristics are blocking concurrent summarize attempts.\n\t\t\tthrow new UsageError(\"Attempted to run an already-running summarizer on demand\");\n\t\t}\n\n\t\tconst { reason, ...summarizeOptions } = options;\n\t\tif (options.retryOnFailure === true) {\n\t\t\tthis.summarizeOnDemandWithRetries(`onDemand;${reason}`, resultsBuilder).catch(\n\t\t\t\t(error) => {\n\t\t\t\t\tresultsBuilder.fail(\"summarize failed\", error);\n\t\t\t\t},\n\t\t\t);\n\t\t} else {\n\t\t\tthis.trySummarizeOnce(\n\t\t\t\t{ summarizeReason: `onDemand/${reason}` },\n\t\t\t\tsummarizeOptions,\n\t\t\t\tresultsBuilder,\n\t\t\t);\n\t\t}\n\t\treturn resultsBuilder.build();\n\t}\n\n\t/** {@inheritdoc (ISummarizer:interface).enqueueSummarize} */\n\tpublic enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n\t\tconst { reason, afterSequenceNumber = 0, override = false, ...summarizeOptions } = options;\n\t\tlet overridden = false;\n\t\tif (this.enqueuedSummary !== undefined) {\n\t\t\tif (!override) {\n\t\t\t\treturn { alreadyEnqueued: true };\n\t\t\t}\n\t\t\t// Override existing enqueued summarize attempt.\n\t\t\tthis.enqueuedSummary.resultsBuilder.fail(\n\t\t\t\t\"Aborted; overridden by another enqueue summarize attempt\",\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\tthis.enqueuedSummary = undefined;\n\t\t\toverridden = true;\n\t\t}\n\n\t\tthis.enqueuedSummary = {\n\t\t\treason: `enqueue;${reason}`,\n\t\t\tafterSequenceNumber,\n\t\t\tsummarizeOptions,\n\t\t\tresultsBuilder: new SummarizeResultBuilder(),\n\t\t};\n\t\tconst results = this.enqueuedSummary.resultsBuilder.build();\n\t\tthis.tryRunEnqueuedSummary();\n\t\treturn overridden\n\t\t\t? {\n\t\t\t\t\t...results,\n\t\t\t\t\talreadyEnqueued: true,\n\t\t\t\t\toverridden: true,\n\t\t\t }\n\t\t\t: results;\n\t}\n\n\tprivate tryRunEnqueuedSummary() {\n\t\tif (this.stopping) {\n\t\t\tthis.disposeEnqueuedSummary();\n\t\t\treturn false;\n\t\t}\n\t\tif (\n\t\t\tthis.enqueuedSummary === undefined ||\n\t\t\tthis.heuristicData.lastOpSequenceNumber < this.enqueuedSummary.afterSequenceNumber ||\n\t\t\tthis.summarizingLock !== undefined\n\t\t) {\n\t\t\t// If no enqueued summary is ready or a summary is already in progress, take no action.\n\t\t\treturn false;\n\t\t}\n\t\tconst { reason, resultsBuilder, summarizeOptions } = this.enqueuedSummary;\n\t\t// Set to undefined first, so that subsequent enqueue attempt while summarize will occur later.\n\t\tthis.enqueuedSummary = undefined;\n\t\tthis.trySummarizeOnce(\n\t\t\t{ summarizeReason: `enqueuedSummary/${reason}` },\n\t\t\tsummarizeOptions,\n\t\t\tresultsBuilder,\n\t\t);\n\t\treturn true;\n\t}\n\n\tprivate disposeEnqueuedSummary() {\n\t\tif (this.enqueuedSummary !== undefined) {\n\t\t\tthis.enqueuedSummary.resultsBuilder.fail(\n\t\t\t\t\"RunningSummarizer stopped or disposed\",\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\tthis.enqueuedSummary = undefined;\n\t\t}\n\t}\n}\n"]}
|
|
@@ -21,7 +21,7 @@ export declare const createSummarizingWarning: (errorMessage: string, logged: bo
|
|
|
21
21
|
* Summarizer is responsible for coordinating when to generate and send summaries.
|
|
22
22
|
* It is the main entry point for summary work.
|
|
23
23
|
* It is created only by summarizing container (i.e. one with clientType === "summarizer")
|
|
24
|
-
* @
|
|
24
|
+
* @alpha
|
|
25
25
|
*/
|
|
26
26
|
export declare class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {
|
|
27
27
|
/** Reference to runtime that created this object.
|
|
@@ -31,7 +31,7 @@ exports.createSummarizingWarning = createSummarizingWarning;
|
|
|
31
31
|
* Summarizer is responsible for coordinating when to generate and send summaries.
|
|
32
32
|
* It is the main entry point for summary work.
|
|
33
33
|
* It is created only by summarizing container (i.e. one with clientType === "summarizer")
|
|
34
|
-
* @
|
|
34
|
+
* @alpha
|
|
35
35
|
*/
|
|
36
36
|
class Summarizer extends client_utils_1.TypedEventEmitter {
|
|
37
37
|
get ISummarizer() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizer.js","sourceRoot":"","sources":["../../src/summary/summarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAsD;AACtD,+DAAiE;AACjE,qEAOyC;AAKzC,2DAAwD;AAgBxD,iEAAgE;AAChE,yDAA4D;AAE5D,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAE5C,MAAa,kBACZ,SAAQ,8BAAY;IAMpB,YACC,YAAoB,EACX,SAAkB,KAAK;QAEhC,KAAK,CAAC,YAAY,CAAC,CAAC;QAFX,WAAM,GAAN,MAAM,CAAiB;QALxB,cAAS,GAAG,gBAAgB,CAAC;QAC7B,aAAQ,GAAG,IAAI,CAAC;IAOzB,CAAC;IAED,MAAM,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,EAC9B;YACD,MAAM,IAAI,4BAAU,CAAC,gDAAgD,CAAC,CAAC;SACvE;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAEM,oBAAoB,CAAE,gBAAyB;QACrD,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACtD,CAAC;CACD;AA1RD,gCA0RC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Deferred } from \"@fluidframework/core-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n\tIFluidErrorBase,\n\tLoggingError,\n\tUsageError,\n\twrapErrorAndLog,\n} from \"@fluidframework/telemetry-utils\";\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces\";\nimport { ISummaryConfiguration } from \"../containerRuntime\";\nimport { ICancellableSummarizerController } from \"./runWhileConnectedCoordinator\";\nimport { SummaryCollection } from \"./summaryCollection\";\nimport { RunningSummarizer } from \"./runningSummarizer\";\nimport {\n\tIConnectableRuntime,\n\tISummarizer,\n\tISummarizeHeuristicData,\n\tISummarizerInternalsProvider,\n\tISummarizerRuntime,\n\tISummarizingWarning,\n\tSummarizerStopReason,\n\tIOnDemandSummarizeOptions,\n\tISummarizeResults,\n\tIEnqueueSummarizeOptions,\n\tEnqueueSummarizeResult,\n\tISummarizerEvents,\n\tISummarizeEventProps,\n} from \"./summarizerTypes\";\nimport { SummarizeHeuristicData } from \"./summarizerHeuristics\";\nimport { SummarizeResultBuilder } from \"./summaryGenerator\";\n\nconst summarizingError = \"summarizingError\";\n\nexport class SummarizingWarning\n\textends LoggingError\n\timplements ISummarizingWarning, IFluidErrorBase\n{\n\treadonly errorType = summarizingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\terrorMessage: string,\n\t\treadonly logged: boolean = false,\n\t) {\n\t\tsuper(errorMessage);\n\t}\n\n\tstatic wrap(error: any, logged: boolean = false, logger: ITelemetryLoggerExt) {\n\t\tconst newErrorFn = (errMsg: string) => new SummarizingWarning(errMsg, logged);\n\t\treturn wrapErrorAndLog<SummarizingWarning>(error, newErrorFn, logger);\n\t}\n}\n\nexport const createSummarizingWarning = (errorMessage: string, logged: boolean) =>\n\tnew SummarizingWarning(errorMessage, logged);\n\n/**\n * Summarizer is responsible for coordinating when to generate and send summaries.\n * It is the main entry point for summary work.\n * It is created only by summarizing container (i.e. one with clientType === \"summarizer\")\n * @internal\n */\nexport class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {\n\tpublic get ISummarizer() {\n\t\treturn this;\n\t}\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate runningSummarizer?: RunningSummarizer;\n\tprivate _disposed: boolean = false;\n\tprivate starting: boolean = false;\n\n\tprivate readonly stopDeferred = new Deferred<SummarizerStopReason>();\n\n\tconstructor(\n\t\t/** Reference to runtime that created this object.\n\t\t * i.e. runtime with clientType === \"summarizer\"\n\t\t */\n\t\tprivate readonly runtime: ISummarizerRuntime,\n\t\tprivate readonly configurationGetter: () => ISummaryConfiguration,\n\t\t/** Represents an object that can generate summary.\n\t\t * In practical terms, it's same runtime (this.runtime) with clientType === \"summarizer\".\n\t\t */\n\t\tprivate readonly internalsProvider: ISummarizerInternalsProvider,\n\t\thandleContext: IFluidHandleContext,\n\t\tpublic readonly summaryCollection: SummaryCollection,\n\t\tprivate readonly runCoordinatorCreateFn: (\n\t\t\truntime: IConnectableRuntime,\n\t\t) => Promise<ICancellableSummarizerController>,\n\t) {\n\t\tsuper();\n\t\tthis.logger = createChildLogger({ logger: this.runtime.logger, namespace: \"Summarizer\" });\n\t}\n\n\tpublic async run(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\ttry {\n\t\t\treturn await this.runCore(onBehalfOf);\n\t\t} catch (error) {\n\t\t\tthis.stop(\"summarizerException\");\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t} finally {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\t/**\n\t * Stops the summarizer from running. This will complete\n\t * the run promise, and also close the container.\n\t * @param reason - reason code for stopping\n\t */\n\tpublic stop(reason: SummarizerStopReason) {\n\t\tthis.stopDeferred.resolve(reason);\n\t}\n\n\tpublic close() {\n\t\t// This will result in \"summarizerClientDisconnected\" stop reason recorded in telemetry,\n\t\t// unless stop() was called earlier\n\t\tthis.dispose();\n\t\tthis.runtime.disposeFn();\n\t}\n\n\tprivate async runCore(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\tconst runCoordinator: ICancellableSummarizerController = await this.runCoordinatorCreateFn(\n\t\t\tthis.runtime,\n\t\t);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopP = Promise.race([runCoordinator.waitCancelled, this.stopDeferred.promise]);\n\t\tvoid stopP.then((reason) => {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"StoppingSummarizer\",\n\t\t\t\tonBehalfOf,\n\t\t\t\treason,\n\t\t\t});\n\t\t});\n\n\t\tif (runCoordinator.cancelled) {\n\t\t\treturn runCoordinator.waitCancelled;\n\t\t}\n\n\t\tconst runningSummarizer = await this.start(onBehalfOf, runCoordinator);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopReason = await stopP;\n\n\t\t// There are two possible approaches here:\n\t\t// 1. Propagate cancellation from this.stopDeferred to runCoordinator. This will ensure that we move to the exit\n\t\t// faster, including breaking out of the RunningSummarizer.trySummarize() faster.\n\t\t// We could create new coordinator and pass it to waitStop() -> trySummarizeOnce(\"lastSummary\") flow.\n\t\t// The con of this approach is that we might cancel active summary, and lastSummary will fail because it\n\t\t// did not wait for ack/nack from previous summary. Plus we disregard any 429 kind of info from service\n\t\t// that way (i.e. trySummarize() loop might have been waiting for 5 min because storage told us so).\n\t\t// In general, it's more wasted resources.\n\t\t// 2. We can not do it and make waitStop() do last summary only if there was no active summary. This ensures\n\t\t// that client behaves properly (from server POV) and we do not waste resources. But, it may mean we wait\n\t\t// substantially longer for trySummarize() retries to play out and thus this summary loop may run into\n\t\t// conflict with new summarizer client starting on different client.\n\t\t// As of now, #2 is implemented. It's more forward looking, as issue #7279 suggests changing design for new\n\t\t// summarizer client to not be created until current summarizer fully moves to exit, and that would reduce\n\t\t// cons of #2 substantially.\n\n\t\t// Cleanup after running\n\t\tawait runningSummarizer.waitStop(\n\t\t\t!runCoordinator.cancelled && Summarizer.stopReasonCanRunLastSummary(stopReason),\n\t\t);\n\n\t\t// Propagate reason and ensure that if someone is waiting for cancellation token, they are moving to exit\n\t\trunCoordinator.stop(stopReason);\n\n\t\treturn stopReason;\n\t}\n\n\t/**\n\t * Should we try to run a last summary for the given stop reason?\n\t * Currently only allows \"parentNotConnected\"\n\t * @param stopReason - SummarizerStopReason\n\t * @returns `true` if the stop reason can run a last summary, otherwise `false`.\n\t */\n\tpublic static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean {\n\t\treturn stopReason === \"parentNotConnected\";\n\t}\n\n\tprivate _heuristicData: ISummarizeHeuristicData | undefined;\n\n\t/**\n\t * Put the summarizer in a started state, including creating and initializing the RunningSummarizer.\n\t * The start request can come either from the SummaryManager (in the auto-summarize case) or from the user\n\t * (in the on-demand case).\n\t * @param onBehalfOf - ID of the client that requested that the summarizer start\n\t * @param runCoordinator - cancellation token\n\t * @param newConfig - Summary configuration to override the existing config when invoking the RunningSummarizer.\n\t * @returns A promise that is fulfilled when the RunningSummarizer is ready.\n\t */\n\tprivate async start(\n\t\tonBehalfOf: string,\n\t\trunCoordinator: ICancellableSummarizerController,\n\t): Promise<RunningSummarizer> {\n\t\tif (this.runningSummarizer) {\n\t\t\tif (this.runningSummarizer.disposed) {\n\t\t\t\tthrow new UsageError(\"Starting a disposed summarizer\");\n\t\t\t}\n\t\t\treturn this.runningSummarizer;\n\t\t}\n\t\tif (this.starting) {\n\t\t\tthrow new UsageError(\"Attempting to start a summarizer that is already starting\");\n\t\t}\n\t\tthis.starting = true;\n\t\t// Initialize values and first ack (time is not exact)\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"RunningSummarizer\",\n\t\t\tonBehalfOf,\n\t\t\tinitSummarySeqNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\tconfig: JSON.stringify(this.configurationGetter()),\n\t\t});\n\n\t\t// Summarizing container ID (with clientType === \"summarizer\")\n\t\tconst clientId = this.runtime.clientId;\n\t\tif (clientId === undefined) {\n\t\t\tthrow new UsageError(\"clientId should be defined if connected.\");\n\t\t}\n\n\t\tthis._heuristicData = new SummarizeHeuristicData(\n\t\t\tthis.runtime.deltaManager.lastSequenceNumber,\n\t\t\t{\n\t\t\t\t/** summary attempt baseline for heuristics */\n\t\t\t\trefSequenceNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\t\tsummaryTime: Date.now(),\n\t\t\t} as const,\n\t\t);\n\n\t\tconst runningSummarizer = await RunningSummarizer.start(\n\t\t\tthis.logger,\n\t\t\tthis.summaryCollection.createWatcher(clientId),\n\t\t\tthis.configurationGetter(),\n\t\t\tasync (...args) => this.internalsProvider.submitSummary(...args), // submitSummaryCallback\n\t\t\tasync (...args) => this.internalsProvider.refreshLatestSummaryAck(...args), // refreshLatestSummaryCallback\n\t\t\tthis._heuristicData,\n\t\t\tthis.summaryCollection,\n\t\t\trunCoordinator /* cancellationToken */,\n\t\t\t(reason) => runCoordinator.stop(reason) /* stopSummarizerCallback */,\n\t\t\tthis.runtime,\n\t\t);\n\t\tthis.runningSummarizer = runningSummarizer;\n\t\tthis.runningSummarizer.on(\"summarize\", this.handleSummarizeEvent);\n\t\tthis.starting = false;\n\t\treturn runningSummarizer;\n\t}\n\n\tprivate readonly handleSummarizeEvent = (eventProps: ISummarizeEventProps) => {\n\t\tthis.emit(\"summarize\", eventProps);\n\t};\n\n\t/**\n\t * Disposes of resources after running. This cleanup will\n\t * clear any outstanding timers and reset some of the state\n\t * properties.\n\t * Called by ContainerRuntime when it is disposed, as well as at the end the run().\n\t */\n\tpublic dispose() {\n\t\t// Given that the call can come from own ContainerRuntime, ensure that we stop all the processes.\n\t\tthis.stop(\"summarizerClientDisconnected\");\n\n\t\tthis._disposed = true;\n\t\tif (this.runningSummarizer) {\n\t\t\tthis.runningSummarizer.off(\"summarize\", this.handleSummarizeEvent);\n\t\t\tthis.runningSummarizer.dispose();\n\t\t\tthis.runningSummarizer = undefined;\n\t\t}\n\t}\n\n\tpublic summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults {\n\t\ttry {\n\t\t\tif (this._disposed || this.runningSummarizer?.disposed) {\n\t\t\t\tthrow new UsageError(\"Summarizer is already disposed.\");\n\t\t\t}\n\t\t\tif (\n\t\t\t\tthis.runtime.summarizerClientId !== undefined &&\n\t\t\t\tthis.runtime.summarizerClientId !== this.runtime.clientId\n\t\t\t) {\n\t\t\t\t// If there is an elected summarizer, and it's not this one, don't allow on-demand summary.\n\t\t\t\t// This is to prevent the on-demand summary and heuristic-based summary from stepping on\n\t\t\t\t// each other.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"On-demand summary attempted while an elected summarizer is present\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst builder = new SummarizeResultBuilder();\n\t\t\tif (this.runningSummarizer) {\n\t\t\t\t// Summarizer is already running. Go ahead and start.\n\t\t\t\treturn this.runningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t}\n\n\t\t\t// Summarizer isn't running, so we need to start it, which is an async operation.\n\t\t\t// Manage the promise related to creating the cancellation token here.\n\t\t\t// The promises related to starting, summarizing,\n\t\t\t// and submitting are communicated to the caller through the results builder.\n\t\t\tconst coordinatorCreateP = this.runCoordinatorCreateFn(this.runtime);\n\n\t\t\tcoordinatorCreateP\n\t\t\t\t.then((runCoordinator) => {\n\t\t\t\t\t// Successfully created the cancellation token. Start the summarizer.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst startP = this.start(this.runtime.clientId!, runCoordinator);\n\t\t\t\t\tstartP\n\t\t\t\t\t\t.then(async (runningSummarizer) => {\n\t\t\t\t\t\t\t// Successfully started the summarizer. Run it.\n\t\t\t\t\t\t\trunningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t\t\t\t\t// Wait for a command to stop or loss of connectivity before tearing down the summarizer and client.\n\t\t\t\t\t\t\tconst stopReason = await Promise.race([\n\t\t\t\t\t\t\t\tthis.stopDeferred.promise,\n\t\t\t\t\t\t\t\trunCoordinator.waitCancelled,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\tawait runningSummarizer.waitStop(false);\n\t\t\t\t\t\t\trunCoordinator.stop(stopReason);\n\t\t\t\t\t\t\tthis.close();\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((reason) => {\n\t\t\t\t\t\t\tbuilder.fail(\"Failed to start summarizer\", reason);\n\t\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.catch((reason) => {\n\t\t\t\t\tbuilder.fail(\"Failed to create cancellation token\", reason);\n\t\t\t\t});\n\n\t\t\treturn builder.build();\n\t\t} catch (error) {\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t}\n\t}\n\n\tpublic enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n\t\tif (\n\t\t\tthis._disposed ||\n\t\t\tthis.runningSummarizer === undefined ||\n\t\t\tthis.runningSummarizer.disposed\n\t\t) {\n\t\t\tthrow new UsageError(\"Summarizer is not running or already disposed.\");\n\t\t}\n\t\treturn this.runningSummarizer.enqueueSummarize(options);\n\t}\n\n\tpublic recordSummaryAttempt?(summaryRefSeqNum?: number) {\n\t\tthis._heuristicData?.recordAttempt(summaryRefSeqNum);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"summarizer.js","sourceRoot":"","sources":["../../src/summary/summarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;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AAC,CAAC;YAC7D,CAAC,CAAC,CAAC;YAEJ,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;SACvB;QAAC,OAAO,KAAK,EAAE;YACf,MAAM,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;SACtE;IACF,CAAC;IAEM,gBAAgB,CAAC,OAAiC;QACxD,IACC,IAAI,CAAC,SAAS;YACd,IAAI,CAAC,iBAAiB,KAAK,SAAS;YACpC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAC9B;YACD,MAAM,IAAI,4BAAU,CAAC,gDAAgD,CAAC,CAAC;SACvE;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAEM,oBAAoB,CAAE,gBAAyB;QACrD,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACtD,CAAC;CACD;AA1RD,gCA0RC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Deferred } from \"@fluidframework/core-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n\tIFluidErrorBase,\n\tLoggingError,\n\tUsageError,\n\twrapErrorAndLog,\n} from \"@fluidframework/telemetry-utils\";\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces\";\nimport { ISummaryConfiguration } from \"../containerRuntime\";\nimport { ICancellableSummarizerController } from \"./runWhileConnectedCoordinator\";\nimport { SummaryCollection } from \"./summaryCollection\";\nimport { RunningSummarizer } from \"./runningSummarizer\";\nimport {\n\tIConnectableRuntime,\n\tISummarizer,\n\tISummarizeHeuristicData,\n\tISummarizerInternalsProvider,\n\tISummarizerRuntime,\n\tISummarizingWarning,\n\tSummarizerStopReason,\n\tIOnDemandSummarizeOptions,\n\tISummarizeResults,\n\tIEnqueueSummarizeOptions,\n\tEnqueueSummarizeResult,\n\tISummarizerEvents,\n\tISummarizeEventProps,\n} from \"./summarizerTypes\";\nimport { SummarizeHeuristicData } from \"./summarizerHeuristics\";\nimport { SummarizeResultBuilder } from \"./summaryGenerator\";\n\nconst summarizingError = \"summarizingError\";\n\nexport class SummarizingWarning\n\textends LoggingError\n\timplements ISummarizingWarning, IFluidErrorBase\n{\n\treadonly errorType = summarizingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\terrorMessage: string,\n\t\treadonly logged: boolean = false,\n\t) {\n\t\tsuper(errorMessage);\n\t}\n\n\tstatic wrap(error: any, logged: boolean = false, logger: ITelemetryLoggerExt) {\n\t\tconst newErrorFn = (errMsg: string) => new SummarizingWarning(errMsg, logged);\n\t\treturn wrapErrorAndLog<SummarizingWarning>(error, newErrorFn, logger);\n\t}\n}\n\nexport const createSummarizingWarning = (errorMessage: string, logged: boolean) =>\n\tnew SummarizingWarning(errorMessage, logged);\n\n/**\n * Summarizer is responsible for coordinating when to generate and send summaries.\n * It is the main entry point for summary work.\n * It is created only by summarizing container (i.e. one with clientType === \"summarizer\")\n * @alpha\n */\nexport class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {\n\tpublic get ISummarizer() {\n\t\treturn this;\n\t}\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate runningSummarizer?: RunningSummarizer;\n\tprivate _disposed: boolean = false;\n\tprivate starting: boolean = false;\n\n\tprivate readonly stopDeferred = new Deferred<SummarizerStopReason>();\n\n\tconstructor(\n\t\t/** Reference to runtime that created this object.\n\t\t * i.e. runtime with clientType === \"summarizer\"\n\t\t */\n\t\tprivate readonly runtime: ISummarizerRuntime,\n\t\tprivate readonly configurationGetter: () => ISummaryConfiguration,\n\t\t/** Represents an object that can generate summary.\n\t\t * In practical terms, it's same runtime (this.runtime) with clientType === \"summarizer\".\n\t\t */\n\t\tprivate readonly internalsProvider: ISummarizerInternalsProvider,\n\t\thandleContext: IFluidHandleContext,\n\t\tpublic readonly summaryCollection: SummaryCollection,\n\t\tprivate readonly runCoordinatorCreateFn: (\n\t\t\truntime: IConnectableRuntime,\n\t\t) => Promise<ICancellableSummarizerController>,\n\t) {\n\t\tsuper();\n\t\tthis.logger = createChildLogger({ logger: this.runtime.logger, namespace: \"Summarizer\" });\n\t}\n\n\tpublic async run(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\ttry {\n\t\t\treturn await this.runCore(onBehalfOf);\n\t\t} catch (error) {\n\t\t\tthis.stop(\"summarizerException\");\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t} finally {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\t/**\n\t * Stops the summarizer from running. This will complete\n\t * the run promise, and also close the container.\n\t * @param reason - reason code for stopping\n\t */\n\tpublic stop(reason: SummarizerStopReason) {\n\t\tthis.stopDeferred.resolve(reason);\n\t}\n\n\tpublic close() {\n\t\t// This will result in \"summarizerClientDisconnected\" stop reason recorded in telemetry,\n\t\t// unless stop() was called earlier\n\t\tthis.dispose();\n\t\tthis.runtime.disposeFn();\n\t}\n\n\tprivate async runCore(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\tconst runCoordinator: ICancellableSummarizerController = await this.runCoordinatorCreateFn(\n\t\t\tthis.runtime,\n\t\t);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopP = Promise.race([runCoordinator.waitCancelled, this.stopDeferred.promise]);\n\t\tvoid stopP.then((reason) => {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"StoppingSummarizer\",\n\t\t\t\tonBehalfOf,\n\t\t\t\treason,\n\t\t\t});\n\t\t});\n\n\t\tif (runCoordinator.cancelled) {\n\t\t\treturn runCoordinator.waitCancelled;\n\t\t}\n\n\t\tconst runningSummarizer = await this.start(onBehalfOf, runCoordinator);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopReason = await stopP;\n\n\t\t// There are two possible approaches here:\n\t\t// 1. Propagate cancellation from this.stopDeferred to runCoordinator. This will ensure that we move to the exit\n\t\t// faster, including breaking out of the RunningSummarizer.trySummarize() faster.\n\t\t// We could create new coordinator and pass it to waitStop() -> trySummarizeOnce(\"lastSummary\") flow.\n\t\t// The con of this approach is that we might cancel active summary, and lastSummary will fail because it\n\t\t// did not wait for ack/nack from previous summary. Plus we disregard any 429 kind of info from service\n\t\t// that way (i.e. trySummarize() loop might have been waiting for 5 min because storage told us so).\n\t\t// In general, it's more wasted resources.\n\t\t// 2. We can not do it and make waitStop() do last summary only if there was no active summary. This ensures\n\t\t// that client behaves properly (from server POV) and we do not waste resources. But, it may mean we wait\n\t\t// substantially longer for trySummarize() retries to play out and thus this summary loop may run into\n\t\t// conflict with new summarizer client starting on different client.\n\t\t// As of now, #2 is implemented. It's more forward looking, as issue #7279 suggests changing design for new\n\t\t// summarizer client to not be created until current summarizer fully moves to exit, and that would reduce\n\t\t// cons of #2 substantially.\n\n\t\t// Cleanup after running\n\t\tawait runningSummarizer.waitStop(\n\t\t\t!runCoordinator.cancelled && Summarizer.stopReasonCanRunLastSummary(stopReason),\n\t\t);\n\n\t\t// Propagate reason and ensure that if someone is waiting for cancellation token, they are moving to exit\n\t\trunCoordinator.stop(stopReason);\n\n\t\treturn stopReason;\n\t}\n\n\t/**\n\t * Should we try to run a last summary for the given stop reason?\n\t * Currently only allows \"parentNotConnected\"\n\t * @param stopReason - SummarizerStopReason\n\t * @returns `true` if the stop reason can run a last summary, otherwise `false`.\n\t */\n\tpublic static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean {\n\t\treturn stopReason === \"parentNotConnected\";\n\t}\n\n\tprivate _heuristicData: ISummarizeHeuristicData | undefined;\n\n\t/**\n\t * Put the summarizer in a started state, including creating and initializing the RunningSummarizer.\n\t * The start request can come either from the SummaryManager (in the auto-summarize case) or from the user\n\t * (in the on-demand case).\n\t * @param onBehalfOf - ID of the client that requested that the summarizer start\n\t * @param runCoordinator - cancellation token\n\t * @param newConfig - Summary configuration to override the existing config when invoking the RunningSummarizer.\n\t * @returns A promise that is fulfilled when the RunningSummarizer is ready.\n\t */\n\tprivate async start(\n\t\tonBehalfOf: string,\n\t\trunCoordinator: ICancellableSummarizerController,\n\t): Promise<RunningSummarizer> {\n\t\tif (this.runningSummarizer) {\n\t\t\tif (this.runningSummarizer.disposed) {\n\t\t\t\tthrow new UsageError(\"Starting a disposed summarizer\");\n\t\t\t}\n\t\t\treturn this.runningSummarizer;\n\t\t}\n\t\tif (this.starting) {\n\t\t\tthrow new UsageError(\"Attempting to start a summarizer that is already starting\");\n\t\t}\n\t\tthis.starting = true;\n\t\t// Initialize values and first ack (time is not exact)\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"RunningSummarizer\",\n\t\t\tonBehalfOf,\n\t\t\tinitSummarySeqNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\tconfig: JSON.stringify(this.configurationGetter()),\n\t\t});\n\n\t\t// Summarizing container ID (with clientType === \"summarizer\")\n\t\tconst clientId = this.runtime.clientId;\n\t\tif (clientId === undefined) {\n\t\t\tthrow new UsageError(\"clientId should be defined if connected.\");\n\t\t}\n\n\t\tthis._heuristicData = new SummarizeHeuristicData(\n\t\t\tthis.runtime.deltaManager.lastSequenceNumber,\n\t\t\t{\n\t\t\t\t/** summary attempt baseline for heuristics */\n\t\t\t\trefSequenceNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\t\tsummaryTime: Date.now(),\n\t\t\t} as const,\n\t\t);\n\n\t\tconst runningSummarizer = await RunningSummarizer.start(\n\t\t\tthis.logger,\n\t\t\tthis.summaryCollection.createWatcher(clientId),\n\t\t\tthis.configurationGetter(),\n\t\t\tasync (...args) => this.internalsProvider.submitSummary(...args), // submitSummaryCallback\n\t\t\tasync (...args) => this.internalsProvider.refreshLatestSummaryAck(...args), // refreshLatestSummaryCallback\n\t\t\tthis._heuristicData,\n\t\t\tthis.summaryCollection,\n\t\t\trunCoordinator /* cancellationToken */,\n\t\t\t(reason) => runCoordinator.stop(reason) /* stopSummarizerCallback */,\n\t\t\tthis.runtime,\n\t\t);\n\t\tthis.runningSummarizer = runningSummarizer;\n\t\tthis.runningSummarizer.on(\"summarize\", this.handleSummarizeEvent);\n\t\tthis.starting = false;\n\t\treturn runningSummarizer;\n\t}\n\n\tprivate readonly handleSummarizeEvent = (eventProps: ISummarizeEventProps) => {\n\t\tthis.emit(\"summarize\", eventProps);\n\t};\n\n\t/**\n\t * Disposes of resources after running. This cleanup will\n\t * clear any outstanding timers and reset some of the state\n\t * properties.\n\t * Called by ContainerRuntime when it is disposed, as well as at the end the run().\n\t */\n\tpublic dispose() {\n\t\t// Given that the call can come from own ContainerRuntime, ensure that we stop all the processes.\n\t\tthis.stop(\"summarizerClientDisconnected\");\n\n\t\tthis._disposed = true;\n\t\tif (this.runningSummarizer) {\n\t\t\tthis.runningSummarizer.off(\"summarize\", this.handleSummarizeEvent);\n\t\t\tthis.runningSummarizer.dispose();\n\t\t\tthis.runningSummarizer = undefined;\n\t\t}\n\t}\n\n\tpublic summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults {\n\t\ttry {\n\t\t\tif (this._disposed || this.runningSummarizer?.disposed) {\n\t\t\t\tthrow new UsageError(\"Summarizer is already disposed.\");\n\t\t\t}\n\t\t\tif (\n\t\t\t\tthis.runtime.summarizerClientId !== undefined &&\n\t\t\t\tthis.runtime.summarizerClientId !== this.runtime.clientId\n\t\t\t) {\n\t\t\t\t// If there is an elected summarizer, and it's not this one, don't allow on-demand summary.\n\t\t\t\t// This is to prevent the on-demand summary and heuristic-based summary from stepping on\n\t\t\t\t// each other.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"On-demand summary attempted while an elected summarizer is present\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst builder = new SummarizeResultBuilder();\n\t\t\tif (this.runningSummarizer) {\n\t\t\t\t// Summarizer is already running. Go ahead and start.\n\t\t\t\treturn this.runningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t}\n\n\t\t\t// Summarizer isn't running, so we need to start it, which is an async operation.\n\t\t\t// Manage the promise related to creating the cancellation token here.\n\t\t\t// The promises related to starting, summarizing,\n\t\t\t// and submitting are communicated to the caller through the results builder.\n\t\t\tconst coordinatorCreateP = this.runCoordinatorCreateFn(this.runtime);\n\n\t\t\tcoordinatorCreateP\n\t\t\t\t.then((runCoordinator) => {\n\t\t\t\t\t// Successfully created the cancellation token. Start the summarizer.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst startP = this.start(this.runtime.clientId!, runCoordinator);\n\t\t\t\t\tstartP\n\t\t\t\t\t\t.then(async (runningSummarizer) => {\n\t\t\t\t\t\t\t// Successfully started the summarizer. Run it.\n\t\t\t\t\t\t\trunningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t\t\t\t\t// Wait for a command to stop or loss of connectivity before tearing down the summarizer and client.\n\t\t\t\t\t\t\tconst stopReason = await Promise.race([\n\t\t\t\t\t\t\t\tthis.stopDeferred.promise,\n\t\t\t\t\t\t\t\trunCoordinator.waitCancelled,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\tawait runningSummarizer.waitStop(false);\n\t\t\t\t\t\t\trunCoordinator.stop(stopReason);\n\t\t\t\t\t\t\tthis.close();\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((reason) => {\n\t\t\t\t\t\t\tbuilder.fail(\"Failed to start summarizer\", reason);\n\t\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.catch((reason) => {\n\t\t\t\t\tbuilder.fail(\"Failed to create cancellation token\", reason);\n\t\t\t\t});\n\n\t\t\treturn builder.build();\n\t\t} catch (error) {\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t}\n\t}\n\n\tpublic enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n\t\tif (\n\t\t\tthis._disposed ||\n\t\t\tthis.runningSummarizer === undefined ||\n\t\t\tthis.runningSummarizer.disposed\n\t\t) {\n\t\t\tthrow new UsageError(\"Summarizer is not running or already disposed.\");\n\t\t}\n\t\treturn this.runningSummarizer.enqueueSummarize(options);\n\t}\n\n\tpublic recordSummaryAttempt?(summaryRefSeqNum?: number) {\n\t\tthis._heuristicData?.recordAttempt(summaryRefSeqNum);\n\t}\n}\n"]}
|
|
@@ -126,6 +126,8 @@ export interface ISubmitSummaryOptions extends ISummarizeOptions {
|
|
|
126
126
|
export interface IOnDemandSummarizeOptions extends ISummarizeOptions {
|
|
127
127
|
/** Reason for generating summary. */
|
|
128
128
|
readonly reason: string;
|
|
129
|
+
/** In case of a failure, will attempt to retry based on if the failure is retriable. */
|
|
130
|
+
readonly retryOnFailure?: boolean;
|
|
129
131
|
}
|
|
130
132
|
/**
|
|
131
133
|
* Options to use when enqueueing a summarize attempt.
|
|
@@ -361,7 +363,7 @@ export interface ISummarizerEvents extends IEvent {
|
|
|
361
363
|
(event: "summarize", listener: (props: ISummarizeEventProps) => void): any;
|
|
362
364
|
}
|
|
363
365
|
/**
|
|
364
|
-
* @
|
|
366
|
+
* @alpha
|
|
365
367
|
*/
|
|
366
368
|
export interface ISummarizer extends IEventProvider<ISummarizerEvents> {
|
|
367
369
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerTypes.d.ts","sourceRoot":"","sources":["../../src/summary/summarizerTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,EACN,yBAAyB,EACzB,YAAY,EACZ,gBAAgB,EAChB,MAAM,sCAAsC,CAAC;A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A+B,EAC9C,aAAa,EAAE,uBAAuB,GACpC,OAAO,CAAC;CACX;AAED,KAAK,2CAA2C;AAC/C,wEAAwE;AACtE,UAAU;AACZ,yDAAyD;GACvD,sBAAsB;AACxB,0DAA0D;GACxD,sBAAsB,CAAC;AAE1B,KAAK,2CAA2C;AAC/C,oEAAoE;AAClE,yBAAyB;AAC3B,iEAAiE;GAC/D,uBAAuB;AACzB,gHAAgH;GAC9G,qBAAqB;AACvB,gHAAgH;GAC9G,qBAAqB;AACvB;;;GAGG;GACD,0BAA0B;AAC5B,yEAAyE;GACvE,+BAA+B;AACjC,qEAAqE;GACnE,4BAA4B;AAC9B,mFAAmF;GACjF,kBAAkB;AACpB,2DAA2D;GACzD,kBAAkB;AACpB,4EAA4E;GAC1E,QAAQ;AACV,0DAA0D;GACxD,gBAAgB;AAClB,gFAAgF;GAC9E,sBAAsB;AACxB,uEAAuE;GACrE,iBAAiB;AACnB,wDAAwD;GACtD,uBAAuB;AACzB,yDAAyD;GACvD,uBAAuB;AACzB,oHAAoH;GAClH,gBAAgB;AAClB,mHAAmH;GACjH,OAAO,CAAC;AAEX,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC3C,oBAAoB,EACpB,2CAA2C,CAC3C,GACA,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,2CAA2C,CAAC,CAAC,CAAC;AAElF,MAAM,WAAW,yBAA0B,SAAQ,2BAA2B;IAC7E,0CAA0C;IAC1C,cAAc,EAAE,MAAM,MAAM,CAAC;IAC7B,kDAAkD;IAClD,4BAA4B,EAAE,MAAM,MAAM,CAAC;CAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerTypes.js","sourceRoot":"","sources":["../../src/summary/summarizerTypes.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 { IEvent, IEventProvider, ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport { ITelemetryLoggerExt, ITelemetryLoggerPropertyBag } from \"@fluidframework/telemetry-utils\";\nimport { ContainerWarning, IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n\tISequencedDocumentMessage,\n\tISummaryTree,\n\tIDocumentMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { ISummaryStats } from \"@fluidframework/runtime-definitions\";\nimport { ISummaryConfigurationHeuristics } from \"../containerRuntime\";\nimport { ISummaryAckMessage, ISummaryNackMessage, ISummaryOpMessage } from \"./summaryCollection\";\nimport { SummarizeReason } from \"./summaryGenerator\";\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @param T - cancellation reason type\n * @alpha\n */\nexport interface ICancellationToken<T> {\n\t/** Tells if this cancellable token is cancelled */\n\treadonly cancelled: boolean;\n\t/**\n\t * Promise that gets fulfilled when this cancellable token is cancelled\n\t * @returns reason of cancellation\n\t */\n\treadonly waitCancelled: Promise<T>;\n}\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @alpha\n */\nexport type ISummaryCancellationToken = ICancellationToken<SummarizerStopReason>;\n\n/**\n * Data required to update internal tracking state after receiving a Summary Ack.\n * @alpha\n */\nexport interface IRefreshSummaryAckOptions {\n\t/** Handle from the ack's summary op. */\n\treadonly proposalHandle: string | undefined;\n\t/** Handle from the summary ack just received */\n\treadonly ackHandle: string;\n\t/** Reference sequence number from the ack's summary op */\n\treadonly summaryRefSeq: number;\n\t/** Telemetry logger to which telemetry events will be forwarded. */\n\treadonly summaryLogger: ITelemetryLoggerExt;\n}\n\n/**\n * @alpha\n */\nexport interface ISummarizerInternalsProvider {\n\t/** Encapsulates the work to walk the internals of the running container to generate a summary */\n\tsubmitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult>;\n\n\t/** Callback whenever a new SummaryAck is received, to update internal tracking state */\n\trefreshLatestSummaryAck(options: IRefreshSummaryAckOptions): Promise<void>;\n}\n\n/**\n * @deprecated Options that control the behavior of a running summarizer.\n * @public\n * */\nexport interface ISummarizerOptions {\n\t/**\n\t * Set to true to disable the default heuristics from running; false by default.\n\t * This affects only the heuristics around when a summarizer should\n\t * submit summaries. So when it is disabled, summarizer clients should\n\t * not be expected to summarize unless an on-demand summary is requested.\n\t */\n\tdisableHeuristics: boolean;\n}\n\n/**\n * @internal\n */\nexport interface ISummarizingWarning extends ContainerWarning {\n\treadonly errorType: \"summarizingError\";\n\treadonly logged: boolean;\n}\n\n/**\n * @alpha\n */\nexport interface IConnectableRuntime {\n\treadonly disposed: boolean;\n\treadonly connected: boolean;\n\treadonly clientId: string | undefined;\n\tonce(event: \"connected\" | \"disconnected\" | \"dispose\", listener: () => void): this;\n}\n\n/**\n * @alpha\n */\nexport interface ISummarizerRuntime extends IConnectableRuntime {\n\treadonly logger: ITelemetryLoggerExt;\n\t/** clientId of parent (non-summarizing) container that owns summarizer container */\n\treadonly summarizerClientId: string | undefined;\n\treadonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\tdisposeFn(): void;\n\tcloseFn(): void;\n\ton(\n\t\tevent: \"op\",\n\t\tlistener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void,\n\t): this;\n\toff(\n\t\tevent: \"op\",\n\t\tlistener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void,\n\t): this;\n}\n\n/**\n * Options affecting summarize behavior.\n * @alpha\n */\nexport interface ISummarizeOptions {\n\t/** True to generate the full tree with no handle reuse optimizations; defaults to false */\n\treadonly fullTree?: boolean;\n\t/**\n\t * True to ask the server what the latest summary is first; defaults to false\n\t *\n\t * @deprecated Summarize will not refresh latest snapshot state anymore. Instead it updates the cache and closes.\n\t * It's expected a new summarizer client will be created, likely by the same parent.\n\t */\n\treadonly refreshLatestAck?: boolean;\n}\n\n/**\n * @alpha\n */\nexport interface ISubmitSummaryOptions extends ISummarizeOptions {\n\t/** Logger to use for correlated summary events */\n\treadonly summaryLogger: ITelemetryLoggerExt;\n\t/** Tells when summary process should be cancelled */\n\treadonly cancellationToken: ISummaryCancellationToken;\n\t/** Summarization may be attempted multiple times. This tells whether this is the final summarization attempt. */\n\treadonly finalAttempt?: boolean;\n}\n\n/**\n * @alpha\n */\nexport interface IOnDemandSummarizeOptions extends ISummarizeOptions {\n\t/** Reason for generating summary. */\n\treadonly reason: string;\n}\n\n/**\n * Options to use when enqueueing a summarize attempt.\n * @alpha\n */\nexport interface IEnqueueSummarizeOptions extends IOnDemandSummarizeOptions {\n\t/** If specified, The summarize attempt will not occur until after this sequence number. */\n\treadonly afterSequenceNumber?: number;\n\n\t/**\n\t * True to override the existing enqueued summarize attempt if there is one.\n\t * This will guarantee that this attempt gets enqueued. If override is false,\n\t * than an existing enqueued summarize attempt will block a new one from being\n\t * enqueued. There can only be one enqueued at a time. Defaults to false.\n\t */\n\treadonly override?: boolean;\n}\n\n/**\n * In addition to the normal summary tree + stats, this contains additional stats\n * only relevant at the root of the tree.\n * @alpha\n */\nexport interface IGeneratedSummaryStats extends ISummaryStats {\n\t/** The total number of data stores in the container. */\n\treadonly dataStoreCount: number;\n\t/** The number of data stores that were summarized in this summary. */\n\treadonly summarizedDataStoreCount: number;\n\t/** The number of data stores whose GC reference state was updated in this summary. */\n\treadonly gcStateUpdatedDataStoreCount?: number;\n\t/** The size of the gc blobs in this summary. */\n\treadonly gcTotalBlobsSize?: number;\n\t/** The number of gc blobs in this summary. */\n\treadonly gcBlobNodeCount?: number;\n\t/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */\n\treadonly summaryNumber: number;\n}\n\n/**\n * Base results for all submitSummary attempts.\n * @alpha\n */\nexport interface IBaseSummarizeResult {\n\treadonly stage: \"base\";\n\t/** Error object related to failed summarize attempt. */\n\treadonly error: any;\n\t/** Reference sequence number as of the generate summary attempt. */\n\treadonly referenceSequenceNumber: number;\n\treadonly minimumSequenceNumber: number;\n}\n\n/**\n * Results of submitSummary after generating the summary tree.\n * @alpha\n */\nexport interface IGenerateSummaryTreeResult extends Omit<IBaseSummarizeResult, \"stage\"> {\n\treadonly stage: \"generate\";\n\t/** Generated summary tree. */\n\treadonly summaryTree: ISummaryTree;\n\t/** Stats for generated summary tree. */\n\treadonly summaryStats: IGeneratedSummaryStats;\n\t/** Time it took to generate the summary tree and stats. */\n\treadonly generateDuration: number;\n\t/** True if the full tree regeneration with no handle reuse optimizations was forced. */\n\treadonly forcedFullTree: boolean;\n}\n\n/**\n * Results of submitSummary after uploading the tree to storage.\n * @alpha\n */\nexport interface IUploadSummaryResult extends Omit<IGenerateSummaryTreeResult, \"stage\"> {\n\treadonly stage: \"upload\";\n\t/** The handle returned by storage pointing to the uploaded summary tree. */\n\treadonly handle: string;\n\t/** Time it took to upload the summary tree to storage. */\n\treadonly uploadDuration: number;\n}\n\n/**\n * Results of submitSummary after submitting the summarize op.\n * @alpha\n */\nexport interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, \"stage\" | \"error\"> {\n\treadonly stage: \"submit\";\n\t/** The client sequence number of the summarize op submitted for the summary. */\n\treadonly clientSequenceNumber: number;\n\t/** Time it took to submit the summarize op to the broadcasting service. */\n\treadonly submitOpDuration: number;\n}\n\n/**\n * Strict type representing result of a submitSummary attempt.\n * The result consists of 4 possible stages, each with its own data.\n * The data is cumulative, so each stage will contain the data from the previous stages.\n * If the final \"submitted\" stage is not reached, the result may contain the error object.\n *\n * Stages:\n *\n * 1. \"base\" - stopped before the summary tree was even generated, and the result only contains the base data\n *\n * 2. \"generate\" - the summary tree was generated, and the result will contain that tree + stats\n *\n * 3. \"upload\" - the summary was uploaded to storage, and the result contains the server-provided handle\n *\n * 4. \"submit\" - the summarize op was submitted, and the result contains the op client sequence number.\n * @alpha\n */\nexport type SubmitSummaryResult =\n\t| IBaseSummarizeResult\n\t| IGenerateSummaryTreeResult\n\t| IUploadSummaryResult\n\t| ISubmitSummaryOpResult;\n\n/**\n * The stages of Summarize, used to describe how far progress succeeded in case of a failure at a later stage.\n * @alpha\n */\nexport type SummaryStage = SubmitSummaryResult[\"stage\"] | \"unknown\";\n\n/**\n * Type for summarization failures that are retriable.\n * @alpha\n */\nexport interface IRetriableFailureResult {\n\treadonly retryAfterSeconds?: number;\n}\n\n/**\n * The data in summarizer result when submit summary stage fails.\n * @alpha\n */\nexport interface SubmitSummaryFailureData extends IRetriableFailureResult {\n\tstage: SummaryStage;\n}\n\n/**\n * @alpha\n */\nexport interface IBroadcastSummaryResult {\n\treadonly summarizeOp: ISummaryOpMessage;\n\treadonly broadcastDuration: number;\n}\n\n/**\n * @alpha\n */\nexport interface IAckSummaryResult {\n\treadonly summaryAckOp: ISummaryAckMessage;\n\treadonly ackNackDuration: number;\n}\n\n/**\n * @alpha\n */\nexport interface INackSummaryResult extends IRetriableFailureResult {\n\treadonly summaryNackOp: ISummaryNackMessage;\n\treadonly ackNackDuration: number;\n}\n\n/**\n * @alpha\n */\nexport type SummarizeResultPart<TSuccess, TFailure = undefined> =\n\t| {\n\t\t\tsuccess: true;\n\t\t\tdata: TSuccess;\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\tdata: TFailure | undefined;\n\t\t\tmessage: string;\n\t\t\terror: any;\n\t };\n\n/**\n * @alpha\n */\nexport interface ISummarizeResults {\n\t/** Resolves when we generate, upload, and submit the summary. */\n\treadonly summarySubmitted: Promise<\n\t\tSummarizeResultPart<SubmitSummaryResult, SubmitSummaryFailureData>\n\t>;\n\t/** Resolves when we observe our summarize op broadcast. */\n\treadonly summaryOpBroadcasted: Promise<SummarizeResultPart<IBroadcastSummaryResult>>;\n\t/** Resolves when we receive a summaryAck or summaryNack. */\n\treadonly receivedSummaryAckOrNack: Promise<\n\t\tSummarizeResultPart<IAckSummaryResult, INackSummaryResult>\n\t>;\n}\n\n/**\n * @alpha\n */\nexport type EnqueueSummarizeResult =\n\t| (ISummarizeResults & {\n\t\t\t/**\n\t\t\t * Indicates that another summarize attempt is not already enqueued,\n\t\t\t * and this attempt has been enqueued.\n\t\t\t */\n\t\t\treadonly alreadyEnqueued?: undefined;\n\t })\n\t| (ISummarizeResults & {\n\t\t\t/** Indicates that another summarize attempt was already enqueued. */\n\t\t\treadonly alreadyEnqueued: true;\n\t\t\t/**\n\t\t\t * Indicates that the other enqueued summarize attempt was abandoned,\n\t\t\t * and this attempt has been enqueued enqueued.\n\t\t\t */\n\t\t\treadonly overridden: true;\n\t })\n\t| {\n\t\t\t/** Indicates that another summarize attempt was already enqueued. */\n\t\t\treadonly alreadyEnqueued: true;\n\t\t\t/**\n\t\t\t * Indicates that the other enqueued summarize attempt remains enqueued,\n\t\t\t * and this attempt has not been enqueued.\n\t\t\t */\n\t\t\treadonly overridden?: undefined;\n\t };\n\n/**\n * @alpha\n */\nexport type SummarizerStopReason =\n\t/** Summarizer client failed to summarize in all 3 consecutive attempts. */\n\t| \"failToSummarize\"\n\t/** Parent client reported that it is no longer connected. */\n\t| \"parentNotConnected\"\n\t/**\n\t * Parent client reported that it is no longer elected the summarizer.\n\t * This is the normal flow; a disconnect will always trigger the parent\n\t * client to no longer be elected as responsible for summaries. Then it\n\t * tries to stop its spawned summarizer client.\n\t */\n\t| \"notElectedParent\"\n\t/**\n\t * We are not already running the summarizer and we are not the current elected client id.\n\t */\n\t| \"notElectedClient\"\n\t/** Summarizer client was disconnected */\n\t| \"summarizerClientDisconnected\"\n\t/** running summarizer threw an exception */\n\t| \"summarizerException\"\n\t/**\n\t * The previous summary state on the summarizer is not the most recently acked summary. this also happens when the\n\t * first submitSummary attempt fails for any reason and there's a 2nd summary attempt without an ack\n\t */\n\t| \"latestSummaryStateStale\";\n\n/**\n * @alpha\n */\nexport interface ISummarizeEventProps {\n\tresult: \"success\" | \"failure\" | \"canceled\";\n\tcurrentAttempt: number;\n\tmaxAttempts: number;\n\terror?: any;\n}\n\n/**\n * @alpha\n */\nexport interface ISummarizerEvents extends IEvent {\n\t(event: \"summarize\", listener: (props: ISummarizeEventProps) => void);\n}\n\n/**\n * @internal\n */\nexport interface ISummarizer extends IEventProvider<ISummarizerEvents> {\n\t/**\n\t * Allows {@link ISummarizer} to be used with our {@link @fluidframework/core-interfaces#FluidObject} pattern.\n\t */\n\treadonly ISummarizer?: ISummarizer;\n\n\t/*\n\t * Asks summarizer to move to exit.\n\t * Summarizer will finish current processes, which may take a while.\n\t * For example, summarizer may complete last summary before exiting.\n\t */\n\tstop(reason: SummarizerStopReason): void;\n\n\t/* Closes summarizer. Any pending processes (summary in flight) are abandoned. */\n\tclose(): void;\n\n\trun(onBehalfOf: string, disableHeuristics?: boolean): Promise<SummarizerStopReason>;\n\n\t/**\n\t * Attempts to generate a summary on demand. If already running, takes no action.\n\t * @param options - options controlling the summarize attempt\n\t * @returns an alreadyRunning promise if a summarize attempt is already in progress,\n\t * which will resolve when the current attempt completes. At that point caller can\n\t * decide to try again or not. Otherwise, it will return an object containing promises\n\t * that resolve as the summarize attempt progresses. They will resolve with success\n\t * false if a failure is encountered.\n\t */\n\tsummarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;\n\t/**\n\t * Enqueue an attempt to summarize after the specified sequence number.\n\t * If afterSequenceNumber is provided, the summarize attempt is \"enqueued\"\n\t * to run once an eligible op comes in with sequenceNumber \\>= afterSequenceNumber.\n\t * @param options - options controlling the summarize attempt\n\t * @returns an object containing an alreadyEnqueued flag to indicate if another\n\t * summarize attempt has already been enqueued. It also may contain an overridden flag\n\t * when alreadyEnqueued is true, that indicates whether this attempt forced the\n\t * previous attempt to abort. If this attempt becomes enqueued, it returns an object\n\t * containing promises that resolve as the summarize attempt progresses. They will\n\t * resolve with success false if a failure is encountered.\n\t */\n\tenqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;\n}\n\n/** Data about an attempt to summarize used for heuristics. */\nexport interface ISummarizeAttempt {\n\t/** Reference sequence number when summary was generated or attempted */\n\treadonly refSequenceNumber: number;\n\n\t/** Time of summary attempt after it was sent or attempted */\n\treadonly summaryTime: number;\n\n\t/** Sequence number of summary op */\n\tsummarySequenceNumber?: number;\n}\n\n/** Data relevant for summary heuristics. */\nexport interface ISummarizeHeuristicData {\n\t/** Latest received op sequence number */\n\tlastOpSequenceNumber: number;\n\n\t/** Most recent summary attempt from this client */\n\treadonly lastAttempt: ISummarizeAttempt;\n\n\t/** Most recent summary that received an ack */\n\treadonly lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n\n\t/** Number of runtime ops since last summary */\n\tnumRuntimeOps: number;\n\n\t/** Number of non-runtime ops since last summary */\n\tnumNonRuntimeOps: number;\n\n\t/** Cumulative size in bytes of all the ops since the last summary */\n\ttotalOpsSize: number;\n\n\t/** Wether or not this instance contains adjusted metrics due to missing op data */\n\thasMissingOpData: boolean;\n\n\t/**\n\t * Updates lastAttempt and lastSuccessfulAttempt based on the last summary.\n\t * @param lastSummary - last ack summary\n\t */\n\tupdateWithLastSummaryAckInfo(lastSummary: ISummarizeAttempt): void;\n\n\t/**\n\t * Records a summary attempt. If the attempt was successfully sent,\n\t * provide the reference sequence number, otherwise it will be set\n\t * to the last seen op sequence number.\n\t * @param referenceSequenceNumber - reference sequence number of sent summary\n\t */\n\trecordAttempt(referenceSequenceNumber?: number): void;\n\n\t/** Mark that the last sent summary attempt has received an ack */\n\tmarkLastAttemptAsSuccessful(): void;\n\n\topsSinceLastSummary: number;\n}\n\n/** Responsible for running heuristics determining when to summarize. */\nexport interface ISummarizeHeuristicRunner {\n\t/** Start specific heuristic trackers (ex: idle timer) */\n\tstart(): void;\n\n\t/** Runs the heuristics to determine if it should try to summarize */\n\trun(): void;\n\n\t/** Runs a different heuristic to check if it should summarize before closing */\n\tshouldRunLastSummary(): boolean;\n\n\t/** Disposes of resources */\n\tdispose(): void;\n}\n\ntype ISummarizeTelemetryRequiredProperties =\n\t/** Reason code for attempting to summarize */\n\t\"summarizeReason\";\n\ntype ISummarizeTelemetryOptionalProperties =\n\t/** Number of attempts within the last time window, used for calculating the throttle delay. */\n\t| \"summaryAttempts\"\n\t/** Number of attempts within the current phase (currently capped at 2 ) */\n\t| \"summaryAttemptsPerPhase\"\n\t/** One-based count of phases we've attempted (used to index into an array of ISummarizeOptions */\n\t| \"summaryAttemptPhase\"\n\t/** Summarization may be attempted multiple times. This tells whether this is the final summarization attempt */\n\t| \"finalAttempt\"\n\t| keyof ISummarizeOptions;\n\nexport type ISummarizeTelemetryProperties = Pick<\n\tITelemetryProperties,\n\tISummarizeTelemetryRequiredProperties\n> &\n\tPartial<Pick<ITelemetryProperties, ISummarizeTelemetryOptionalProperties>>;\n\n/** Strategy used to heuristically determine when we should run a summary */\nexport interface ISummaryHeuristicStrategy {\n\t/** Summarize reason for this summarize heuristic strategy (ex: \"maxTime\") */\n\tsummarizeReason: Readonly<SummarizeReason>;\n\n\t/**\n\t * Determines if this strategy's summarize criteria been met\n\t * @param configuration - summary configuration we are to check against\n\t * @param heuristicData - heuristic data used to confirm conditions are met\n\t */\n\tshouldRunSummary(\n\t\tconfiguration: ISummaryConfigurationHeuristics,\n\t\theuristicData: ISummarizeHeuristicData,\n\t): boolean;\n}\n\ntype SummaryGeneratorRequiredTelemetryProperties =\n\t/** True to generate the full tree with no handle reuse optimizations */\n\t| \"fullTree\"\n\t/** Time since we last attempted to generate a summary */\n\t| \"timeSinceLastAttempt\"\n\t/** Time since we last successfully generated a summary */\n\t| \"timeSinceLastSummary\";\n\ntype SummaryGeneratorOptionalTelemetryProperties =\n\t/** Reference sequence number as of the generate summary attempt. */\n\t| \"referenceSequenceNumber\"\n\t/** minimum sequence number (at the reference sequence number) */\n\t| \"minimumSequenceNumber\"\n\t/** Delta between the current reference sequence number and the reference sequence number of the last attempt */\n\t| \"opsSinceLastAttempt\"\n\t/** Delta between the current reference sequence number and the reference sequence number of the last summary */\n\t| \"opsSinceLastSummary\"\n\t/**\n\t * Delta in sum of op sizes between the current reference sequence number and the reference\n\t * sequence number of the last summary\n\t */\n\t| \"opsSizesSinceLastSummary\"\n\t/** Delta between the number of non-runtime ops since the last summary */\n\t| \"nonRuntimeOpsSinceLastSummary\"\n\t/** Delta between the number of runtime ops since the last summary */\n\t| \"runtimeOpsSinceLastSummary\"\n\t/** Wether or not this instance contains adjusted metrics due to missing op data */\n\t| \"hasMissingOpData\"\n\t/** Time it took to generate the summary tree and stats. */\n\t| \"generateDuration\"\n\t/** The handle returned by storage pointing to the uploaded summary tree. */\n\t| \"handle\"\n\t/** Time it took to upload the summary tree to storage. */\n\t| \"uploadDuration\"\n\t/** The client sequence number of the summarize op submitted for the summary. */\n\t| \"clientSequenceNumber\"\n\t/** Time it took for this summary to be acked after it was generated */\n\t| \"ackWaitDuration\"\n\t/** Reference sequence number of the ack/nack message */\n\t| \"ackNackSequenceNumber\"\n\t/** Actual sequence number of the summary op proposal. */\n\t| \"summarySequenceNumber\"\n\t/** Optional Retry-After time in seconds. If specified, the client should wait this many seconds before retrying. */\n\t| \"nackRetryAfter\"\n\t/** The stage at which the submit summary method failed at. This can help determine what type of failure we have */\n\t| \"stage\";\n\nexport type SummaryGeneratorTelemetry = Pick<\n\tITelemetryProperties,\n\tSummaryGeneratorRequiredTelemetryProperties\n> &\n\tPartial<Pick<ITelemetryProperties, SummaryGeneratorOptionalTelemetryProperties>>;\n\nexport interface ISummarizeRunnerTelemetry extends ITelemetryLoggerPropertyBag {\n\t/** Number of times the summarizer run. */\n\tsummarizeCount: () => number;\n\t/** Number of successful attempts to summarize. */\n\tsummarizerSuccessfulAttempts: () => number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"summarizerTypes.js","sourceRoot":"","sources":["../../src/summary/summarizerTypes.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 { IEvent, IEventProvider, ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport { ITelemetryLoggerExt, ITelemetryLoggerPropertyBag } from \"@fluidframework/telemetry-utils\";\nimport { ContainerWarning, IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n\tISequencedDocumentMessage,\n\tISummaryTree,\n\tIDocumentMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { ISummaryStats } from \"@fluidframework/runtime-definitions\";\nimport { ISummaryConfigurationHeuristics } from \"../containerRuntime\";\nimport { ISummaryAckMessage, ISummaryNackMessage, ISummaryOpMessage } from \"./summaryCollection\";\nimport { SummarizeReason } from \"./summaryGenerator\";\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @param T - cancellation reason type\n * @alpha\n */\nexport interface ICancellationToken<T> {\n\t/** Tells if this cancellable token is cancelled */\n\treadonly cancelled: boolean;\n\t/**\n\t * Promise that gets fulfilled when this cancellable token is cancelled\n\t * @returns reason of cancellation\n\t */\n\treadonly waitCancelled: Promise<T>;\n}\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @alpha\n */\nexport type ISummaryCancellationToken = ICancellationToken<SummarizerStopReason>;\n\n/**\n * Data required to update internal tracking state after receiving a Summary Ack.\n * @alpha\n */\nexport interface IRefreshSummaryAckOptions {\n\t/** Handle from the ack's summary op. */\n\treadonly proposalHandle: string | undefined;\n\t/** Handle from the summary ack just received */\n\treadonly ackHandle: string;\n\t/** Reference sequence number from the ack's summary op */\n\treadonly summaryRefSeq: number;\n\t/** Telemetry logger to which telemetry events will be forwarded. */\n\treadonly summaryLogger: ITelemetryLoggerExt;\n}\n\n/**\n * @alpha\n */\nexport interface ISummarizerInternalsProvider {\n\t/** Encapsulates the work to walk the internals of the running container to generate a summary */\n\tsubmitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult>;\n\n\t/** Callback whenever a new SummaryAck is received, to update internal tracking state */\n\trefreshLatestSummaryAck(options: IRefreshSummaryAckOptions): Promise<void>;\n}\n\n/**\n * @deprecated Options that control the behavior of a running summarizer.\n * @public\n * */\nexport interface ISummarizerOptions {\n\t/**\n\t * Set to true to disable the default heuristics from running; false by default.\n\t * This affects only the heuristics around when a summarizer should\n\t * submit summaries. So when it is disabled, summarizer clients should\n\t * not be expected to summarize unless an on-demand summary is requested.\n\t */\n\tdisableHeuristics: boolean;\n}\n\n/**\n * @internal\n */\nexport interface ISummarizingWarning extends ContainerWarning {\n\treadonly errorType: \"summarizingError\";\n\treadonly logged: boolean;\n}\n\n/**\n * @alpha\n */\nexport interface IConnectableRuntime {\n\treadonly disposed: boolean;\n\treadonly connected: boolean;\n\treadonly clientId: string | undefined;\n\tonce(event: \"connected\" | \"disconnected\" | \"dispose\", listener: () => void): this;\n}\n\n/**\n * @alpha\n */\nexport interface ISummarizerRuntime extends IConnectableRuntime {\n\treadonly logger: ITelemetryLoggerExt;\n\t/** clientId of parent (non-summarizing) container that owns summarizer container */\n\treadonly summarizerClientId: string | undefined;\n\treadonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\tdisposeFn(): void;\n\tcloseFn(): void;\n\ton(\n\t\tevent: \"op\",\n\t\tlistener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void,\n\t): this;\n\toff(\n\t\tevent: \"op\",\n\t\tlistener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void,\n\t): this;\n}\n\n/**\n * Options affecting summarize behavior.\n * @alpha\n */\nexport interface ISummarizeOptions {\n\t/** True to generate the full tree with no handle reuse optimizations; defaults to false */\n\treadonly fullTree?: boolean;\n\t/**\n\t * True to ask the server what the latest summary is first; defaults to false\n\t *\n\t * @deprecated Summarize will not refresh latest snapshot state anymore. Instead it updates the cache and closes.\n\t * It's expected a new summarizer client will be created, likely by the same parent.\n\t */\n\treadonly refreshLatestAck?: boolean;\n}\n\n/**\n * @alpha\n */\nexport interface ISubmitSummaryOptions extends ISummarizeOptions {\n\t/** Logger to use for correlated summary events */\n\treadonly summaryLogger: ITelemetryLoggerExt;\n\t/** Tells when summary process should be cancelled */\n\treadonly cancellationToken: ISummaryCancellationToken;\n\t/** Summarization may be attempted multiple times. This tells whether this is the final summarization attempt. */\n\treadonly finalAttempt?: boolean;\n}\n\n/**\n * @alpha\n */\nexport interface IOnDemandSummarizeOptions extends ISummarizeOptions {\n\t/** Reason for generating summary. */\n\treadonly reason: string;\n\t/** In case of a failure, will attempt to retry based on if the failure is retriable. */\n\treadonly retryOnFailure?: boolean;\n}\n\n/**\n * Options to use when enqueueing a summarize attempt.\n * @alpha\n */\nexport interface IEnqueueSummarizeOptions extends IOnDemandSummarizeOptions {\n\t/** If specified, The summarize attempt will not occur until after this sequence number. */\n\treadonly afterSequenceNumber?: number;\n\n\t/**\n\t * True to override the existing enqueued summarize attempt if there is one.\n\t * This will guarantee that this attempt gets enqueued. If override is false,\n\t * than an existing enqueued summarize attempt will block a new one from being\n\t * enqueued. There can only be one enqueued at a time. Defaults to false.\n\t */\n\treadonly override?: boolean;\n}\n\n/**\n * In addition to the normal summary tree + stats, this contains additional stats\n * only relevant at the root of the tree.\n * @alpha\n */\nexport interface IGeneratedSummaryStats extends ISummaryStats {\n\t/** The total number of data stores in the container. */\n\treadonly dataStoreCount: number;\n\t/** The number of data stores that were summarized in this summary. */\n\treadonly summarizedDataStoreCount: number;\n\t/** The number of data stores whose GC reference state was updated in this summary. */\n\treadonly gcStateUpdatedDataStoreCount?: number;\n\t/** The size of the gc blobs in this summary. */\n\treadonly gcTotalBlobsSize?: number;\n\t/** The number of gc blobs in this summary. */\n\treadonly gcBlobNodeCount?: number;\n\t/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */\n\treadonly summaryNumber: number;\n}\n\n/**\n * Base results for all submitSummary attempts.\n * @alpha\n */\nexport interface IBaseSummarizeResult {\n\treadonly stage: \"base\";\n\t/** Error object related to failed summarize attempt. */\n\treadonly error: any;\n\t/** Reference sequence number as of the generate summary attempt. */\n\treadonly referenceSequenceNumber: number;\n\treadonly minimumSequenceNumber: number;\n}\n\n/**\n * Results of submitSummary after generating the summary tree.\n * @alpha\n */\nexport interface IGenerateSummaryTreeResult extends Omit<IBaseSummarizeResult, \"stage\"> {\n\treadonly stage: \"generate\";\n\t/** Generated summary tree. */\n\treadonly summaryTree: ISummaryTree;\n\t/** Stats for generated summary tree. */\n\treadonly summaryStats: IGeneratedSummaryStats;\n\t/** Time it took to generate the summary tree and stats. */\n\treadonly generateDuration: number;\n\t/** True if the full tree regeneration with no handle reuse optimizations was forced. */\n\treadonly forcedFullTree: boolean;\n}\n\n/**\n * Results of submitSummary after uploading the tree to storage.\n * @alpha\n */\nexport interface IUploadSummaryResult extends Omit<IGenerateSummaryTreeResult, \"stage\"> {\n\treadonly stage: \"upload\";\n\t/** The handle returned by storage pointing to the uploaded summary tree. */\n\treadonly handle: string;\n\t/** Time it took to upload the summary tree to storage. */\n\treadonly uploadDuration: number;\n}\n\n/**\n * Results of submitSummary after submitting the summarize op.\n * @alpha\n */\nexport interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, \"stage\" | \"error\"> {\n\treadonly stage: \"submit\";\n\t/** The client sequence number of the summarize op submitted for the summary. */\n\treadonly clientSequenceNumber: number;\n\t/** Time it took to submit the summarize op to the broadcasting service. */\n\treadonly submitOpDuration: number;\n}\n\n/**\n * Strict type representing result of a submitSummary attempt.\n * The result consists of 4 possible stages, each with its own data.\n * The data is cumulative, so each stage will contain the data from the previous stages.\n * If the final \"submitted\" stage is not reached, the result may contain the error object.\n *\n * Stages:\n *\n * 1. \"base\" - stopped before the summary tree was even generated, and the result only contains the base data\n *\n * 2. \"generate\" - the summary tree was generated, and the result will contain that tree + stats\n *\n * 3. \"upload\" - the summary was uploaded to storage, and the result contains the server-provided handle\n *\n * 4. \"submit\" - the summarize op was submitted, and the result contains the op client sequence number.\n * @alpha\n */\nexport type SubmitSummaryResult =\n\t| IBaseSummarizeResult\n\t| IGenerateSummaryTreeResult\n\t| IUploadSummaryResult\n\t| ISubmitSummaryOpResult;\n\n/**\n * The stages of Summarize, used to describe how far progress succeeded in case of a failure at a later stage.\n * @alpha\n */\nexport type SummaryStage = SubmitSummaryResult[\"stage\"] | \"unknown\";\n\n/**\n * Type for summarization failures that are retriable.\n * @alpha\n */\nexport interface IRetriableFailureResult {\n\treadonly retryAfterSeconds?: number;\n}\n\n/**\n * The data in summarizer result when submit summary stage fails.\n * @alpha\n */\nexport interface SubmitSummaryFailureData extends IRetriableFailureResult {\n\tstage: SummaryStage;\n}\n\n/**\n * @alpha\n */\nexport interface IBroadcastSummaryResult {\n\treadonly summarizeOp: ISummaryOpMessage;\n\treadonly broadcastDuration: number;\n}\n\n/**\n * @alpha\n */\nexport interface IAckSummaryResult {\n\treadonly summaryAckOp: ISummaryAckMessage;\n\treadonly ackNackDuration: number;\n}\n\n/**\n * @alpha\n */\nexport interface INackSummaryResult extends IRetriableFailureResult {\n\treadonly summaryNackOp: ISummaryNackMessage;\n\treadonly ackNackDuration: number;\n}\n\n/**\n * @alpha\n */\nexport type SummarizeResultPart<TSuccess, TFailure = undefined> =\n\t| {\n\t\t\tsuccess: true;\n\t\t\tdata: TSuccess;\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\tdata: TFailure | undefined;\n\t\t\tmessage: string;\n\t\t\terror: any;\n\t };\n\n/**\n * @alpha\n */\nexport interface ISummarizeResults {\n\t/** Resolves when we generate, upload, and submit the summary. */\n\treadonly summarySubmitted: Promise<\n\t\tSummarizeResultPart<SubmitSummaryResult, SubmitSummaryFailureData>\n\t>;\n\t/** Resolves when we observe our summarize op broadcast. */\n\treadonly summaryOpBroadcasted: Promise<SummarizeResultPart<IBroadcastSummaryResult>>;\n\t/** Resolves when we receive a summaryAck or summaryNack. */\n\treadonly receivedSummaryAckOrNack: Promise<\n\t\tSummarizeResultPart<IAckSummaryResult, INackSummaryResult>\n\t>;\n}\n\n/**\n * @alpha\n */\nexport type EnqueueSummarizeResult =\n\t| (ISummarizeResults & {\n\t\t\t/**\n\t\t\t * Indicates that another summarize attempt is not already enqueued,\n\t\t\t * and this attempt has been enqueued.\n\t\t\t */\n\t\t\treadonly alreadyEnqueued?: undefined;\n\t })\n\t| (ISummarizeResults & {\n\t\t\t/** Indicates that another summarize attempt was already enqueued. */\n\t\t\treadonly alreadyEnqueued: true;\n\t\t\t/**\n\t\t\t * Indicates that the other enqueued summarize attempt was abandoned,\n\t\t\t * and this attempt has been enqueued enqueued.\n\t\t\t */\n\t\t\treadonly overridden: true;\n\t })\n\t| {\n\t\t\t/** Indicates that another summarize attempt was already enqueued. */\n\t\t\treadonly alreadyEnqueued: true;\n\t\t\t/**\n\t\t\t * Indicates that the other enqueued summarize attempt remains enqueued,\n\t\t\t * and this attempt has not been enqueued.\n\t\t\t */\n\t\t\treadonly overridden?: undefined;\n\t };\n\n/**\n * @alpha\n */\nexport type SummarizerStopReason =\n\t/** Summarizer client failed to summarize in all 3 consecutive attempts. */\n\t| \"failToSummarize\"\n\t/** Parent client reported that it is no longer connected. */\n\t| \"parentNotConnected\"\n\t/**\n\t * Parent client reported that it is no longer elected the summarizer.\n\t * This is the normal flow; a disconnect will always trigger the parent\n\t * client to no longer be elected as responsible for summaries. Then it\n\t * tries to stop its spawned summarizer client.\n\t */\n\t| \"notElectedParent\"\n\t/**\n\t * We are not already running the summarizer and we are not the current elected client id.\n\t */\n\t| \"notElectedClient\"\n\t/** Summarizer client was disconnected */\n\t| \"summarizerClientDisconnected\"\n\t/** running summarizer threw an exception */\n\t| \"summarizerException\"\n\t/**\n\t * The previous summary state on the summarizer is not the most recently acked summary. this also happens when the\n\t * first submitSummary attempt fails for any reason and there's a 2nd summary attempt without an ack\n\t */\n\t| \"latestSummaryStateStale\";\n\n/**\n * @alpha\n */\nexport interface ISummarizeEventProps {\n\tresult: \"success\" | \"failure\" | \"canceled\";\n\tcurrentAttempt: number;\n\tmaxAttempts: number;\n\terror?: any;\n}\n\n/**\n * @alpha\n */\nexport interface ISummarizerEvents extends IEvent {\n\t(event: \"summarize\", listener: (props: ISummarizeEventProps) => void);\n}\n\n/**\n * @alpha\n */\nexport interface ISummarizer extends IEventProvider<ISummarizerEvents> {\n\t/**\n\t * Allows {@link ISummarizer} to be used with our {@link @fluidframework/core-interfaces#FluidObject} pattern.\n\t */\n\treadonly ISummarizer?: ISummarizer;\n\n\t/*\n\t * Asks summarizer to move to exit.\n\t * Summarizer will finish current processes, which may take a while.\n\t * For example, summarizer may complete last summary before exiting.\n\t */\n\tstop(reason: SummarizerStopReason): void;\n\n\t/* Closes summarizer. Any pending processes (summary in flight) are abandoned. */\n\tclose(): void;\n\n\trun(onBehalfOf: string, disableHeuristics?: boolean): Promise<SummarizerStopReason>;\n\n\t/**\n\t * Attempts to generate a summary on demand. If already running, takes no action.\n\t * @param options - options controlling the summarize attempt\n\t * @returns an alreadyRunning promise if a summarize attempt is already in progress,\n\t * which will resolve when the current attempt completes. At that point caller can\n\t * decide to try again or not. Otherwise, it will return an object containing promises\n\t * that resolve as the summarize attempt progresses. They will resolve with success\n\t * false if a failure is encountered.\n\t */\n\tsummarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;\n\t/**\n\t * Enqueue an attempt to summarize after the specified sequence number.\n\t * If afterSequenceNumber is provided, the summarize attempt is \"enqueued\"\n\t * to run once an eligible op comes in with sequenceNumber \\>= afterSequenceNumber.\n\t * @param options - options controlling the summarize attempt\n\t * @returns an object containing an alreadyEnqueued flag to indicate if another\n\t * summarize attempt has already been enqueued. It also may contain an overridden flag\n\t * when alreadyEnqueued is true, that indicates whether this attempt forced the\n\t * previous attempt to abort. If this attempt becomes enqueued, it returns an object\n\t * containing promises that resolve as the summarize attempt progresses. They will\n\t * resolve with success false if a failure is encountered.\n\t */\n\tenqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;\n}\n\n/** Data about an attempt to summarize used for heuristics. */\nexport interface ISummarizeAttempt {\n\t/** Reference sequence number when summary was generated or attempted */\n\treadonly refSequenceNumber: number;\n\n\t/** Time of summary attempt after it was sent or attempted */\n\treadonly summaryTime: number;\n\n\t/** Sequence number of summary op */\n\tsummarySequenceNumber?: number;\n}\n\n/** Data relevant for summary heuristics. */\nexport interface ISummarizeHeuristicData {\n\t/** Latest received op sequence number */\n\tlastOpSequenceNumber: number;\n\n\t/** Most recent summary attempt from this client */\n\treadonly lastAttempt: ISummarizeAttempt;\n\n\t/** Most recent summary that received an ack */\n\treadonly lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n\n\t/** Number of runtime ops since last summary */\n\tnumRuntimeOps: number;\n\n\t/** Number of non-runtime ops since last summary */\n\tnumNonRuntimeOps: number;\n\n\t/** Cumulative size in bytes of all the ops since the last summary */\n\ttotalOpsSize: number;\n\n\t/** Wether or not this instance contains adjusted metrics due to missing op data */\n\thasMissingOpData: boolean;\n\n\t/**\n\t * Updates lastAttempt and lastSuccessfulAttempt based on the last summary.\n\t * @param lastSummary - last ack summary\n\t */\n\tupdateWithLastSummaryAckInfo(lastSummary: ISummarizeAttempt): void;\n\n\t/**\n\t * Records a summary attempt. If the attempt was successfully sent,\n\t * provide the reference sequence number, otherwise it will be set\n\t * to the last seen op sequence number.\n\t * @param referenceSequenceNumber - reference sequence number of sent summary\n\t */\n\trecordAttempt(referenceSequenceNumber?: number): void;\n\n\t/** Mark that the last sent summary attempt has received an ack */\n\tmarkLastAttemptAsSuccessful(): void;\n\n\topsSinceLastSummary: number;\n}\n\n/** Responsible for running heuristics determining when to summarize. */\nexport interface ISummarizeHeuristicRunner {\n\t/** Start specific heuristic trackers (ex: idle timer) */\n\tstart(): void;\n\n\t/** Runs the heuristics to determine if it should try to summarize */\n\trun(): void;\n\n\t/** Runs a different heuristic to check if it should summarize before closing */\n\tshouldRunLastSummary(): boolean;\n\n\t/** Disposes of resources */\n\tdispose(): void;\n}\n\ntype ISummarizeTelemetryRequiredProperties =\n\t/** Reason code for attempting to summarize */\n\t\"summarizeReason\";\n\ntype ISummarizeTelemetryOptionalProperties =\n\t/** Number of attempts within the last time window, used for calculating the throttle delay. */\n\t| \"summaryAttempts\"\n\t/** Number of attempts within the current phase (currently capped at 2 ) */\n\t| \"summaryAttemptsPerPhase\"\n\t/** One-based count of phases we've attempted (used to index into an array of ISummarizeOptions */\n\t| \"summaryAttemptPhase\"\n\t/** Summarization may be attempted multiple times. This tells whether this is the final summarization attempt */\n\t| \"finalAttempt\"\n\t| keyof ISummarizeOptions;\n\nexport type ISummarizeTelemetryProperties = Pick<\n\tITelemetryProperties,\n\tISummarizeTelemetryRequiredProperties\n> &\n\tPartial<Pick<ITelemetryProperties, ISummarizeTelemetryOptionalProperties>>;\n\n/** Strategy used to heuristically determine when we should run a summary */\nexport interface ISummaryHeuristicStrategy {\n\t/** Summarize reason for this summarize heuristic strategy (ex: \"maxTime\") */\n\tsummarizeReason: Readonly<SummarizeReason>;\n\n\t/**\n\t * Determines if this strategy's summarize criteria been met\n\t * @param configuration - summary configuration we are to check against\n\t * @param heuristicData - heuristic data used to confirm conditions are met\n\t */\n\tshouldRunSummary(\n\t\tconfiguration: ISummaryConfigurationHeuristics,\n\t\theuristicData: ISummarizeHeuristicData,\n\t): boolean;\n}\n\ntype SummaryGeneratorRequiredTelemetryProperties =\n\t/** True to generate the full tree with no handle reuse optimizations */\n\t| \"fullTree\"\n\t/** Time since we last attempted to generate a summary */\n\t| \"timeSinceLastAttempt\"\n\t/** Time since we last successfully generated a summary */\n\t| \"timeSinceLastSummary\";\n\ntype SummaryGeneratorOptionalTelemetryProperties =\n\t/** Reference sequence number as of the generate summary attempt. */\n\t| \"referenceSequenceNumber\"\n\t/** minimum sequence number (at the reference sequence number) */\n\t| \"minimumSequenceNumber\"\n\t/** Delta between the current reference sequence number and the reference sequence number of the last attempt */\n\t| \"opsSinceLastAttempt\"\n\t/** Delta between the current reference sequence number and the reference sequence number of the last summary */\n\t| \"opsSinceLastSummary\"\n\t/**\n\t * Delta in sum of op sizes between the current reference sequence number and the reference\n\t * sequence number of the last summary\n\t */\n\t| \"opsSizesSinceLastSummary\"\n\t/** Delta between the number of non-runtime ops since the last summary */\n\t| \"nonRuntimeOpsSinceLastSummary\"\n\t/** Delta between the number of runtime ops since the last summary */\n\t| \"runtimeOpsSinceLastSummary\"\n\t/** Wether or not this instance contains adjusted metrics due to missing op data */\n\t| \"hasMissingOpData\"\n\t/** Time it took to generate the summary tree and stats. */\n\t| \"generateDuration\"\n\t/** The handle returned by storage pointing to the uploaded summary tree. */\n\t| \"handle\"\n\t/** Time it took to upload the summary tree to storage. */\n\t| \"uploadDuration\"\n\t/** The client sequence number of the summarize op submitted for the summary. */\n\t| \"clientSequenceNumber\"\n\t/** Time it took for this summary to be acked after it was generated */\n\t| \"ackWaitDuration\"\n\t/** Reference sequence number of the ack/nack message */\n\t| \"ackNackSequenceNumber\"\n\t/** Actual sequence number of the summary op proposal. */\n\t| \"summarySequenceNumber\"\n\t/** Optional Retry-After time in seconds. If specified, the client should wait this many seconds before retrying. */\n\t| \"nackRetryAfter\"\n\t/** The stage at which the submit summary method failed at. This can help determine what type of failure we have */\n\t| \"stage\";\n\nexport type SummaryGeneratorTelemetry = Pick<\n\tITelemetryProperties,\n\tSummaryGeneratorRequiredTelemetryProperties\n> &\n\tPartial<Pick<ITelemetryProperties, SummaryGeneratorOptionalTelemetryProperties>>;\n\nexport interface ISummarizeRunnerTelemetry extends ITelemetryLoggerPropertyBag {\n\t/** Number of times the summarizer run. */\n\tsummarizeCount: () => number;\n\t/** Number of successful attempts to summarize. */\n\tsummarizerSuccessfulAttempts: () => number;\n}\n"]}
|