@fluidframework/container-runtime 2.0.0-internal.7.2.1 → 2.0.0-internal.7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1 -2
  3. package/dist/batchTracker.d.ts +1 -0
  4. package/dist/batchTracker.d.ts.map +1 -1
  5. package/dist/connectionTelemetry.js +1 -1
  6. package/dist/connectionTelemetry.js.map +1 -1
  7. package/dist/containerRuntime.d.ts +5 -11
  8. package/dist/containerRuntime.d.ts.map +1 -1
  9. package/dist/containerRuntime.js +26 -32
  10. package/dist/containerRuntime.js.map +1 -1
  11. package/dist/gc/gcConfigs.d.ts.map +1 -1
  12. package/dist/gc/gcConfigs.js +4 -1
  13. package/dist/gc/gcConfigs.js.map +1 -1
  14. package/dist/gc/gcDefinitions.d.ts +7 -2
  15. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  16. package/dist/gc/gcDefinitions.js +8 -3
  17. package/dist/gc/gcDefinitions.js.map +1 -1
  18. package/dist/gc/gcTelemetry.d.ts +1 -1
  19. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  20. package/dist/gc/gcTelemetry.js +20 -8
  21. package/dist/gc/gcTelemetry.js.map +1 -1
  22. package/dist/gc/index.d.ts +1 -1
  23. package/dist/gc/index.d.ts.map +1 -1
  24. package/dist/gc/index.js +3 -1
  25. package/dist/gc/index.js.map +1 -1
  26. package/dist/messageTypes.d.ts +3 -6
  27. package/dist/messageTypes.d.ts.map +1 -1
  28. package/dist/messageTypes.js.map +1 -1
  29. package/dist/metadata.d.ts +6 -0
  30. package/dist/metadata.d.ts.map +1 -1
  31. package/dist/metadata.js.map +1 -1
  32. package/dist/opLifecycle/opGroupingManager.d.ts +10 -2
  33. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  34. package/dist/opLifecycle/opGroupingManager.js +33 -4
  35. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  36. package/dist/opLifecycle/outbox.d.ts +2 -1
  37. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  38. package/dist/opLifecycle/outbox.js +23 -1
  39. package/dist/opLifecycle/outbox.js.map +1 -1
  40. package/dist/packageVersion.d.ts +1 -1
  41. package/dist/packageVersion.js +1 -1
  42. package/dist/packageVersion.js.map +1 -1
  43. package/dist/pendingStateManager.d.ts +0 -1
  44. package/dist/pendingStateManager.d.ts.map +1 -1
  45. package/dist/pendingStateManager.js +1 -11
  46. package/dist/pendingStateManager.js.map +1 -1
  47. package/dist/scheduleManager.d.ts +1 -0
  48. package/dist/scheduleManager.d.ts.map +1 -1
  49. package/dist/tsdoc-metadata.json +1 -1
  50. package/lib/batchTracker.d.ts +1 -0
  51. package/lib/batchTracker.d.ts.map +1 -1
  52. package/lib/connectionTelemetry.js +1 -1
  53. package/lib/connectionTelemetry.js.map +1 -1
  54. package/lib/containerRuntime.d.ts +5 -11
  55. package/lib/containerRuntime.d.ts.map +1 -1
  56. package/lib/containerRuntime.js +26 -32
  57. package/lib/containerRuntime.js.map +1 -1
  58. package/lib/gc/gcConfigs.d.ts.map +1 -1
  59. package/lib/gc/gcConfigs.js +5 -2
  60. package/lib/gc/gcConfigs.js.map +1 -1
  61. package/lib/gc/gcDefinitions.d.ts +7 -2
  62. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  63. package/lib/gc/gcDefinitions.js +7 -2
  64. package/lib/gc/gcDefinitions.js.map +1 -1
  65. package/lib/gc/gcTelemetry.d.ts +1 -1
  66. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  67. package/lib/gc/gcTelemetry.js +21 -9
  68. package/lib/gc/gcTelemetry.js.map +1 -1
  69. package/lib/gc/index.d.ts +1 -1
  70. package/lib/gc/index.d.ts.map +1 -1
  71. package/lib/gc/index.js +1 -1
  72. package/lib/gc/index.js.map +1 -1
  73. package/lib/messageTypes.d.ts +3 -6
  74. package/lib/messageTypes.d.ts.map +1 -1
  75. package/lib/messageTypes.js.map +1 -1
  76. package/lib/metadata.d.ts +6 -0
  77. package/lib/metadata.d.ts.map +1 -1
  78. package/lib/metadata.js.map +1 -1
  79. package/lib/opLifecycle/opGroupingManager.d.ts +10 -2
  80. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  81. package/lib/opLifecycle/opGroupingManager.js +33 -4
  82. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  83. package/lib/opLifecycle/outbox.d.ts +2 -1
  84. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  85. package/lib/opLifecycle/outbox.js +23 -1
  86. package/lib/opLifecycle/outbox.js.map +1 -1
  87. package/lib/packageVersion.d.ts +1 -1
  88. package/lib/packageVersion.js +1 -1
  89. package/lib/packageVersion.js.map +1 -1
  90. package/lib/pendingStateManager.d.ts +0 -1
  91. package/lib/pendingStateManager.d.ts.map +1 -1
  92. package/lib/pendingStateManager.js +1 -11
  93. package/lib/pendingStateManager.js.map +1 -1
  94. package/lib/scheduleManager.d.ts +1 -0
  95. package/lib/scheduleManager.d.ts.map +1 -1
  96. package/package.json +25 -25
  97. package/src/connectionTelemetry.ts +1 -1
  98. package/src/containerRuntime.ts +41 -39
  99. package/src/gc/gcConfigs.ts +8 -2
  100. package/src/gc/gcDefinitions.ts +10 -2
  101. package/src/gc/gcTelemetry.ts +28 -17
  102. package/src/gc/index.ts +2 -0
  103. package/src/messageTypes.ts +2 -7
  104. package/src/metadata.ts +7 -0
  105. package/src/opLifecycle/opGroupingManager.ts +47 -3
  106. package/src/opLifecycle/outbox.ts +38 -2
  107. package/src/packageVersion.ts +1 -1
  108. package/src/pendingStateManager.ts +2 -13
@@ -1 +1 @@
1
- {"version":3,"file":"pendingStateManager.js","sourceRoot":"","sources":["../src/pendingStateManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,4EAAuC;AAGvC,2DAA0D;AAG1D,qEAA2F;AAE3F,iDAA+F;AAC/F,qDAA8C;AA+C9C,SAAS,0BAA0B;AAClC,wEAA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AAC;oBAC/C,6BAA6B,EAAE,CAAC;oBAChC,IAAA,mBAAM,EACL,cAAc,CAAC,UAAU,EAAE,KAAK,KAAK,IAAI,EACzC,KAAK,CAAC,iDAAiD,CACvD,CAAC;iBACF;gBAED,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;aACvC;iBAAM;gBACN,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;oBAC1B,OAAO,EAAE,cAAc,CAAC,OAAO;oBAC/B,eAAe,EAAE,cAAc,CAAC,eAAe;oBAC/C,UAAU,EAAE,cAAc,CAAC,UAAU;iBACrC,CAAC,CAAC;aACH;SACD;QAED,qFAAqF;QACrF,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QAEnB,+GAA+G;QAC/G,6GAA6G;QAC7G,mFAAmF;QACnF,IAAI,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE;YAC3C,IAAI,CAAC,MAAM,EAAE,kBAAkB,CAAC;gBAC/B,SAAS,EAAE,uBAAuB;gBAClC,KAAK,EAAE,2BAA2B;gBAClC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;aACtC,CAAC,CAAC;SACH;IACF,CAAC;CACD;AAnWD,kDAmWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport Deque from \"double-ended-queue\";\n\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert, Lazy } from \"@fluidframework/core-utils\";\nimport { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { DataProcessingError, ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\n\nimport { ContainerMessageType, InboundSequencedContainerRuntimeMessage } from \"./messageTypes\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { IBatchMetadata } from \"./metadata\";\n\n/**\n * This represents a message that has been submitted and is added to the pending queue when `submit` is called on the\n * ContainerRuntime. This message has either not been ack'd by the server or has not been submitted to the server yet.\n */\nexport interface IPendingMessage {\n\ttype: \"message\";\n\tclientSequenceNumber: number;\n\treferenceSequenceNumber: number;\n\tcontent: string;\n\tlocalOpMetadata: unknown;\n\topMetadata: Record<string, unknown> | undefined;\n}\n\nexport interface IPendingLocalState {\n\t/**\n\t * list of pending states, including ops and batch information\n\t */\n\tpendingStates: IPendingMessage[];\n}\n\nexport interface IPendingBatchMessage {\n\tcontent: string;\n\tlocalOpMetadata: unknown;\n\topMetadata: Record<string, unknown> | undefined;\n}\n\nexport interface IRuntimeStateHandler {\n\tconnected(): boolean;\n\tclientId(): string | undefined;\n\tclose(error?: ICriticalContainerError): void;\n\tapplyStashedOp(content: string): Promise<unknown>;\n\treSubmit(message: IPendingBatchMessage): void;\n\treSubmitBatch(batch: IPendingBatchMessage[]): void;\n\tisActiveConnection: () => boolean;\n}\n\n/** Union of keys of T */\ntype KeysOfUnion<T extends object> = T extends T ? keyof T : never;\n/** *Partial* type all possible combinations of properties and values of union T.\n * This loosens typing allowing access to all possible properties without\n * narrowing.\n */\ntype AnyComboFromUnion<T extends object> = { [P in KeysOfUnion<T>]?: T[P] };\n\nfunction buildPendingMessageContent(\n\t// AnyComboFromUnion is needed need to gain access to compatDetails that\n\t// is only defined for some cases.\n\tmessage: AnyComboFromUnion<InboundSequencedContainerRuntimeMessage>,\n): string {\n\t// IMPORTANT: Order matters here, this must match the order of the properties used\n\t// when submitting the message.\n\tconst { type, contents, compatDetails } = message;\n\t// Any properties that are not defined, won't be emitted by stringify.\n\treturn JSON.stringify({ type, contents, compatDetails });\n}\n\n/**\n * PendingStateManager is responsible for maintaining the messages that have not been sent or have not yet been\n * acknowledged by the server. It also maintains the batch information for both automatically and manually flushed\n * batches along with the messages.\n * When the Container reconnects, it replays the pending states, which includes manual flushing\n * of messages and triggering resubmission of unacked ops.\n *\n * It verifies that all the ops are acked, are received in the right order and batch information is correct.\n */\nexport class PendingStateManager implements IDisposable {\n\tprivate readonly pendingMessages = new Deque<IPendingMessage>();\n\tprivate readonly initialMessages = new Deque<IPendingMessage>();\n\n\t/**\n\t * Sequenced local ops that are saved when stashing since pending ops may depend on them\n\t */\n\tprivate savedOps: IPendingMessage[] = [];\n\n\tprivate readonly disposeOnce = new Lazy<void>(() => {\n\t\tthis.initialMessages.clear();\n\t\tthis.pendingMessages.clear();\n\t});\n\n\t// Indicates whether we are processing a batch.\n\tprivate isProcessingBatch: boolean = false;\n\n\t// This stores the first message in the batch that we are processing. This is used to verify that we get\n\t// the correct batch metadata.\n\tprivate pendingBatchBeginMessage: ISequencedDocumentMessage | undefined;\n\n\tprivate clientId: string | undefined;\n\n\t/**\n\t * The pending messages count. Includes `pendingMessages` and `initialMessages` to keep in sync with\n\t * 'hasPendingMessages'.\n\t */\n\tpublic get pendingMessagesCount(): number {\n\t\treturn this.pendingMessages.length + this.initialMessages.length;\n\t}\n\n\t/**\n\t * Called to check if there are any pending messages in the pending message queue.\n\t * @returns A boolean indicating whether there are messages or not.\n\t */\n\tpublic hasPendingMessages(): boolean {\n\t\treturn this.pendingMessagesCount !== 0;\n\t}\n\n\tpublic getLocalState(): IPendingLocalState | undefined {\n\t\tassert(\n\t\t\tthis.initialMessages.isEmpty(),\n\t\t\t0x2e9 /* \"Must call getLocalState() after applying initial states\" */,\n\t\t);\n\t\tif (!this.pendingMessages.isEmpty()) {\n\t\t\treturn {\n\t\t\t\tpendingStates: [...this.savedOps, ...this.pendingMessages.toArray()].map(\n\t\t\t\t\t(message) => {\n\t\t\t\t\t\tlet content = message.content;\n\t\t\t\t\t\tconst parsedContent = JSON.parse(content);\n\t\t\t\t\t\t// IdAllocations need their localOpMetadata stashed in the contents\n\t\t\t\t\t\t// of the op to correctly resume the session when processing stashed ops\n\t\t\t\t\t\tif (parsedContent.type === ContainerMessageType.IdAllocation) {\n\t\t\t\t\t\t\tparsedContent.contents.stashedState = message.localOpMetadata;\n\t\t\t\t\t\t\tcontent = JSON.stringify(parsedContent);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// delete localOpMetadata since it may not be serializable\n\t\t\t\t\t\t// and will be regenerated by applyStashedOp()\n\t\t\t\t\t\treturn { ...message, content, localOpMetadata: undefined };\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t}\n\n\tconstructor(\n\t\tprivate readonly stateHandler: IRuntimeStateHandler,\n\t\tinitialLocalState: IPendingLocalState | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt | undefined,\n\t) {\n\t\tif (initialLocalState?.pendingStates) {\n\t\t\tthis.initialMessages.push(...initialLocalState.pendingStates);\n\t\t}\n\t}\n\n\tpublic get disposed() {\n\t\treturn this.disposeOnce.evaluated;\n\t}\n\tpublic readonly dispose = () => this.disposeOnce.value;\n\n\t/**\n\t * Called when a message is submitted locally. Adds the message and the associated details to the pending state\n\t * queue.\n\t * @param type - The container message type.\n\t * @param content - The message content.\n\t * @param localOpMetadata - The local metadata associated with the message.\n\t */\n\tpublic onSubmitMessage(\n\t\tcontent: string,\n\t\treferenceSequenceNumber: number,\n\t\tlocalOpMetadata: unknown,\n\t\topMetadata: Record<string, unknown> | undefined,\n\t) {\n\t\tconst pendingMessage: IPendingMessage = {\n\t\t\ttype: \"message\",\n\t\t\tclientSequenceNumber: -1, // dummy value (not to be used anywhere)\n\t\t\treferenceSequenceNumber,\n\t\t\tcontent,\n\t\t\tlocalOpMetadata,\n\t\t\topMetadata,\n\t\t};\n\n\t\tthis.pendingMessages.push(pendingMessage);\n\t}\n\n\t/**\n\t * Applies stashed ops at their reference sequence number so they are ready to be ACKed or resubmitted\n\t * @param seqNum - Sequence number at which to apply ops. Will apply all ops if seqNum is undefined.\n\t */\n\tpublic async applyStashedOpsAt(seqNum?: number) {\n\t\t// apply stashed ops at sequence number\n\t\twhile (!this.initialMessages.isEmpty()) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst nextMessage = this.initialMessages.peekFront()!;\n\t\t\tif (seqNum !== undefined) {\n\t\t\t\tif (nextMessage.referenceSequenceNumber > seqNum) {\n\t\t\t\t\tbreak; // nothing left to do at this sequence number\n\t\t\t\t}\n\t\t\t\tif (nextMessage.referenceSequenceNumber < seqNum) {\n\t\t\t\t\tthrow new Error(\"loaded from snapshot too recent to apply stashed ops\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t// applyStashedOp will cause the DDS to behave as if it has sent the op but not actually send it\n\t\t\t\tconst localOpMetadata = await this.stateHandler.applyStashedOp(nextMessage.content);\n\t\t\t\tnextMessage.localOpMetadata = localOpMetadata;\n\t\t\t} catch (error) {\n\t\t\t\tthrow DataProcessingError.wrapIfUnrecognized(error, \"applyStashedOp\", nextMessage);\n\t\t\t}\n\n\t\t\t// then we push onto pendingMessages which will cause PendingStateManager to resubmit when we connect\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.pendingMessages.push(this.initialMessages.shift()!);\n\t\t}\n\t}\n\n\t/**\n\t * Processes a local message once its ack'd by the server. It verifies that there was no data corruption and that\n\t * the batch information was preserved for batch messages.\n\t * @param message - The message that got ack'd and needs to be processed.\n\t */\n\tpublic processPendingLocalMessage(message: InboundSequencedContainerRuntimeMessage): unknown {\n\t\t// Pre-processing part - This may be the start of a batch.\n\t\tthis.maybeProcessBatchBegin(message);\n\n\t\t// Get the next message from the pending queue. Verify a message exists.\n\t\tconst pendingMessage = this.pendingMessages.peekFront();\n\t\tassert(\n\t\t\tpendingMessage !== undefined,\n\t\t\t0x169 /* \"No pending message found for this remote message\" */,\n\t\t);\n\t\tthis.savedOps.push(pendingMessage);\n\n\t\tthis.pendingMessages.shift();\n\n\t\tconst messageContent = buildPendingMessageContent(message);\n\n\t\t// Stringified content should match\n\t\tif (pendingMessage.content !== messageContent) {\n\t\t\tthis.stateHandler.close(\n\t\t\t\tDataProcessingError.create(\n\t\t\t\t\t\"pending local message content mismatch\",\n\t\t\t\t\t\"unexpectedAckReceived\",\n\t\t\t\t\tmessage,\n\t\t\t\t\t{\n\t\t\t\t\t\texpectedMessageType: JSON.parse(pendingMessage.content).type,\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Post-processing part - If we are processing a batch then this could be the last message in the batch.\n\t\tthis.maybeProcessBatchEnd(message);\n\n\t\treturn pendingMessage.localOpMetadata;\n\t}\n\n\t/**\n\t * This message could be the first message in batch. If so, set batch state marking the beginning of a batch.\n\t * @param message - The message that is being processed.\n\t */\n\tprivate maybeProcessBatchBegin(message: ISequencedDocumentMessage) {\n\t\t// This message is the first in a batch if the \"batch\" property on the metadata is set to true\n\t\tif ((message.metadata as IBatchMetadata | undefined)?.batch) {\n\t\t\t// We should not already be processing a batch and there should be no pending batch begin message.\n\t\t\tassert(\n\t\t\t\t!this.isProcessingBatch && this.pendingBatchBeginMessage === undefined,\n\t\t\t\t0x16b /* \"The pending batch state indicates we are already processing a batch\" */,\n\t\t\t);\n\n\t\t\t// Set the pending batch state indicating we have started processing a batch.\n\t\t\tthis.pendingBatchBeginMessage = message;\n\t\t\tthis.isProcessingBatch = true;\n\t\t}\n\t}\n\n\t/**\n\t * This message could be the last message in batch. If so, clear batch state since the batch is complete.\n\t * @param message - The message that is being processed.\n\t */\n\tprivate maybeProcessBatchEnd(message: ISequencedDocumentMessage) {\n\t\tif (!this.isProcessingBatch) {\n\t\t\treturn;\n\t\t}\n\n\t\t// There should be a pending batch begin message.\n\t\tassert(\n\t\t\tthis.pendingBatchBeginMessage !== undefined,\n\t\t\t0x16d /* \"There is no pending batch begin message\" */,\n\t\t);\n\n\t\tconst batchEndMetadata = (message.metadata as IBatchMetadata | undefined)?.batch;\n\t\tif (this.pendingMessages.isEmpty() || batchEndMetadata === false) {\n\t\t\t// Get the batch begin metadata from the first message in the batch.\n\t\t\tconst batchBeginMetadata = (\n\t\t\t\tthis.pendingBatchBeginMessage.metadata as IBatchMetadata | undefined\n\t\t\t)?.batch;\n\n\t\t\t// There could be just a single message in the batch. If so, it should not have any batch metadata. If there\n\t\t\t// are multiple messages in the batch, verify that we got the correct batch begin and end metadata.\n\t\t\tif (this.pendingBatchBeginMessage === message) {\n\t\t\t\tassert(\n\t\t\t\t\tbatchBeginMetadata === undefined,\n\t\t\t\t\t0x16e /* \"Batch with single message should not have batch metadata\" */,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tif (batchBeginMetadata !== true || batchEndMetadata !== false) {\n\t\t\t\t\tthis.stateHandler.close(\n\t\t\t\t\t\tDataProcessingError.create(\n\t\t\t\t\t\t\t\"Pending batch inconsistency\", // Formerly known as asserts 0x16f and 0x170\n\t\t\t\t\t\t\t\"processPendingLocalMessage\",\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\truntimeVersion: pkgVersion,\n\t\t\t\t\t\t\t\tbatchClientId:\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\t\t\t\t\t\t\tthis.pendingBatchBeginMessage.clientId === null\n\t\t\t\t\t\t\t\t\t\t? \"null\"\n\t\t\t\t\t\t\t\t\t\t: this.pendingBatchBeginMessage.clientId,\n\t\t\t\t\t\t\t\tclientId: this.stateHandler.clientId(),\n\t\t\t\t\t\t\t\thasBatchStart: batchBeginMetadata === true,\n\t\t\t\t\t\t\t\thasBatchEnd: batchEndMetadata === false,\n\t\t\t\t\t\t\t\tmessageType: message.type,\n\t\t\t\t\t\t\t\tpendingMessagesCount: this.pendingMessagesCount,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Clear the pending batch state now that we have processed the entire batch.\n\t\t\tthis.pendingBatchBeginMessage = undefined;\n\t\t\tthis.isProcessingBatch = false;\n\t\t}\n\t}\n\n\t/**\n\t * Called when the Container's connection state changes. If the Container gets connected, it replays all the pending\n\t * states in its queue. This includes triggering resubmission of unacked ops.\n\t */\n\tpublic replayPendingStates() {\n\t\tassert(\n\t\t\tthis.stateHandler.connected(),\n\t\t\t0x172 /* \"The connection state is not consistent with the runtime\" */,\n\t\t);\n\n\t\t// This assert suggests we are about to send same ops twice, which will result in data loss.\n\t\tassert(\n\t\t\tthis.clientId !== this.stateHandler.clientId(),\n\t\t\t0x173 /* \"replayPendingStates called twice for same clientId!\" */,\n\t\t);\n\t\tthis.clientId = this.stateHandler.clientId();\n\n\t\tassert(\n\t\t\tthis.initialMessages.isEmpty(),\n\t\t\t0x174 /* \"initial states should be empty before replaying pending\" */,\n\t\t);\n\n\t\tconst initialPendingMessagesCount = this.pendingMessages.length;\n\t\tlet remainingPendingMessagesCount = this.pendingMessages.length;\n\n\t\t// Process exactly `pendingMessagesCount` items in the queue as it represents the number of messages that were\n\t\t// pending when we connected. This is important because the `reSubmitFn` might add more items in the queue\n\t\t// which must not be replayed.\n\t\twhile (remainingPendingMessagesCount > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tlet pendingMessage = this.pendingMessages.shift()!;\n\t\t\tremainingPendingMessagesCount--;\n\t\t\tassert(\n\t\t\t\tpendingMessage.opMetadata?.batch !== false,\n\t\t\t\t0x41b /* We cannot process batches in chunks */,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * We want to ensure grouped messages get processed in a batch.\n\t\t\t * Note: It is not possible for the PendingStateManager to receive a partially acked batch. It will\n\t\t\t * either receive the whole batch ack or nothing at all.\n\t\t\t */\n\t\t\tif (pendingMessage.opMetadata?.batch) {\n\t\t\t\tassert(\n\t\t\t\t\tremainingPendingMessagesCount > 0,\n\t\t\t\t\t0x554 /* Last pending message cannot be a batch begin */,\n\t\t\t\t);\n\n\t\t\t\tconst batch: IPendingBatchMessage[] = [];\n\n\t\t\t\t// check is >= because batch end may be last pending message\n\t\t\t\twhile (remainingPendingMessagesCount >= 0) {\n\t\t\t\t\tbatch.push({\n\t\t\t\t\t\tcontent: pendingMessage.content,\n\t\t\t\t\t\tlocalOpMetadata: pendingMessage.localOpMetadata,\n\t\t\t\t\t\topMetadata: pendingMessage.opMetadata,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (pendingMessage.opMetadata?.batch === false) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tassert(remainingPendingMessagesCount > 0, 0x555 /* No batch end found */);\n\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tpendingMessage = this.pendingMessages.shift()!;\n\t\t\t\t\tremainingPendingMessagesCount--;\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingMessage.opMetadata?.batch !== true,\n\t\t\t\t\t\t0x556 /* Batch start needs a corresponding batch end */,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.stateHandler.reSubmitBatch(batch);\n\t\t\t} else {\n\t\t\t\tthis.stateHandler.reSubmit({\n\t\t\t\t\tcontent: pendingMessage.content,\n\t\t\t\t\tlocalOpMetadata: pendingMessage.localOpMetadata,\n\t\t\t\t\topMetadata: pendingMessage.opMetadata,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// pending ops should no longer depend on previous sequenced local ops after resubmit\n\t\tthis.savedOps = [];\n\n\t\t// We replayPendingStates on read connections too - we expect these to get nack'd though, and to then reconnect\n\t\t// on a write connection and replay again. This filters out the replay that happens on the read connection so\n\t\t// we only see the replays on write connections (that have a chance to go through).\n\t\tif (this.stateHandler.isActiveConnection()) {\n\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\teventName: \"PendingStatesReplayed\",\n\t\t\t\tcount: initialPendingMessagesCount,\n\t\t\t\tclientId: this.stateHandler.clientId(),\n\t\t\t});\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"pendingStateManager.js","sourceRoot":"","sources":["../src/pendingStateManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,4EAAuC;AAGvC,2DAA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CAAC,eAAe;oBAC/C,UAAU,EAAE,cAAc,CAAC,UAAU;iBACrC,CAAC,CAAC;aACH;SACD;QAED,qFAAqF;QACrF,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QAEnB,+GAA+G;QAC/G,6GAA6G;QAC7G,mFAAmF;QACnF,IAAI,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE;YAC3C,IAAI,CAAC,MAAM,EAAE,kBAAkB,CAAC;gBAC/B,SAAS,EAAE,uBAAuB;gBAClC,KAAK,EAAE,2BAA2B;gBAClC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;aACtC,CAAC,CAAC;SACH;IACF,CAAC;CACD;AAzVD,kDAyVC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport Deque from \"double-ended-queue\";\n\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert, Lazy } from \"@fluidframework/core-utils\";\nimport { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { DataProcessingError, ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\n\nimport { InboundSequencedContainerRuntimeMessage } from \"./messageTypes\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { IBatchMetadata } from \"./metadata\";\n\n/**\n * This represents a message that has been submitted and is added to the pending queue when `submit` is called on the\n * ContainerRuntime. This message has either not been ack'd by the server or has not been submitted to the server yet.\n */\nexport interface IPendingMessage {\n\ttype: \"message\";\n\treferenceSequenceNumber: number;\n\tcontent: string;\n\tlocalOpMetadata: unknown;\n\topMetadata: Record<string, unknown> | undefined;\n}\n\nexport interface IPendingLocalState {\n\t/**\n\t * list of pending states, including ops and batch information\n\t */\n\tpendingStates: IPendingMessage[];\n}\n\nexport interface IPendingBatchMessage {\n\tcontent: string;\n\tlocalOpMetadata: unknown;\n\topMetadata: Record<string, unknown> | undefined;\n}\n\nexport interface IRuntimeStateHandler {\n\tconnected(): boolean;\n\tclientId(): string | undefined;\n\tclose(error?: ICriticalContainerError): void;\n\tapplyStashedOp(content: string): Promise<unknown>;\n\treSubmit(message: IPendingBatchMessage): void;\n\treSubmitBatch(batch: IPendingBatchMessage[]): void;\n\tisActiveConnection: () => boolean;\n}\n\n/** Union of keys of T */\ntype KeysOfUnion<T extends object> = T extends T ? keyof T : never;\n/** *Partial* type all possible combinations of properties and values of union T.\n * This loosens typing allowing access to all possible properties without\n * narrowing.\n */\ntype AnyComboFromUnion<T extends object> = { [P in KeysOfUnion<T>]?: T[P] };\n\nfunction buildPendingMessageContent(\n\t// AnyComboFromUnion is needed need to gain access to compatDetails that\n\t// is only defined for some cases.\n\tmessage: AnyComboFromUnion<InboundSequencedContainerRuntimeMessage>,\n): string {\n\t// IMPORTANT: Order matters here, this must match the order of the properties used\n\t// when submitting the message.\n\tconst { type, contents, compatDetails } = message;\n\t// Any properties that are not defined, won't be emitted by stringify.\n\treturn JSON.stringify({ type, contents, compatDetails });\n}\n\n/**\n * PendingStateManager is responsible for maintaining the messages that have not been sent or have not yet been\n * acknowledged by the server. It also maintains the batch information for both automatically and manually flushed\n * batches along with the messages.\n * When the Container reconnects, it replays the pending states, which includes manual flushing\n * of messages and triggering resubmission of unacked ops.\n *\n * It verifies that all the ops are acked, are received in the right order and batch information is correct.\n */\nexport class PendingStateManager implements IDisposable {\n\tprivate readonly pendingMessages = new Deque<IPendingMessage>();\n\tprivate readonly initialMessages = new Deque<IPendingMessage>();\n\n\t/**\n\t * Sequenced local ops that are saved when stashing since pending ops may depend on them\n\t */\n\tprivate savedOps: IPendingMessage[] = [];\n\n\tprivate readonly disposeOnce = new Lazy<void>(() => {\n\t\tthis.initialMessages.clear();\n\t\tthis.pendingMessages.clear();\n\t});\n\n\t// Indicates whether we are processing a batch.\n\tprivate isProcessingBatch: boolean = false;\n\n\t// This stores the first message in the batch that we are processing. This is used to verify that we get\n\t// the correct batch metadata.\n\tprivate pendingBatchBeginMessage: ISequencedDocumentMessage | undefined;\n\n\tprivate clientId: string | undefined;\n\n\t/**\n\t * The pending messages count. Includes `pendingMessages` and `initialMessages` to keep in sync with\n\t * 'hasPendingMessages'.\n\t */\n\tpublic get pendingMessagesCount(): number {\n\t\treturn this.pendingMessages.length + this.initialMessages.length;\n\t}\n\n\t/**\n\t * Called to check if there are any pending messages in the pending message queue.\n\t * @returns A boolean indicating whether there are messages or not.\n\t */\n\tpublic hasPendingMessages(): boolean {\n\t\treturn this.pendingMessagesCount !== 0;\n\t}\n\n\tpublic getLocalState(): IPendingLocalState | undefined {\n\t\tassert(\n\t\t\tthis.initialMessages.isEmpty(),\n\t\t\t0x2e9 /* \"Must call getLocalState() after applying initial states\" */,\n\t\t);\n\t\tif (!this.pendingMessages.isEmpty()) {\n\t\t\treturn {\n\t\t\t\tpendingStates: [...this.savedOps, ...this.pendingMessages.toArray()].map(\n\t\t\t\t\t(message) => {\n\t\t\t\t\t\t// delete localOpMetadata since it may not be serializable\n\t\t\t\t\t\t// and will be regenerated by applyStashedOp()\n\t\t\t\t\t\treturn { ...message, localOpMetadata: undefined };\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t}\n\n\tconstructor(\n\t\tprivate readonly stateHandler: IRuntimeStateHandler,\n\t\tinitialLocalState: IPendingLocalState | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt | undefined,\n\t) {\n\t\tif (initialLocalState?.pendingStates) {\n\t\t\tthis.initialMessages.push(...initialLocalState.pendingStates);\n\t\t}\n\t}\n\n\tpublic get disposed() {\n\t\treturn this.disposeOnce.evaluated;\n\t}\n\tpublic readonly dispose = () => this.disposeOnce.value;\n\n\t/**\n\t * Called when a message is submitted locally. Adds the message and the associated details to the pending state\n\t * queue.\n\t * @param type - The container message type.\n\t * @param content - The message content.\n\t * @param localOpMetadata - The local metadata associated with the message.\n\t */\n\tpublic onSubmitMessage(\n\t\tcontent: string,\n\t\treferenceSequenceNumber: number,\n\t\tlocalOpMetadata: unknown,\n\t\topMetadata: Record<string, unknown> | undefined,\n\t) {\n\t\tconst pendingMessage: IPendingMessage = {\n\t\t\ttype: \"message\",\n\t\t\treferenceSequenceNumber,\n\t\t\tcontent,\n\t\t\tlocalOpMetadata,\n\t\t\topMetadata,\n\t\t};\n\n\t\tthis.pendingMessages.push(pendingMessage);\n\t}\n\n\t/**\n\t * Applies stashed ops at their reference sequence number so they are ready to be ACKed or resubmitted\n\t * @param seqNum - Sequence number at which to apply ops. Will apply all ops if seqNum is undefined.\n\t */\n\tpublic async applyStashedOpsAt(seqNum?: number) {\n\t\t// apply stashed ops at sequence number\n\t\twhile (!this.initialMessages.isEmpty()) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst nextMessage = this.initialMessages.peekFront()!;\n\t\t\tif (seqNum !== undefined) {\n\t\t\t\tif (nextMessage.referenceSequenceNumber > seqNum) {\n\t\t\t\t\tbreak; // nothing left to do at this sequence number\n\t\t\t\t}\n\t\t\t\tif (nextMessage.referenceSequenceNumber < seqNum) {\n\t\t\t\t\tthrow new Error(\"loaded from snapshot too recent to apply stashed ops\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t// applyStashedOp will cause the DDS to behave as if it has sent the op but not actually send it\n\t\t\t\tconst localOpMetadata = await this.stateHandler.applyStashedOp(nextMessage.content);\n\t\t\t\tnextMessage.localOpMetadata = localOpMetadata;\n\t\t\t} catch (error) {\n\t\t\t\tthrow DataProcessingError.wrapIfUnrecognized(error, \"applyStashedOp\", nextMessage);\n\t\t\t}\n\n\t\t\t// then we push onto pendingMessages which will cause PendingStateManager to resubmit when we connect\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.pendingMessages.push(this.initialMessages.shift()!);\n\t\t}\n\t}\n\n\t/**\n\t * Processes a local message once its ack'd by the server. It verifies that there was no data corruption and that\n\t * the batch information was preserved for batch messages.\n\t * @param message - The message that got ack'd and needs to be processed.\n\t */\n\tpublic processPendingLocalMessage(message: InboundSequencedContainerRuntimeMessage): unknown {\n\t\t// Pre-processing part - This may be the start of a batch.\n\t\tthis.maybeProcessBatchBegin(message);\n\n\t\t// Get the next message from the pending queue. Verify a message exists.\n\t\tconst pendingMessage = this.pendingMessages.peekFront();\n\t\tassert(\n\t\t\tpendingMessage !== undefined,\n\t\t\t0x169 /* \"No pending message found for this remote message\" */,\n\t\t);\n\t\tthis.savedOps.push(pendingMessage);\n\n\t\tthis.pendingMessages.shift();\n\n\t\tconst messageContent = buildPendingMessageContent(message);\n\n\t\t// Stringified content should match\n\t\tif (pendingMessage.content !== messageContent) {\n\t\t\tthis.stateHandler.close(\n\t\t\t\tDataProcessingError.create(\n\t\t\t\t\t\"pending local message content mismatch\",\n\t\t\t\t\t\"unexpectedAckReceived\",\n\t\t\t\t\tmessage,\n\t\t\t\t\t{\n\t\t\t\t\t\texpectedMessageType: JSON.parse(pendingMessage.content).type,\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Post-processing part - If we are processing a batch then this could be the last message in the batch.\n\t\tthis.maybeProcessBatchEnd(message);\n\n\t\treturn pendingMessage.localOpMetadata;\n\t}\n\n\t/**\n\t * This message could be the first message in batch. If so, set batch state marking the beginning of a batch.\n\t * @param message - The message that is being processed.\n\t */\n\tprivate maybeProcessBatchBegin(message: ISequencedDocumentMessage) {\n\t\t// This message is the first in a batch if the \"batch\" property on the metadata is set to true\n\t\tif ((message.metadata as IBatchMetadata | undefined)?.batch) {\n\t\t\t// We should not already be processing a batch and there should be no pending batch begin message.\n\t\t\tassert(\n\t\t\t\t!this.isProcessingBatch && this.pendingBatchBeginMessage === undefined,\n\t\t\t\t0x16b /* \"The pending batch state indicates we are already processing a batch\" */,\n\t\t\t);\n\n\t\t\t// Set the pending batch state indicating we have started processing a batch.\n\t\t\tthis.pendingBatchBeginMessage = message;\n\t\t\tthis.isProcessingBatch = true;\n\t\t}\n\t}\n\n\t/**\n\t * This message could be the last message in batch. If so, clear batch state since the batch is complete.\n\t * @param message - The message that is being processed.\n\t */\n\tprivate maybeProcessBatchEnd(message: ISequencedDocumentMessage) {\n\t\tif (!this.isProcessingBatch) {\n\t\t\treturn;\n\t\t}\n\n\t\t// There should be a pending batch begin message.\n\t\tassert(\n\t\t\tthis.pendingBatchBeginMessage !== undefined,\n\t\t\t0x16d /* \"There is no pending batch begin message\" */,\n\t\t);\n\n\t\tconst batchEndMetadata = (message.metadata as IBatchMetadata | undefined)?.batch;\n\t\tif (this.pendingMessages.isEmpty() || batchEndMetadata === false) {\n\t\t\t// Get the batch begin metadata from the first message in the batch.\n\t\t\tconst batchBeginMetadata = (\n\t\t\t\tthis.pendingBatchBeginMessage.metadata as IBatchMetadata | undefined\n\t\t\t)?.batch;\n\n\t\t\t// There could be just a single message in the batch. If so, it should not have any batch metadata. If there\n\t\t\t// are multiple messages in the batch, verify that we got the correct batch begin and end metadata.\n\t\t\tif (this.pendingBatchBeginMessage === message) {\n\t\t\t\tassert(\n\t\t\t\t\tbatchBeginMetadata === undefined,\n\t\t\t\t\t0x16e /* \"Batch with single message should not have batch metadata\" */,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tif (batchBeginMetadata !== true || batchEndMetadata !== false) {\n\t\t\t\t\tthis.stateHandler.close(\n\t\t\t\t\t\tDataProcessingError.create(\n\t\t\t\t\t\t\t\"Pending batch inconsistency\", // Formerly known as asserts 0x16f and 0x170\n\t\t\t\t\t\t\t\"processPendingLocalMessage\",\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\truntimeVersion: pkgVersion,\n\t\t\t\t\t\t\t\tbatchClientId:\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\t\t\t\t\t\t\tthis.pendingBatchBeginMessage.clientId === null\n\t\t\t\t\t\t\t\t\t\t? \"null\"\n\t\t\t\t\t\t\t\t\t\t: this.pendingBatchBeginMessage.clientId,\n\t\t\t\t\t\t\t\tclientId: this.stateHandler.clientId(),\n\t\t\t\t\t\t\t\thasBatchStart: batchBeginMetadata === true,\n\t\t\t\t\t\t\t\thasBatchEnd: batchEndMetadata === false,\n\t\t\t\t\t\t\t\tmessageType: message.type,\n\t\t\t\t\t\t\t\tpendingMessagesCount: this.pendingMessagesCount,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Clear the pending batch state now that we have processed the entire batch.\n\t\t\tthis.pendingBatchBeginMessage = undefined;\n\t\t\tthis.isProcessingBatch = false;\n\t\t}\n\t}\n\n\t/**\n\t * Called when the Container's connection state changes. If the Container gets connected, it replays all the pending\n\t * states in its queue. This includes triggering resubmission of unacked ops.\n\t */\n\tpublic replayPendingStates() {\n\t\tassert(\n\t\t\tthis.stateHandler.connected(),\n\t\t\t0x172 /* \"The connection state is not consistent with the runtime\" */,\n\t\t);\n\n\t\t// This assert suggests we are about to send same ops twice, which will result in data loss.\n\t\tassert(\n\t\t\tthis.clientId !== this.stateHandler.clientId(),\n\t\t\t0x173 /* \"replayPendingStates called twice for same clientId!\" */,\n\t\t);\n\t\tthis.clientId = this.stateHandler.clientId();\n\n\t\tassert(\n\t\t\tthis.initialMessages.isEmpty(),\n\t\t\t0x174 /* \"initial states should be empty before replaying pending\" */,\n\t\t);\n\n\t\tconst initialPendingMessagesCount = this.pendingMessages.length;\n\t\tlet remainingPendingMessagesCount = this.pendingMessages.length;\n\n\t\t// Process exactly `pendingMessagesCount` items in the queue as it represents the number of messages that were\n\t\t// pending when we connected. This is important because the `reSubmitFn` might add more items in the queue\n\t\t// which must not be replayed.\n\t\twhile (remainingPendingMessagesCount > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tlet pendingMessage = this.pendingMessages.shift()!;\n\t\t\tremainingPendingMessagesCount--;\n\t\t\tassert(\n\t\t\t\tpendingMessage.opMetadata?.batch !== false,\n\t\t\t\t0x41b /* We cannot process batches in chunks */,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * We want to ensure grouped messages get processed in a batch.\n\t\t\t * Note: It is not possible for the PendingStateManager to receive a partially acked batch. It will\n\t\t\t * either receive the whole batch ack or nothing at all.\n\t\t\t */\n\t\t\tif (pendingMessage.opMetadata?.batch) {\n\t\t\t\tassert(\n\t\t\t\t\tremainingPendingMessagesCount > 0,\n\t\t\t\t\t0x554 /* Last pending message cannot be a batch begin */,\n\t\t\t\t);\n\n\t\t\t\tconst batch: IPendingBatchMessage[] = [];\n\n\t\t\t\t// check is >= because batch end may be last pending message\n\t\t\t\twhile (remainingPendingMessagesCount >= 0) {\n\t\t\t\t\tbatch.push({\n\t\t\t\t\t\tcontent: pendingMessage.content,\n\t\t\t\t\t\tlocalOpMetadata: pendingMessage.localOpMetadata,\n\t\t\t\t\t\topMetadata: pendingMessage.opMetadata,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (pendingMessage.opMetadata?.batch === false) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tassert(remainingPendingMessagesCount > 0, 0x555 /* No batch end found */);\n\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tpendingMessage = this.pendingMessages.shift()!;\n\t\t\t\t\tremainingPendingMessagesCount--;\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingMessage.opMetadata?.batch !== true,\n\t\t\t\t\t\t0x556 /* Batch start needs a corresponding batch end */,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.stateHandler.reSubmitBatch(batch);\n\t\t\t} else {\n\t\t\t\tthis.stateHandler.reSubmit({\n\t\t\t\t\tcontent: pendingMessage.content,\n\t\t\t\t\tlocalOpMetadata: pendingMessage.localOpMetadata,\n\t\t\t\t\topMetadata: pendingMessage.opMetadata,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// pending ops should no longer depend on previous sequenced local ops after resubmit\n\t\tthis.savedOps = [];\n\n\t\t// We replayPendingStates on read connections too - we expect these to get nack'd though, and to then reconnect\n\t\t// on a write connection and replay again. This filters out the replay that happens on the read connection so\n\t\t// we only see the replays on write connections (that have a chance to go through).\n\t\tif (this.stateHandler.isActiveConnection()) {\n\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\teventName: \"PendingStatesReplayed\",\n\t\t\t\tcount: initialPendingMessagesCount,\n\t\t\t\tclientId: this.stateHandler.clientId(),\n\t\t\t});\n\t\t}\n\t}\n}\n"]}
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  /*!
2
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
4
  * Licensed under the MIT License.
@@ -1 +1 @@
1
- {"version":3,"file":"scheduleManager.d.ts","sourceRoot":"","sources":["../src/scheduleManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACnG,OAAO,EAKN,mBAAmB,EACnB,MAAM,iCAAiC,CAAC;AAczC;;;;;;;;GAQG;AACH,qBAAa,eAAe;IAM1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,GAAG,SAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM;IARxB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,QAAQ,CAAS;gBAGP,YAAY,EAAE,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,EACxE,OAAO,EAAE,YAAY,EAC7B,WAAW,EAAE,MAAM,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,mBAAmB;IAStC,kBAAkB,CAAC,OAAO,EAAE,yBAAyB;IAkBrD,iBAAiB,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,EAAE,OAAO,EAAE,yBAAyB;CAwBnF"}
1
+ {"version":3,"file":"scheduleManager.d.ts","sourceRoot":"","sources":["../src/scheduleManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACnG,OAAO,EAKN,mBAAmB,EACnB,MAAM,iCAAiC,CAAC;AAczC;;;;;;;;GAQG;AACH,qBAAa,eAAe;IAM1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,GAAG,SAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM;IARxB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,QAAQ,CAAS;gBAGP,YAAY,EAAE,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,EACxE,OAAO,EAAE,YAAY,EAC7B,WAAW,EAAE,MAAM,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,mBAAmB;IAStC,kBAAkB,CAAC,OAAO,EAAE,yBAAyB;IAkBrD,iBAAiB,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,EAAE,OAAO,EAAE,yBAAyB;CAwBnF"}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.38.0"
8
+ "packageVersion": "7.38.3"
9
9
  }
10
10
  ]
11
11
  }
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ /// <reference types="node" />
5
6
  import { EventEmitter } from "events";
6
7
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
7
8
  import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
@@ -1 +1 @@
1
- {"version":3,"file":"batchTracker.d.ts","sourceRoot":"","sources":["../src/batchTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAqB,MAAM,iCAAiC,CAAC;AAIzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,qBAAa,YAAY;IAOvB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IANnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAC7C,OAAO,CAAC,wBAAwB,CAAqB;IACrD,OAAO,CAAC,iBAAiB,CAAa;IACtC,OAAO,CAAC,6BAA6B,CAAqB;gBAGxC,iBAAiB,EAAE,YAAY,EAChD,MAAM,EAAE,oBAAoB,EAC5B,oBAAoB,EAAE,MAAM,EAC5B,sBAAsB,EAAE,MAAM,EAC9B,gBAAgB,GAAE,MAAM,MAAgC;CA8CzD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,sBACT,YAAY,UACvB,mBAAmB,yBACL,MAAM,2BACJ,MAAM,iBAC+D,CAAC"}
1
+ {"version":3,"file":"batchTracker.d.ts","sourceRoot":"","sources":["../src/batchTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAqB,MAAM,iCAAiC,CAAC;AAIzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,qBAAa,YAAY;IAOvB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IANnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAC7C,OAAO,CAAC,wBAAwB,CAAqB;IACrD,OAAO,CAAC,iBAAiB,CAAa;IACtC,OAAO,CAAC,6BAA6B,CAAqB;gBAGxC,iBAAiB,EAAE,YAAY,EAChD,MAAM,EAAE,oBAAoB,EAC5B,oBAAoB,EAAE,MAAM,EAC5B,sBAAsB,EAAE,MAAM,EAC9B,gBAAgB,GAAE,MAAM,MAAgC;CA8CzD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,sBACT,YAAY,UACvB,mBAAmB,yBACL,MAAM,2BACJ,MAAM,iBAC+D,CAAC"}
@@ -36,7 +36,7 @@ class OpPerfTelemetry {
36
36
  };
37
37
  })();
38
38
  this.deltaLatencyLogger = createSampledLogger(logger, deltaLatencyEventSampler);
39
- // The SampledLogger here is used get access to the isSamplingDisabled property dervied from
39
+ // The SampledLogger here is used get access to the isSamplingDisabled property derived from
40
40
  // telemetry config properties. The actual sampling logic for op messages happens outside this SampledLogger
41
41
  // due to complexity of the different asynchronus scenarios of the op message lifecycle.
42
42
  this.opLatencyLogger = createSampledLogger(logger);
@@ -1 +1 @@
1
- {"version":3,"file":"connectionTelemetry.js","sourceRoot":"","sources":["../src/connectionTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIN,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,GACV,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGN,WAAW,GACX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAgCrC,MAAM,eAAe;IA+BpB,YACS,QAA4B,EACnB,YAA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,YAAwE,EACxE,MAA2B;IAE3B,IAAI,eAAe,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIEventSampler,\n\tISampledTelemetryLogger,\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n\tcreateSampledLogger,\n\tformatTick,\n} from \"@fluidframework/telemetry-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\n\n/**\n * We report various latency-related errors when waiting for op roundtrip takes longer than that amout of time.\n */\nexport const latencyThreshold = 5000;\n\n// Phases in OpPerfTelemetry:\n// 1.\tOp is added to DeltaManager (DM) buffer.\n// 2.\tOp is sent to service (op leaves outbound queue).\n// \t - Note: We do not know for sure when op is sent, we only track when it is added to outbound queue.\n// If outbound queue is paused, time queue is paused is counted as network time.\n// 3.\tOp received from service back (pushed to inbound queue).\n// 4.\tOp is processed.\ninterface IOpPerfTelemetryProperties {\n\t/** Measure time between (1) and (2) - Measure time outbound op is sitting in queue due to active batch */\n\tdurationOutboundBatching: number; // was durationOutboundQueue in previous versions\n\t/** Measure time between (2) and (3) - Track how long it took for op to be acked by service */\n\tdurationNetwork: number; // was durationInboundQueue\n\t/** Measure time between (3) and (4) - Time between DM's inbound \"push\" event until DM's \"op\" event */\n\tdurationInboundToProcessing: number;\n\t/** Length of the DeltaManager's inbound queue at the time of the DM's inbound \"push\" event (3) */\n\tlengthInboundQueue: number;\n}\n\n/**\n * Timings collected at various moments during the op processing.\n */\ninterface IOpPerfTimings {\n\t/** Starting time for (1) */\n\tsubmitOpEventTime: number;\n\t/** Starting time for (2) */\n\toutboundPushEventTime: number;\n\t/** Starting time for (3) */\n\tinboundPushEventTime: number;\n}\n\nclass OpPerfTelemetry {\n\tprivate pingLatency: number | undefined;\n\n\t// Collab window tracking. This is timestamp of %1000 message.\n\tprivate sequenceNumberForMsnTracking: number | undefined;\n\tprivate msnTrackingTimestamp: number = 0;\n\t// To track round trip time for every %500 client message.\n\tprivate clientSequenceNumberForLatencyStatistics: number | undefined;\n\t// Performance Data to be reported for ops round trips and processing.\n\tprivate readonly latencyStatistics = new Map<\n\t\tnumber,\n\t\t{\n\t\t\topProcessingTimes: Partial<IOpPerfTimings>;\n\t\t\topPerfData: Partial<IOpPerfTelemetryProperties>;\n\t\t}\n\t>();\n\n\tprivate firstConnection = true;\n\tprivate connectionOpSeqNumber: number | undefined;\n\tprivate readonly bootTime = performance.now();\n\tprivate connectionStartTime = 0;\n\tprivate gap = 0;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tprivate static readonly OP_LATENCY_SAMPLE_RATE = 500;\n\tprivate readonly opLatencyLogger: ISampledTelemetryLogger;\n\n\tprivate static readonly DELTA_LATENCY_SAMPLE_RATE = 100;\n\tprivate readonly deltaLatencyLogger: ISampledTelemetryLogger;\n\n\tpublic constructor(\n\t\tprivate clientId: string | undefined,\n\t\tprivate readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tlogger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.logger = createChildLogger({ logger, namespace: \"OpPerf\" });\n\n\t\tconst deltaLatencyEventSampler: IEventSampler = (() => {\n\t\t\tlet eventCount = -1;\n\t\t\treturn {\n\t\t\t\tsample: () => {\n\t\t\t\t\teventCount++;\n\t\t\t\t\tconst shouldSample =\n\t\t\t\t\t\teventCount % OpPerfTelemetry.DELTA_LATENCY_SAMPLE_RATE === 0;\n\t\t\t\t\tif (shouldSample) {\n\t\t\t\t\t\teventCount = 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn shouldSample;\n\t\t\t\t},\n\t\t\t};\n\t\t})();\n\n\t\tthis.deltaLatencyLogger = createSampledLogger(logger, deltaLatencyEventSampler);\n\n\t\t// The SampledLogger here is used get access to the isSamplingDisabled property dervied from\n\t\t// telemetry config properties. The actual sampling logic for op messages happens outside this SampledLogger\n\t\t// due to complexity of the different asynchronus scenarios of the op message lifecycle.\n\t\tthis.opLatencyLogger = createSampledLogger(logger);\n\n\t\tthis.deltaManager.on(\"pong\", (latency) => this.recordPingTime(latency));\n\t\tthis.deltaManager.on(\"submitOp\", (message) => this.beforeOpSubmit(message));\n\n\t\tthis.deltaManager.on(\"op\", (message) => this.afterProcessingOp(message));\n\n\t\tthis.deltaManager.on(\"connect\", (details, opsBehind) => {\n\t\t\tthis.clientId = details.clientId;\n\t\t\tif (opsBehind !== undefined) {\n\t\t\t\tthis.connectionOpSeqNumber = this.deltaManager.lastKnownSeqNumber;\n\t\t\t\tthis.gap = opsBehind;\n\t\t\t\tthis.connectionStartTime = performance.now();\n\n\t\t\t\t// We might be already up-today. If so, report it right away.\n\t\t\t\tif (this.gap <= 0) {\n\t\t\t\t\tthis.reportGettingUpToDate();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tthis.deltaManager.on(\"disconnect\", () => {\n\t\t\tthis.sequenceNumberForMsnTracking = undefined;\n\t\t\tthis.clientSequenceNumberForLatencyStatistics = undefined;\n\t\t\tthis.connectionOpSeqNumber = undefined;\n\t\t\tthis.firstConnection = false;\n\t\t\tthis.latencyStatistics.clear();\n\t\t});\n\n\t\tthis.deltaManager.outbound.on(\"push\", (messages) => {\n\t\t\tfor (const msg of messages) {\n\t\t\t\tif (\n\t\t\t\t\tmsg.type === MessageType.Operation &&\n\t\t\t\t\t(this.opLatencyLogger.isSamplingDisabled ||\n\t\t\t\t\t\tthis.clientSequenceNumberForLatencyStatistics === msg.clientSequenceNumber)\n\t\t\t\t) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst latencyStats = this.latencyStatistics.get(msg.clientSequenceNumber)!;\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats !== undefined,\n\t\t\t\t\t\t0x7c2 /* Latency stats for op should exist */,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime === undefined,\n\t\t\t\t\t\t0x2c8 /* \"outboundPushEventTime should be undefined\" */,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opPerfData.durationNetwork === undefined,\n\t\t\t\t\t\t0x2c9 /* \"durationNetwork should be undefined\" */,\n\t\t\t\t\t);\n\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime = Date.now();\n\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opPerfData.durationOutboundBatching === undefined,\n\t\t\t\t\t\t0x2ca /* \"durationOutboundBatching should be undefined\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.submitOpEventTime !== undefined,\n\t\t\t\t\t\t0x2cb /* \"submitOpEventTime should be undefined\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tlatencyStats.opPerfData.durationOutboundBatching =\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime -\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.submitOpEventTime;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis.deltaManager.inbound.on(\"push\", (message: ISequencedDocumentMessage) => {\n\t\t\tif (\n\t\t\t\tthis.clientId === message.clientId &&\n\t\t\t\tmessage.type === MessageType.Operation &&\n\t\t\t\t(this.opLatencyLogger.isSamplingDisabled ||\n\t\t\t\t\tthis.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber)\n\t\t\t) {\n\t\t\t\t// We do an explicit check for undefined right after this\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst latencyStats = this.latencyStatistics.get(message.clientSequenceNumber)!;\n\t\t\t\tassert(latencyStats !== undefined, 0x7c3 /* Latency stats for op should exist */);\n\t\t\t\tif (latencyStats.opProcessingTimes.outboundPushEventTime !== undefined) {\n\t\t\t\t\tlatencyStats.opProcessingTimes.inboundPushEventTime = Date.now();\n\t\t\t\t\tlatencyStats.opPerfData.durationNetwork =\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.inboundPushEventTime -\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime;\n\t\t\t\t\tlatencyStats.opPerfData.lengthInboundQueue = this.deltaManager.inbound.length;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis.deltaManager.inbound.on(\"idle\", (count: number, duration: number) => {\n\t\t\t// Do not want to log zero for sure.\n\t\t\t// We are more interested in aggregates, so logging only if we are processing some number of ops\n\t\t\t// Cut-off is arbitrary - can be increased or decreased based on amount of data collected and questions we\n\t\t\t// want to get answered\n\t\t\t// back-compat: Once 0.36 loader version saturates (count & duration args were added there),\n\t\t\t// we can remove typeof check.\n\t\t\tif (typeof count === \"number\" && count >= 100) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"GetDeltas_OpProcessing\",\n\t\t\t\t\tcount,\n\t\t\t\t\tduration,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate reportGettingUpToDate() {\n\t\tthis.connectionOpSeqNumber = undefined;\n\t\tthis.logger.sendPerformanceEvent({\n\t\t\teventName: \"ConnectionSpeed\",\n\t\t\tduration: performance.now() - this.connectionStartTime,\n\t\t\tops: this.gap,\n\t\t\t// track time to connect only for first connection.\n\t\t\ttimeToConnect: this.firstConnection\n\t\t\t\t? formatTick(this.connectionStartTime - this.bootTime)\n\t\t\t\t: undefined,\n\t\t\tfirstConnection: this.firstConnection,\n\t\t});\n\t}\n\n\tprivate recordPingTime(latency: number) {\n\t\tthis.pingLatency = latency;\n\n\t\t// Log if latency is longer than 1 min\n\t\tif (latency > 1000 * 60) {\n\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\teventName: \"LatencyTooLong\",\n\t\t\t\tduration: latency,\n\t\t\t});\n\t\t}\n\n\t\t// logging one in every DELTA_LATENCY_SAMPLE_RATE pongs, including the first time, if it is a \"write\" client.\n\t\tif (this.deltaManager.active) {\n\t\t\tthis.deltaLatencyLogger.sendPerformanceEvent({\n\t\t\t\teventName: \"DeltaLatency\",\n\t\t\t\tduration: latency,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate beforeOpSubmit(message: IDocumentMessage) {\n\t\t// start with first client op and measure latency every 500 client ops\n\t\tif (\n\t\t\tthis.opLatencyLogger.isSamplingDisabled ||\n\t\t\t(this.clientSequenceNumberForLatencyStatistics === undefined &&\n\t\t\t\tmessage.clientSequenceNumber % OpPerfTelemetry.OP_LATENCY_SAMPLE_RATE === 1)\n\t\t) {\n\t\t\tassert(\n\t\t\t\tthis.latencyStatistics.get(message.clientSequenceNumber) === undefined,\n\t\t\t\t0x7c4 /* Existing op perf data for client sequence number */,\n\t\t\t);\n\t\t\tthis.clientSequenceNumberForLatencyStatistics = message.clientSequenceNumber;\n\t\t\tthis.latencyStatistics.set(message.clientSequenceNumber, {\n\t\t\t\topProcessingTimes: {\n\t\t\t\t\tsubmitOpEventTime: Date.now(),\n\t\t\t\t},\n\t\t\t\topPerfData: {},\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate afterProcessingOp(message: ISequencedDocumentMessage) {\n\t\tconst sequenceNumber = message.sequenceNumber;\n\n\t\tif (sequenceNumber === this.connectionOpSeqNumber) {\n\t\t\tthis.reportGettingUpToDate();\n\t\t}\n\n\t\t// Record collab window max size after every 1000th op.\n\t\tif (this.sequenceNumberForMsnTracking === undefined && sequenceNumber % 1000 === 0) {\n\t\t\tthis.sequenceNumberForMsnTracking = sequenceNumber;\n\t\t\tthis.msnTrackingTimestamp = message.timestamp;\n\t\t}\n\t\tif (\n\t\t\tthis.sequenceNumberForMsnTracking !== undefined &&\n\t\t\tmessage.minimumSequenceNumber >= this.sequenceNumberForMsnTracking\n\t\t) {\n\t\t\tassert(\n\t\t\t\tthis.msnTrackingTimestamp !== undefined,\n\t\t\t\t0x2ce /* \"msnTrackingTimestamp should not be undefined\" */,\n\t\t\t);\n\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\teventName: \"MsnStatistics\",\n\t\t\t\tsequenceNumber,\n\t\t\t\tmsnDistance: sequenceNumber - this.sequenceNumberForMsnTracking,\n\t\t\t\tduration: message.timestamp - this.msnTrackingTimestamp,\n\t\t\t});\n\t\t\tthis.sequenceNumberForMsnTracking = undefined;\n\t\t}\n\n\t\tif (\n\t\t\tthis.clientId === message.clientId &&\n\t\t\t(this.opLatencyLogger.isSamplingDisabled ||\n\t\t\t\tthis.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber)\n\t\t) {\n\t\t\t// We do an explicit check for undefined right after this\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst latencyData = this.latencyStatistics.get(message.clientSequenceNumber)!;\n\t\t\tassert(latencyData !== undefined, 0x7c5 /* Undefined latency statistics for op */);\n\t\t\tassert(\n\t\t\t\tlatencyData.opProcessingTimes.submitOpEventTime !== undefined,\n\t\t\t\t0x120 /* \"Undefined latency statistics for op (op send time)\" */,\n\t\t\t);\n\t\t\tconst currentTime = Date.now();\n\t\t\tif (latencyData.opProcessingTimes.inboundPushEventTime !== undefined) {\n\t\t\t\tlatencyData.opPerfData.durationInboundToProcessing =\n\t\t\t\t\tcurrentTime - latencyData.opProcessingTimes.inboundPushEventTime;\n\t\t\t}\n\t\t\tconst duration = currentTime - latencyData.opProcessingTimes.submitOpEventTime;\n\n\t\t\t// One of the core expectations for Fluid service is to be fast.\n\t\t\t// When it's not the case, we want to learn about it and be able to investigate, so\n\t\t\t// raise awareness.\n\t\t\t// This also helps identify cases where it's due to client behavior (sending too many ops)\n\t\t\t// that results in overwhelming ordering service and thus starting to see long latencies.\n\t\t\t// The threshold could be adjusted, but ideally it stays workload-agnostic, as service\n\t\t\t// performance impacts all workloads relying on service.\n\t\t\tconst category = duration > latencyThreshold ? \"error\" : \"performance\";\n\t\t\tthis.opLatencyLogger.sendPerformanceEvent({\n\t\t\t\teventName: \"OpRoundtripTime\",\n\t\t\t\tsequenceNumber,\n\t\t\t\treferenceSequenceNumber: message.referenceSequenceNumber,\n\t\t\t\tduration,\n\t\t\t\tcategory,\n\t\t\t\tpingLatency: this.pingLatency,\n\t\t\t\tmsnDistance:\n\t\t\t\t\tthis.deltaManager.lastSequenceNumber - this.deltaManager.minimumSequenceNumber,\n\t\t\t\t...latencyData.opPerfData,\n\t\t\t});\n\t\t\tthis.clientSequenceNumberForLatencyStatistics = undefined;\n\t\t\tthis.latencyStatistics.delete(message.clientSequenceNumber);\n\t\t}\n\t}\n}\nexport interface IPerfSignalReport {\n\t/**\n\t * Identifier for the signal being submitted in order to\n\t * allow collection of data around the roundtrip of signal messages.\n\t */\n\tsignalSequenceNumber: number;\n\t/**\n\t * Number of signals that were expected but not received.\n\t */\n\tsignalsLost: number;\n\n\t/**\n\t * Timestamp before submitting the signal we will trace.\n\t */\n\tsignalTimestamp: number;\n\n\t/**\n\t * Expected Signal Sequence to be received.\n\t */\n\ttrackingSignalSequenceNumber: number | undefined;\n}\n\nexport function ReportOpPerfTelemetry(\n\tclientId: string | undefined,\n\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\tlogger: ITelemetryLoggerExt,\n) {\n\tnew OpPerfTelemetry(clientId, deltaManager, logger);\n}\n"]}
1
+ {"version":3,"file":"connectionTelemetry.js","sourceRoot":"","sources":["../src/connectionTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIN,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,GACV,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGN,WAAW,GACX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,WAAW,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IACF,CAAC;;AAzQuB,sCAAsB,GAAG,GAAG,AAAN,CAAO;AAG7B,yCAAyB,GAAG,GAAG,AAAN,CAAO;AA8RzD,MAAM,UAAU,qBAAqB,CACpC,QAA4B,EAC5B,YAAwE,EACxE,MAA2B;IAE3B,IAAI,eAAe,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIEventSampler,\n\tISampledTelemetryLogger,\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n\tcreateSampledLogger,\n\tformatTick,\n} from \"@fluidframework/telemetry-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\n\n/**\n * We report various latency-related errors when waiting for op roundtrip takes longer than that amout of time.\n */\nexport const latencyThreshold = 5000;\n\n// Phases in OpPerfTelemetry:\n// 1.\tOp is added to DeltaManager (DM) buffer.\n// 2.\tOp is sent to service (op leaves outbound queue).\n// \t - Note: We do not know for sure when op is sent, we only track when it is added to outbound queue.\n// If outbound queue is paused, time queue is paused is counted as network time.\n// 3.\tOp received from service back (pushed to inbound queue).\n// 4.\tOp is processed.\ninterface IOpPerfTelemetryProperties {\n\t/** Measure time between (1) and (2) - Measure time outbound op is sitting in queue due to active batch */\n\tdurationOutboundBatching: number; // was durationOutboundQueue in previous versions\n\t/** Measure time between (2) and (3) - Track how long it took for op to be acked by service */\n\tdurationNetwork: number; // was durationInboundQueue\n\t/** Measure time between (3) and (4) - Time between DM's inbound \"push\" event until DM's \"op\" event */\n\tdurationInboundToProcessing: number;\n\t/** Length of the DeltaManager's inbound queue at the time of the DM's inbound \"push\" event (3) */\n\tlengthInboundQueue: number;\n}\n\n/**\n * Timings collected at various moments during the op processing.\n */\ninterface IOpPerfTimings {\n\t/** Starting time for (1) */\n\tsubmitOpEventTime: number;\n\t/** Starting time for (2) */\n\toutboundPushEventTime: number;\n\t/** Starting time for (3) */\n\tinboundPushEventTime: number;\n}\n\nclass OpPerfTelemetry {\n\tprivate pingLatency: number | undefined;\n\n\t// Collab window tracking. This is timestamp of %1000 message.\n\tprivate sequenceNumberForMsnTracking: number | undefined;\n\tprivate msnTrackingTimestamp: number = 0;\n\t// To track round trip time for every %500 client message.\n\tprivate clientSequenceNumberForLatencyStatistics: number | undefined;\n\t// Performance Data to be reported for ops round trips and processing.\n\tprivate readonly latencyStatistics = new Map<\n\t\tnumber,\n\t\t{\n\t\t\topProcessingTimes: Partial<IOpPerfTimings>;\n\t\t\topPerfData: Partial<IOpPerfTelemetryProperties>;\n\t\t}\n\t>();\n\n\tprivate firstConnection = true;\n\tprivate connectionOpSeqNumber: number | undefined;\n\tprivate readonly bootTime = performance.now();\n\tprivate connectionStartTime = 0;\n\tprivate gap = 0;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tprivate static readonly OP_LATENCY_SAMPLE_RATE = 500;\n\tprivate readonly opLatencyLogger: ISampledTelemetryLogger;\n\n\tprivate static readonly DELTA_LATENCY_SAMPLE_RATE = 100;\n\tprivate readonly deltaLatencyLogger: ISampledTelemetryLogger;\n\n\tpublic constructor(\n\t\tprivate clientId: string | undefined,\n\t\tprivate readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tlogger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.logger = createChildLogger({ logger, namespace: \"OpPerf\" });\n\n\t\tconst deltaLatencyEventSampler: IEventSampler = (() => {\n\t\t\tlet eventCount = -1;\n\t\t\treturn {\n\t\t\t\tsample: () => {\n\t\t\t\t\teventCount++;\n\t\t\t\t\tconst shouldSample =\n\t\t\t\t\t\teventCount % OpPerfTelemetry.DELTA_LATENCY_SAMPLE_RATE === 0;\n\t\t\t\t\tif (shouldSample) {\n\t\t\t\t\t\teventCount = 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn shouldSample;\n\t\t\t\t},\n\t\t\t};\n\t\t})();\n\n\t\tthis.deltaLatencyLogger = createSampledLogger(logger, deltaLatencyEventSampler);\n\n\t\t// The SampledLogger here is used get access to the isSamplingDisabled property derived from\n\t\t// telemetry config properties. The actual sampling logic for op messages happens outside this SampledLogger\n\t\t// due to complexity of the different asynchronus scenarios of the op message lifecycle.\n\t\tthis.opLatencyLogger = createSampledLogger(logger);\n\n\t\tthis.deltaManager.on(\"pong\", (latency) => this.recordPingTime(latency));\n\t\tthis.deltaManager.on(\"submitOp\", (message) => this.beforeOpSubmit(message));\n\n\t\tthis.deltaManager.on(\"op\", (message) => this.afterProcessingOp(message));\n\n\t\tthis.deltaManager.on(\"connect\", (details, opsBehind) => {\n\t\t\tthis.clientId = details.clientId;\n\t\t\tif (opsBehind !== undefined) {\n\t\t\t\tthis.connectionOpSeqNumber = this.deltaManager.lastKnownSeqNumber;\n\t\t\t\tthis.gap = opsBehind;\n\t\t\t\tthis.connectionStartTime = performance.now();\n\n\t\t\t\t// We might be already up-today. If so, report it right away.\n\t\t\t\tif (this.gap <= 0) {\n\t\t\t\t\tthis.reportGettingUpToDate();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tthis.deltaManager.on(\"disconnect\", () => {\n\t\t\tthis.sequenceNumberForMsnTracking = undefined;\n\t\t\tthis.clientSequenceNumberForLatencyStatistics = undefined;\n\t\t\tthis.connectionOpSeqNumber = undefined;\n\t\t\tthis.firstConnection = false;\n\t\t\tthis.latencyStatistics.clear();\n\t\t});\n\n\t\tthis.deltaManager.outbound.on(\"push\", (messages) => {\n\t\t\tfor (const msg of messages) {\n\t\t\t\tif (\n\t\t\t\t\tmsg.type === MessageType.Operation &&\n\t\t\t\t\t(this.opLatencyLogger.isSamplingDisabled ||\n\t\t\t\t\t\tthis.clientSequenceNumberForLatencyStatistics === msg.clientSequenceNumber)\n\t\t\t\t) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst latencyStats = this.latencyStatistics.get(msg.clientSequenceNumber)!;\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats !== undefined,\n\t\t\t\t\t\t0x7c2 /* Latency stats for op should exist */,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime === undefined,\n\t\t\t\t\t\t0x2c8 /* \"outboundPushEventTime should be undefined\" */,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opPerfData.durationNetwork === undefined,\n\t\t\t\t\t\t0x2c9 /* \"durationNetwork should be undefined\" */,\n\t\t\t\t\t);\n\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime = Date.now();\n\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opPerfData.durationOutboundBatching === undefined,\n\t\t\t\t\t\t0x2ca /* \"durationOutboundBatching should be undefined\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.submitOpEventTime !== undefined,\n\t\t\t\t\t\t0x2cb /* \"submitOpEventTime should be undefined\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tlatencyStats.opPerfData.durationOutboundBatching =\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime -\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.submitOpEventTime;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis.deltaManager.inbound.on(\"push\", (message: ISequencedDocumentMessage) => {\n\t\t\tif (\n\t\t\t\tthis.clientId === message.clientId &&\n\t\t\t\tmessage.type === MessageType.Operation &&\n\t\t\t\t(this.opLatencyLogger.isSamplingDisabled ||\n\t\t\t\t\tthis.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber)\n\t\t\t) {\n\t\t\t\t// We do an explicit check for undefined right after this\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst latencyStats = this.latencyStatistics.get(message.clientSequenceNumber)!;\n\t\t\t\tassert(latencyStats !== undefined, 0x7c3 /* Latency stats for op should exist */);\n\t\t\t\tif (latencyStats.opProcessingTimes.outboundPushEventTime !== undefined) {\n\t\t\t\t\tlatencyStats.opProcessingTimes.inboundPushEventTime = Date.now();\n\t\t\t\t\tlatencyStats.opPerfData.durationNetwork =\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.inboundPushEventTime -\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime;\n\t\t\t\t\tlatencyStats.opPerfData.lengthInboundQueue = this.deltaManager.inbound.length;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis.deltaManager.inbound.on(\"idle\", (count: number, duration: number) => {\n\t\t\t// Do not want to log zero for sure.\n\t\t\t// We are more interested in aggregates, so logging only if we are processing some number of ops\n\t\t\t// Cut-off is arbitrary - can be increased or decreased based on amount of data collected and questions we\n\t\t\t// want to get answered\n\t\t\t// back-compat: Once 0.36 loader version saturates (count & duration args were added there),\n\t\t\t// we can remove typeof check.\n\t\t\tif (typeof count === \"number\" && count >= 100) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"GetDeltas_OpProcessing\",\n\t\t\t\t\tcount,\n\t\t\t\t\tduration,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate reportGettingUpToDate() {\n\t\tthis.connectionOpSeqNumber = undefined;\n\t\tthis.logger.sendPerformanceEvent({\n\t\t\teventName: \"ConnectionSpeed\",\n\t\t\tduration: performance.now() - this.connectionStartTime,\n\t\t\tops: this.gap,\n\t\t\t// track time to connect only for first connection.\n\t\t\ttimeToConnect: this.firstConnection\n\t\t\t\t? formatTick(this.connectionStartTime - this.bootTime)\n\t\t\t\t: undefined,\n\t\t\tfirstConnection: this.firstConnection,\n\t\t});\n\t}\n\n\tprivate recordPingTime(latency: number) {\n\t\tthis.pingLatency = latency;\n\n\t\t// Log if latency is longer than 1 min\n\t\tif (latency > 1000 * 60) {\n\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\teventName: \"LatencyTooLong\",\n\t\t\t\tduration: latency,\n\t\t\t});\n\t\t}\n\n\t\t// logging one in every DELTA_LATENCY_SAMPLE_RATE pongs, including the first time, if it is a \"write\" client.\n\t\tif (this.deltaManager.active) {\n\t\t\tthis.deltaLatencyLogger.sendPerformanceEvent({\n\t\t\t\teventName: \"DeltaLatency\",\n\t\t\t\tduration: latency,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate beforeOpSubmit(message: IDocumentMessage) {\n\t\t// start with first client op and measure latency every 500 client ops\n\t\tif (\n\t\t\tthis.opLatencyLogger.isSamplingDisabled ||\n\t\t\t(this.clientSequenceNumberForLatencyStatistics === undefined &&\n\t\t\t\tmessage.clientSequenceNumber % OpPerfTelemetry.OP_LATENCY_SAMPLE_RATE === 1)\n\t\t) {\n\t\t\tassert(\n\t\t\t\tthis.latencyStatistics.get(message.clientSequenceNumber) === undefined,\n\t\t\t\t0x7c4 /* Existing op perf data for client sequence number */,\n\t\t\t);\n\t\t\tthis.clientSequenceNumberForLatencyStatistics = message.clientSequenceNumber;\n\t\t\tthis.latencyStatistics.set(message.clientSequenceNumber, {\n\t\t\t\topProcessingTimes: {\n\t\t\t\t\tsubmitOpEventTime: Date.now(),\n\t\t\t\t},\n\t\t\t\topPerfData: {},\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate afterProcessingOp(message: ISequencedDocumentMessage) {\n\t\tconst sequenceNumber = message.sequenceNumber;\n\n\t\tif (sequenceNumber === this.connectionOpSeqNumber) {\n\t\t\tthis.reportGettingUpToDate();\n\t\t}\n\n\t\t// Record collab window max size after every 1000th op.\n\t\tif (this.sequenceNumberForMsnTracking === undefined && sequenceNumber % 1000 === 0) {\n\t\t\tthis.sequenceNumberForMsnTracking = sequenceNumber;\n\t\t\tthis.msnTrackingTimestamp = message.timestamp;\n\t\t}\n\t\tif (\n\t\t\tthis.sequenceNumberForMsnTracking !== undefined &&\n\t\t\tmessage.minimumSequenceNumber >= this.sequenceNumberForMsnTracking\n\t\t) {\n\t\t\tassert(\n\t\t\t\tthis.msnTrackingTimestamp !== undefined,\n\t\t\t\t0x2ce /* \"msnTrackingTimestamp should not be undefined\" */,\n\t\t\t);\n\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\teventName: \"MsnStatistics\",\n\t\t\t\tsequenceNumber,\n\t\t\t\tmsnDistance: sequenceNumber - this.sequenceNumberForMsnTracking,\n\t\t\t\tduration: message.timestamp - this.msnTrackingTimestamp,\n\t\t\t});\n\t\t\tthis.sequenceNumberForMsnTracking = undefined;\n\t\t}\n\n\t\tif (\n\t\t\tthis.clientId === message.clientId &&\n\t\t\t(this.opLatencyLogger.isSamplingDisabled ||\n\t\t\t\tthis.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber)\n\t\t) {\n\t\t\t// We do an explicit check for undefined right after this\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst latencyData = this.latencyStatistics.get(message.clientSequenceNumber)!;\n\t\t\tassert(latencyData !== undefined, 0x7c5 /* Undefined latency statistics for op */);\n\t\t\tassert(\n\t\t\t\tlatencyData.opProcessingTimes.submitOpEventTime !== undefined,\n\t\t\t\t0x120 /* \"Undefined latency statistics for op (op send time)\" */,\n\t\t\t);\n\t\t\tconst currentTime = Date.now();\n\t\t\tif (latencyData.opProcessingTimes.inboundPushEventTime !== undefined) {\n\t\t\t\tlatencyData.opPerfData.durationInboundToProcessing =\n\t\t\t\t\tcurrentTime - latencyData.opProcessingTimes.inboundPushEventTime;\n\t\t\t}\n\t\t\tconst duration = currentTime - latencyData.opProcessingTimes.submitOpEventTime;\n\n\t\t\t// One of the core expectations for Fluid service is to be fast.\n\t\t\t// When it's not the case, we want to learn about it and be able to investigate, so\n\t\t\t// raise awareness.\n\t\t\t// This also helps identify cases where it's due to client behavior (sending too many ops)\n\t\t\t// that results in overwhelming ordering service and thus starting to see long latencies.\n\t\t\t// The threshold could be adjusted, but ideally it stays workload-agnostic, as service\n\t\t\t// performance impacts all workloads relying on service.\n\t\t\tconst category = duration > latencyThreshold ? \"error\" : \"performance\";\n\t\t\tthis.opLatencyLogger.sendPerformanceEvent({\n\t\t\t\teventName: \"OpRoundtripTime\",\n\t\t\t\tsequenceNumber,\n\t\t\t\treferenceSequenceNumber: message.referenceSequenceNumber,\n\t\t\t\tduration,\n\t\t\t\tcategory,\n\t\t\t\tpingLatency: this.pingLatency,\n\t\t\t\tmsnDistance:\n\t\t\t\t\tthis.deltaManager.lastSequenceNumber - this.deltaManager.minimumSequenceNumber,\n\t\t\t\t...latencyData.opPerfData,\n\t\t\t});\n\t\t\tthis.clientSequenceNumberForLatencyStatistics = undefined;\n\t\t\tthis.latencyStatistics.delete(message.clientSequenceNumber);\n\t\t}\n\t}\n}\nexport interface IPerfSignalReport {\n\t/**\n\t * Identifier for the signal being submitted in order to\n\t * allow collection of data around the roundtrip of signal messages.\n\t */\n\tsignalSequenceNumber: number;\n\t/**\n\t * Number of signals that were expected but not received.\n\t */\n\tsignalsLost: number;\n\n\t/**\n\t * Timestamp before submitting the signal we will trace.\n\t */\n\tsignalTimestamp: number;\n\n\t/**\n\t * Expected Signal Sequence to be received.\n\t */\n\ttrackingSignalSequenceNumber: number | undefined;\n}\n\nexport function ReportOpPerfTelemetry(\n\tclientId: string | undefined,\n\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\tlogger: ITelemetryLoggerExt,\n) {\n\tnew OpPerfTelemetry(clientId, deltaManager, logger);\n}\n"]}
@@ -9,7 +9,7 @@ import { TypedEventEmitter } from "@fluid-internal/client-utils";
9
9
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
10
10
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
11
11
  import { IClientDetails, IDocumentMessage, IQuorumClients, ISequencedDocumentMessage, ISignalMessage, ISummaryTree, MessageType } from "@fluidframework/protocol-definitions";
12
- import { FlushMode, IFluidDataStoreContextDetached, IFluidDataStoreRegistry, IGarbageCollectionData, NamedFluidDataStoreRegistryEntries, ISummaryTreeWithStats, IDataStore, ITelemetryContext, IIdCompressor, IIdCompressorCore } from "@fluidframework/runtime-definitions";
12
+ import { FlushMode, IFluidDataStoreContextDetached, IFluidDataStoreRegistry, IGarbageCollectionData, NamedFluidDataStoreRegistryEntries, ISummaryTreeWithStats, IDataStore, ITelemetryContext, IIdCompressor, IIdCompressorCore, SerializedIdCompressorWithOngoingSession } from "@fluidframework/runtime-definitions";
13
13
  import { IPendingLocalState } from "./pendingStateManager";
14
14
  import { IBlobManagerLoadInfo, IPendingBlobs } from "./blobManager";
15
15
  import { IContainerRuntimeMetadata, ISerializedElection, SubmitSummaryResult, ISubmitSummaryOptions, ISummarizerInternalsProvider, ISummarizerRuntime, IRefreshSummaryAckOptions, IOnDemandSummarizeOptions, ISummarizeResults, IEnqueueSummarizeOptions, EnqueueSummarizeResult, ISummarizerEvents, ISummarizer } from "./summary";
@@ -286,6 +286,10 @@ export interface IPendingRuntimeState {
286
286
  * Pending blobs from BlobManager
287
287
  */
288
288
  pendingAttachmentBlobs?: IPendingBlobs;
289
+ /**
290
+ * Pending idCompressor state
291
+ */
292
+ pendingIdCompressorState?: SerializedIdCompressorWithOngoingSession;
289
293
  }
290
294
  /** The default time to wait for pending ops to be processed during summarization */
291
295
  export declare const defaultPendingOpsWaitTimeoutMs = 1000;
@@ -564,16 +568,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
564
568
  private shouldContinueReconnecting;
565
569
  private resetReconnectCount;
566
570
  private replayPendingStates;
567
- /**
568
- * Updates the runtime's IdCompressor with the stashed state present in the given op. This is a bit of a
569
- * hack and is unnecessarily expensive. As it stands, every locally stashed op (all ops that get stored in
570
- * the PendingStateManager) will store their serialized representation locally until ack'd. Upon receiving
571
- * this stashed state, the IdCompressor blindly deserializes to the stashed state and assumes the session.
572
- * Technically only the last stashed state is needed to do this correctly, but we would have to write some
573
- * more hacky code to modify the batch before it gets sent out.
574
- * @param content - An IdAllocationOp with "stashedState", which is a representation of un-ack'd local state.
575
- */
576
- private applyStashedIdAllocationOp;
577
571
  /**
578
572
  * Parse an op's type and actual content from given serialized content
579
573
  * ! Note: this format needs to be in-line with what is set in the "ContainerRuntime.submit(...)" method
@@ -1 +1 @@
1
- {"version":3,"file":"containerRuntime.d.ts","sourceRoot":"","sources":["../src/containerRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAGN,WAAW,EACX,YAAY,EACZ,mBAAmB,EAEnB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,0BAA0B,EAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,SAAS,EAET,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,uBAAuB,EACvB,WAAW,EACX,cAAc,EACd,OAAO,EAEP,0BAA0B,EAC1B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EACvB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAS,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAYN,mBAAmB,EAEnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAGN,uBAAuB,EAEvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,yBAAyB,EACzB,cAAc,EAGd,YAAY,EACZ,WAAW,EAEX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,SAAS,EAIT,8BAA8B,EAC9B,uBAAuB,EAEvB,sBAAsB,EAItB,kCAAkC,EAClC,qBAAqB,EAKrB,UAAU,EACV,iBAAiB,EAEjB,aAAa,EACb,iBAAiB,EAGjB,MAAM,qCAAqC,CAAC;AAmB7C,OAAO,EAEN,kBAAkB,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CAAC,aAAa;IASrB,OAAO,CAAC,QAAQ;IAMhB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAqDpB,OAAO,CAAC,QAAQ;IAehB,6EAA6E;IAChE,uBAAuB,CAAC,OAAO,EAAE,yBAAyB;IA4DvE;;;;;OAKG;YACW,8BAA8B;YAyB9B,oBAAoB;IAOlC;;;;OAIG;YACW,8BAA8B;IAqDrC,eAAe;IAET,oBAAoB,CAAC,KAAK,CAAC,EAAE,0BAA0B,GAAG,OAAO,CAAC,OAAO,CAAC;IA0ChF,iBAAiB,CAAC,OAAO,EAAE,yBAAyB,GAAG,iBAAiB;IAaxE,gBAAgB,CAAC,OAAO,EAAE,wBAAwB,GAAG,sBAAsB;IAalF;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,qCAAqC;IAgB7C,OAAO,KAAK,sBAAsB,GAKjC;CACD"}
@@ -38,12 +38,6 @@ function compatBehaviorAllowsMessageType(_unknownContainerRuntimeMessageType, co
38
38
  // undefined defaults to same behavior as "FailToProcess"
39
39
  return compatBehavior === "Ignore";
40
40
  }
41
- function prepareLocalContainerRuntimeIdAllocationMessageForTransit(message) {
42
- // Remove the stashedState from the op if it's a stashed op
43
- if ("stashedState" in message.contents) {
44
- delete message.contents.stashedState;
45
- }
46
- }
47
41
  /**
48
42
  * @public
49
43
  */
@@ -348,10 +342,16 @@ export class ContainerRuntime extends TypedEventEmitter {
348
342
  let idCompressor;
349
343
  if (idCompressorEnabled) {
350
344
  const { IdCompressor, createSessionId } = await import("./id-compressor");
351
- idCompressor =
352
- serializedIdCompressor !== undefined
353
- ? IdCompressor.deserialize(serializedIdCompressor, createSessionId())
354
- : IdCompressor.create(logger);
345
+ const pendingLocalState = context.pendingLocalState;
346
+ if (pendingLocalState?.pendingIdCompressorState !== undefined) {
347
+ idCompressor = IdCompressor.deserialize(pendingLocalState.pendingIdCompressorState);
348
+ }
349
+ else if (serializedIdCompressor !== undefined) {
350
+ idCompressor = IdCompressor.deserialize(serializedIdCompressor, createSessionId());
351
+ }
352
+ else {
353
+ idCompressor = IdCompressor.create(logger);
354
+ }
355
355
  }
356
356
  const runtime = new containerRuntimeCtor(context, registry, metadata, electedSummarizerData, chunks ?? [], aliases ?? [], {
357
357
  summaryOptions,
@@ -567,7 +567,12 @@ export class ContainerRuntime extends TypedEventEmitter {
567
567
  this.telemetryDocumentId = metadata?.telemetryDocumentId ?? uuid();
568
568
  this.disableAttachReorder = this.mc.config.getBoolean("Fluid.ContainerRuntime.disableAttachOpReorder");
569
569
  const disableChunking = this.mc.config.getBoolean("Fluid.ContainerRuntime.CompressionChunkingDisabled");
570
- const opGroupingManager = new OpGroupingManager(this.groupedBatchingEnabled);
570
+ const opGroupingManager = new OpGroupingManager({
571
+ groupedBatchingEnabled: this.groupedBatchingEnabled,
572
+ opCountThreshold: this.mc.config.getNumber("Fluid.ContainerRuntime.GroupedBatchingOpCount") ?? 2,
573
+ reentrantBatchGroupingEnabled: this.mc.config.getBoolean("Fluid.ContainerRuntime.GroupedBatchingReentrancy") ??
574
+ true,
575
+ }, this.mc.logger);
571
576
  const opSplitter = new OpSplitter(chunks, this.submitBatchFn, disableChunking === true ? Number.POSITIVE_INFINITY : runtimeOptions.chunkSizeInBytes, runtimeOptions.maxBatchSizeInBytes, this.mc.logger);
572
577
  this.remoteMessageProcessor = new RemoteMessageProcessor(opSplitter, new OpDecompressor(this.mc.logger), opGroupingManager);
573
578
  this.handleContext = new ContainerFluidHandleContext("", this);
@@ -686,7 +691,6 @@ export class ContainerRuntime extends TypedEventEmitter {
686
691
  compressionOptions,
687
692
  maxBatchSizeInBytes: runtimeOptions.maxBatchSizeInBytes,
688
693
  disablePartialFlush: disablePartialFlush === true,
689
- enableGroupedBatching: this.groupedBatchingEnabled,
690
694
  },
691
695
  logger: this.mc.logger,
692
696
  groupingManager: opGroupingManager,
@@ -1046,19 +1050,6 @@ export class ContainerRuntime extends TypedEventEmitter {
1046
1050
  // Officially transition from the old state to the new state.
1047
1051
  this.updateDocumentDirtyState(newState);
1048
1052
  }
1049
- /**
1050
- * Updates the runtime's IdCompressor with the stashed state present in the given op. This is a bit of a
1051
- * hack and is unnecessarily expensive. As it stands, every locally stashed op (all ops that get stored in
1052
- * the PendingStateManager) will store their serialized representation locally until ack'd. Upon receiving
1053
- * this stashed state, the IdCompressor blindly deserializes to the stashed state and assumes the session.
1054
- * Technically only the last stashed state is needed to do this correctly, but we would have to write some
1055
- * more hacky code to modify the batch before it gets sent out.
1056
- * @param content - An IdAllocationOp with "stashedState", which is a representation of un-ack'd local state.
1057
- */
1058
- async applyStashedIdAllocationOp(op) {
1059
- const { IdCompressor } = await import("./id-compressor");
1060
- this.idCompressor = IdCompressor.deserialize(op.stashedState);
1061
- }
1062
1053
  /**
1063
1054
  * Parse an op's type and actual content from given serialized content
1064
1055
  * ! Note: this format needs to be in-line with what is set in the "ContainerRuntime.submit(...)" method
@@ -1080,7 +1071,7 @@ export class ContainerRuntime extends TypedEventEmitter {
1080
1071
  return this.dataStores.applyStashedAttachOp(opContents.contents);
1081
1072
  case ContainerMessageType.IdAllocation:
1082
1073
  assert(this.idCompressor !== undefined, 0x67b /* IdCompressor should be defined if enabled */);
1083
- return this.applyStashedIdAllocationOp(opContents.contents);
1074
+ return;
1084
1075
  case ContainerMessageType.Alias:
1085
1076
  case ContainerMessageType.BlobAttach:
1086
1077
  return;
@@ -1266,7 +1257,11 @@ export class ContainerRuntime extends TypedEventEmitter {
1266
1257
  break;
1267
1258
  case ContainerMessageType.IdAllocation:
1268
1259
  assert(this.idCompressor !== undefined, 0x67c /* IdCompressor should be defined if enabled */);
1269
- this.idCompressor.finalizeCreationRange(messageWithContext.message.contents);
1260
+ // Don't re-finalize the range if we're processing a "savedOp" in
1261
+ // stashed ops flow. The compressor is stashed with these ops already processed.
1262
+ if (messageWithContext.message.metadata?.savedOp !== true) {
1263
+ this.idCompressor.finalizeCreationRange(messageWithContext.message.contents);
1264
+ }
1270
1265
  break;
1271
1266
  case ContainerMessageType.ChunkedOp:
1272
1267
  case ContainerMessageType.Rejoin:
@@ -2142,12 +2137,12 @@ export class ContainerRuntime extends TypedEventEmitter {
2142
2137
  contents: JSON.stringify(idAllocationMessage),
2143
2138
  referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
2144
2139
  metadata: undefined,
2145
- localOpMetadata: this.idCompressor?.serialize(true),
2140
+ localOpMetadata: undefined,
2146
2141
  type: ContainerMessageType.IdAllocation,
2147
2142
  };
2148
2143
  }
2149
2144
  if (idAllocationBatchMessage !== undefined) {
2150
- this.outbox.submit(idAllocationBatchMessage);
2145
+ this.outbox.submitIdAllocation(idAllocationBatchMessage);
2151
2146
  }
2152
2147
  }
2153
2148
  }
@@ -2332,10 +2327,7 @@ export class ContainerRuntime extends TypedEventEmitter {
2332
2327
  break;
2333
2328
  case ContainerMessageType.Attach:
2334
2329
  case ContainerMessageType.Alias:
2335
- this.submit(message, localOpMetadata);
2336
- break;
2337
2330
  case ContainerMessageType.IdAllocation: {
2338
- prepareLocalContainerRuntimeIdAllocationMessageForTransit(message);
2339
2331
  this.submit(message, localOpMetadata);
2340
2332
  break;
2341
2333
  }
@@ -2504,9 +2496,11 @@ export class ContainerRuntime extends TypedEventEmitter {
2504
2496
  if (!pendingAttachmentBlobs && !this.hasPendingMessages()) {
2505
2497
  return; // no pending state to save
2506
2498
  }
2499
+ const pendingIdCompressorState = this.idCompressor?.serialize(true);
2507
2500
  const pendingState = {
2508
2501
  pending,
2509
2502
  pendingAttachmentBlobs,
2503
+ pendingIdCompressorState,
2510
2504
  };
2511
2505
  event.end({
2512
2506
  attachmentBlobsSize: Object.keys(pendingAttachmentBlobs ?? {}).length,