@fluidframework/container-runtime 2.0.0-internal.4.2.1 → 2.0.0-internal.4.3.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/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +1 -0
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +9 -6
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStores.d.ts +5 -5
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +3 -6
- package/dist/dataStores.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +1 -27
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +30 -227
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +0 -10
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js +1 -20
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +91 -0
- package/dist/gc/gcTelemetry.d.ts.map +1 -0
- package/dist/gc/gcTelemetry.js +262 -0
- package/dist/gc/gcTelemetry.js.map +1 -0
- package/dist/gc/index.d.ts +2 -1
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +4 -2
- package/dist/gc/index.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js +1 -1
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/opLifecycle/outbox.js +1 -1
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +25 -22
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +1 -1
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +14 -17
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/summarizer.d.ts +2 -0
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +9 -4
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerHeuristics.d.ts +8 -9
- package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summary/summarizerHeuristics.js +15 -16
- package/dist/summary/summarizerHeuristics.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +2 -0
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +4 -3
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +1 -0
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +9 -6
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStores.d.ts +5 -5
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +3 -6
- package/lib/dataStores.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +1 -27
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +34 -231
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts +0 -10
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js +0 -18
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +91 -0
- package/lib/gc/gcTelemetry.d.ts.map +1 -0
- package/lib/gc/gcTelemetry.js +257 -0
- package/lib/gc/gcTelemetry.js.map +1 -0
- package/lib/gc/index.d.ts +2 -1
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js +2 -1
- package/lib/gc/index.js.map +1 -1
- package/lib/opLifecycle/opGroupingManager.js +1 -1
- package/lib/opLifecycle/opGroupingManager.js.map +1 -1
- package/lib/opLifecycle/outbox.js +1 -1
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js +25 -22
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +1 -1
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +14 -17
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/summarizer.d.ts +2 -0
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +9 -4
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerHeuristics.d.ts +8 -9
- package/lib/summary/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summary/summarizerHeuristics.js +15 -16
- package/lib/summary/summarizerHeuristics.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +2 -0
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +4 -3
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/package.json +17 -17
- package/src/connectionTelemetry.ts +1 -0
- package/src/containerRuntime.ts +12 -11
- package/src/dataStores.ts +4 -7
- package/src/gc/garbageCollection.ts +53 -315
- package/src/gc/gcHelpers.ts +1 -38
- package/src/gc/gcTelemetry.ts +393 -0
- package/src/gc/index.ts +1 -1
- package/src/opLifecycle/README.md +13 -0
- package/src/opLifecycle/opGroupingManager.ts +1 -1
- package/src/opLifecycle/outbox.ts +2 -2
- package/src/opLifecycle/remoteMessageProcessor.ts +37 -28
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +1 -4
- package/src/summary/orderedClientElection.ts +14 -17
- package/src/summary/summarizer.ts +17 -5
- package/src/summary/summarizerHeuristics.ts +15 -16
- package/src/summary/summarizerTypes.ts +2 -0
- package/src/summary/summaryGenerator.ts +5 -4
|
@@ -2,29 +2,18 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
var t = {};
|
|
7
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
8
|
-
t[p] = s[p];
|
|
9
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
10
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
11
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
12
|
-
t[p[i]] = s[p[i]];
|
|
13
|
-
}
|
|
14
|
-
return t;
|
|
15
|
-
};
|
|
16
|
-
import { assert, LazyPromise, Timer } from "@fluidframework/common-utils";
|
|
5
|
+
import { LazyPromise, Timer } from "@fluidframework/common-utils";
|
|
17
6
|
import { ClientSessionExpiredError, DataProcessingError } from "@fluidframework/container-utils";
|
|
18
7
|
import { gcTreeKey, } from "@fluidframework/runtime-definitions";
|
|
19
|
-
import {
|
|
20
|
-
import { ChildLogger, generateStack, loggerToMonitoringContext, PerformanceEvent, TelemetryDataTag, } from "@fluidframework/telemetry-utils";
|
|
8
|
+
import { ChildLogger, loggerToMonitoringContext, PerformanceEvent, } from "@fluidframework/telemetry-utils";
|
|
21
9
|
import { RuntimeHeaders } from "../containerRuntime";
|
|
22
10
|
import { generateGCConfigs } from "./gcConfigs";
|
|
23
|
-
import {
|
|
24
|
-
import { cloneGCData, concatGarbageCollectionData, getGCDataFromSnapshot
|
|
11
|
+
import { GCNodeType, UnreferencedState, } from "./gcDefinitions";
|
|
12
|
+
import { cloneGCData, concatGarbageCollectionData, getGCDataFromSnapshot } from "./gcHelpers";
|
|
25
13
|
import { runGarbageCollection } from "./gcReferenceGraphAlgorithm";
|
|
26
14
|
import { GCSummaryStateTracker } from "./gcSummaryStateTracker";
|
|
27
15
|
import { UnreferencedStateTracker } from "./gcUnreferencedStateTracker";
|
|
16
|
+
import { GCTelemetryTracker } from "./gcTelemetry";
|
|
28
17
|
/**
|
|
29
18
|
* The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains
|
|
30
19
|
* its state across summaries.
|
|
@@ -58,16 +47,10 @@ export class GarbageCollector {
|
|
|
58
47
|
this.deletedNodes = new Set();
|
|
59
48
|
// Map of node ids to their unreferenced state tracker.
|
|
60
49
|
this.unreferencedNodesState = new Map();
|
|
61
|
-
// Keeps track of unreferenced events that are logged for a node. This is used to limit the log generation to one
|
|
62
|
-
// per event per node.
|
|
63
|
-
this.loggedUnreferencedEvents = new Set();
|
|
64
|
-
// Queue for unreferenced events that should be logged the next time GC runs.
|
|
65
|
-
this.pendingEventsQueue = [];
|
|
66
50
|
// The number of times GC has successfully completed on this instance of GarbageCollector.
|
|
67
51
|
this.completedRuns = 0;
|
|
68
52
|
this.runtime = createParams.runtime;
|
|
69
53
|
this.isSummarizerClient = createParams.isSummarizerClient;
|
|
70
|
-
this.createContainerMetadata = createParams.createContainerMetadata;
|
|
71
54
|
this.getNodePackagePath = createParams.getNodePackagePath;
|
|
72
55
|
this.getLastSummaryTimestampMs = createParams.getLastSummaryTimestampMs;
|
|
73
56
|
this.activeConnection = createParams.activeConnection;
|
|
@@ -88,6 +71,7 @@ export class GarbageCollector {
|
|
|
88
71
|
this.sessionExpiryTimer.start();
|
|
89
72
|
}
|
|
90
73
|
this.summaryStateTracker = new GCSummaryStateTracker(this.configs, (baseSnapshot === null || baseSnapshot === void 0 ? void 0 : baseSnapshot.trees[gcTreeKey]) !== undefined /* wasGCRunInBaseSnapshot */);
|
|
74
|
+
this.telemetryTracker = new GCTelemetryTracker(this.mc, this.configs, this.isSummarizerClient, this.runtime.gcTombstoneEnforcementAllowed, createParams.createContainerMetadata, (nodeId) => this.runtime.getNodeType(nodeId), (nodeId) => this.unreferencedNodesState.get(nodeId), this.getNodePackagePath);
|
|
91
75
|
// Get the GC data from the base snapshot. Use LazyPromise because we only want to do this once since it
|
|
92
76
|
// it involves fetching blobs from storage which is expensive.
|
|
93
77
|
this.baseSnapshotDataP = new LazyPromise(async () => {
|
|
@@ -376,9 +360,8 @@ export class GarbageCollector {
|
|
|
376
360
|
// Update the current mark state and update the runtime of all used routes or ids that used as per the GC run.
|
|
377
361
|
const sweepReadyNodes = this.updateMarkPhase(gcData, gcResult, currentReferenceTimestampMs, logger);
|
|
378
362
|
this.runtime.updateUsedRoutes(gcResult.referencedNodeIds);
|
|
379
|
-
// Log events for objects that are ready to be deleted by sweep.
|
|
380
|
-
|
|
381
|
-
this.logSweepEvents(logger, currentReferenceTimestampMs);
|
|
363
|
+
// Log events for objects that are ready to be deleted by sweep.
|
|
364
|
+
this.telemetryTracker.logSweepEvents(logger, currentReferenceTimestampMs, this.unreferencedNodesState, this.completedRuns, this.getLastSummaryTimestampMs());
|
|
382
365
|
let updatedGCData = gcData;
|
|
383
366
|
if (this.configs.shouldRunSweep) {
|
|
384
367
|
updatedGCData = this.runSweepPhase(sweepReadyNodes, gcData);
|
|
@@ -399,7 +382,7 @@ export class GarbageCollector {
|
|
|
399
382
|
// Log pending unreferenced events such as a node being used after inactive. This is done after GC runs and
|
|
400
383
|
// updates its state so that we don't send false positives based on intermediate state. For example, we may get
|
|
401
384
|
// reference to an unreferenced node from another unreferenced node which means the node wasn't revived.
|
|
402
|
-
await this.
|
|
385
|
+
await this.telemetryTracker.logPendingEvents(logger);
|
|
403
386
|
return gcStats;
|
|
404
387
|
}
|
|
405
388
|
/**
|
|
@@ -475,10 +458,16 @@ export class GarbageCollector {
|
|
|
475
458
|
if (!this.configs.shouldRunGC) {
|
|
476
459
|
return;
|
|
477
460
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
461
|
+
this.telemetryTracker.nodeUsed({
|
|
462
|
+
nodeId: nodePath,
|
|
463
|
+
usageType: reason,
|
|
464
|
+
currentReferenceTimestampMs: timestampMs !== null && timestampMs !== void 0 ? timestampMs : this.runtime.getCurrentReferenceTimestampMs(),
|
|
465
|
+
packagePath,
|
|
466
|
+
completedGCRuns: this.completedRuns,
|
|
467
|
+
isTombstoned: this.tombstones.includes(nodePath),
|
|
468
|
+
lastSummaryTime: this.getLastSummaryTimestampMs(),
|
|
469
|
+
viaHandle: requestHeaders === null || requestHeaders === void 0 ? void 0 : requestHeaders[RuntimeHeaders.viaHandle],
|
|
470
|
+
});
|
|
482
471
|
}
|
|
483
472
|
/**
|
|
484
473
|
* Called when an outbound reference is added to a node. This is used to identify all nodes that have been
|
|
@@ -495,27 +484,16 @@ export class GarbageCollector {
|
|
|
495
484
|
const outboundRoutes = (_a = this.newReferencesSinceLastRun.get(fromNodePath)) !== null && _a !== void 0 ? _a : [];
|
|
496
485
|
outboundRoutes.push(toNodePath);
|
|
497
486
|
this.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
else if (nodeType === GCNodeType.Blob) {
|
|
509
|
-
eventName = "GC_Tombstone_Blob_Revived";
|
|
510
|
-
}
|
|
511
|
-
sendGCUnexpectedUsageEvent(this.mc, {
|
|
512
|
-
eventName,
|
|
513
|
-
category: "generic",
|
|
514
|
-
url: toNodePath,
|
|
515
|
-
nodeType,
|
|
516
|
-
gcTombstoneEnforcementAllowed: this.runtime.gcTombstoneEnforcementAllowed,
|
|
517
|
-
}, undefined /* packagePath */);
|
|
518
|
-
}
|
|
487
|
+
this.telemetryTracker.nodeUsed({
|
|
488
|
+
nodeId: toNodePath,
|
|
489
|
+
usageType: "Revived",
|
|
490
|
+
currentReferenceTimestampMs: this.runtime.getCurrentReferenceTimestampMs(),
|
|
491
|
+
packagePath: undefined,
|
|
492
|
+
completedGCRuns: this.completedRuns,
|
|
493
|
+
isTombstoned: this.tombstones.includes(toNodePath),
|
|
494
|
+
lastSummaryTime: this.getLastSummaryTimestampMs(),
|
|
495
|
+
fromId: fromNodePath,
|
|
496
|
+
});
|
|
519
497
|
}
|
|
520
498
|
/**
|
|
521
499
|
* Returns whether a node with the given path has been deleted or not. This can be used by the runtime to identify
|
|
@@ -637,17 +615,11 @@ export class GarbageCollector {
|
|
|
637
615
|
if (previousGCData === undefined) {
|
|
638
616
|
return undefined;
|
|
639
617
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
eventName: "gcUnknownOutboundReferences",
|
|
646
|
-
gcNodeId: missingExplicitReference[0],
|
|
647
|
-
gcRoutes: JSON.stringify(missingExplicitReference[1]),
|
|
648
|
-
});
|
|
649
|
-
});
|
|
650
|
-
}
|
|
618
|
+
/**
|
|
619
|
+
* If there are references that were not explicitly notified to GC, log an error because this should never happen.
|
|
620
|
+
* If it does, this may result in the unreferenced timestamps of these nodes not updated when they were referenced.
|
|
621
|
+
*/
|
|
622
|
+
this.telemetryTracker.logIfMissingExplicitReferences(currentGCData, previousGCData, this.newReferencesSinceLastRun, logger);
|
|
651
623
|
// No references were added since the last run so we don't have to update reference states of any unreferenced
|
|
652
624
|
// nodes. There is no in between state at this point.
|
|
653
625
|
if (this.newReferencesSinceLastRun.size === 0) {
|
|
@@ -693,52 +665,6 @@ export class GarbageCollector {
|
|
|
693
665
|
]);
|
|
694
666
|
return gcResult.referencedNodeIds;
|
|
695
667
|
}
|
|
696
|
-
/**
|
|
697
|
-
* Finds all new references or outbound routes in the current graph that haven't been explicitly notified to GC.
|
|
698
|
-
* The principle is that every new reference or outbound route must be notified to GC via the
|
|
699
|
-
* addedOutboundReference method. It it hasn't, its a bug and we want to identify these scenarios.
|
|
700
|
-
*
|
|
701
|
-
* In more simple terms:
|
|
702
|
-
* Missing Explicit References = Current References - Previous References - Explicitly Added References;
|
|
703
|
-
*
|
|
704
|
-
* @param currentGCData - The GC data (reference graph) from the current GC run.
|
|
705
|
-
* @param previousGCData - The GC data (reference graph) from the previous GC run.
|
|
706
|
-
* @param explicitReferences - New references added explicity between the previous and the current run.
|
|
707
|
-
* @returns - a list of missing explicit references
|
|
708
|
-
*/
|
|
709
|
-
findMissingExplicitReferences(currentGCData, previousGCData, explicitReferences) {
|
|
710
|
-
assert(previousGCData !== undefined, 0x2b7 /* "Can't validate correctness without GC data from last run" */);
|
|
711
|
-
const currentGraph = Object.entries(currentGCData.gcNodes);
|
|
712
|
-
const missingExplicitReferences = [];
|
|
713
|
-
currentGraph.forEach(([nodeId, currentOutboundRoutes]) => {
|
|
714
|
-
var _a, _b;
|
|
715
|
-
const previousRoutes = (_a = previousGCData.gcNodes[nodeId]) !== null && _a !== void 0 ? _a : [];
|
|
716
|
-
const explicitRoutes = (_b = explicitReferences.get(nodeId)) !== null && _b !== void 0 ? _b : [];
|
|
717
|
-
const missingExplicitRoutes = [];
|
|
718
|
-
/**
|
|
719
|
-
* 1. For routes in the current GC data, routes that were not present in previous GC data and did not have
|
|
720
|
-
* explicit references should be added to missing explicit routes list.
|
|
721
|
-
* 2. Only include data store and blob routes since GC only works for these two.
|
|
722
|
-
* Note: Due to a bug with de-duped blobs, only adding data store routes for now.
|
|
723
|
-
* 3. Ignore DDS routes to their parent datastores since those were added implicitly. So, there won't be
|
|
724
|
-
* explicit routes to them.
|
|
725
|
-
*/
|
|
726
|
-
currentOutboundRoutes.forEach((route) => {
|
|
727
|
-
const nodeType = this.runtime.getNodeType(route);
|
|
728
|
-
if ((nodeType === GCNodeType.DataStore || nodeType === GCNodeType.Blob) &&
|
|
729
|
-
!nodeId.startsWith(route) &&
|
|
730
|
-
!previousRoutes.includes(route) &&
|
|
731
|
-
!explicitRoutes.includes(route)) {
|
|
732
|
-
missingExplicitRoutes.push(route);
|
|
733
|
-
}
|
|
734
|
-
});
|
|
735
|
-
if (missingExplicitRoutes.length > 0) {
|
|
736
|
-
missingExplicitReferences.push([nodeId, missingExplicitRoutes]);
|
|
737
|
-
}
|
|
738
|
-
});
|
|
739
|
-
// Ideally missingExplicitReferences should always have a size 0
|
|
740
|
-
return missingExplicitReferences;
|
|
741
|
-
}
|
|
742
668
|
/**
|
|
743
669
|
* Generates the stats of a garbage collection run from the given results of the run.
|
|
744
670
|
* @param gcResult - The result of a GC run.
|
|
@@ -795,128 +721,5 @@ export class GarbageCollector {
|
|
|
795
721
|
}
|
|
796
722
|
return gcStats;
|
|
797
723
|
}
|
|
798
|
-
/**
|
|
799
|
-
* For nodes that are ready to sweep, log an event for now. Until we start running sweep which deletes objects,
|
|
800
|
-
* this will give us a view into how much deleted content a container has.
|
|
801
|
-
*/
|
|
802
|
-
logSweepEvents(logger, currentReferenceTimestampMs) {
|
|
803
|
-
if (this.mc.config.getBoolean(disableSweepLogKey) === true ||
|
|
804
|
-
this.configs.sweepTimeoutMs === undefined) {
|
|
805
|
-
return;
|
|
806
|
-
}
|
|
807
|
-
this.unreferencedNodesState.forEach((nodeStateTracker, nodeId) => {
|
|
808
|
-
if (nodeStateTracker.state !== UnreferencedState.SweepReady) {
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
811
|
-
const nodeType = this.runtime.getNodeType(nodeId);
|
|
812
|
-
if (nodeType !== GCNodeType.DataStore && nodeType !== GCNodeType.Blob) {
|
|
813
|
-
return;
|
|
814
|
-
}
|
|
815
|
-
// Log deleted event for each node only once to reduce noise in telemetry.
|
|
816
|
-
const uniqueEventId = `Deleted-${nodeId}`;
|
|
817
|
-
if (this.loggedUnreferencedEvents.has(uniqueEventId)) {
|
|
818
|
-
return;
|
|
819
|
-
}
|
|
820
|
-
this.loggedUnreferencedEvents.add(uniqueEventId);
|
|
821
|
-
logger.sendTelemetryEvent({
|
|
822
|
-
eventName: "GCObjectDeleted",
|
|
823
|
-
id: nodeId,
|
|
824
|
-
type: nodeType,
|
|
825
|
-
age: currentReferenceTimestampMs - nodeStateTracker.unreferencedTimestampMs,
|
|
826
|
-
timeout: this.configs.sweepTimeoutMs,
|
|
827
|
-
completedGCRuns: this.completedRuns,
|
|
828
|
-
lastSummaryTime: this.getLastSummaryTimestampMs(),
|
|
829
|
-
});
|
|
830
|
-
});
|
|
831
|
-
}
|
|
832
|
-
/**
|
|
833
|
-
* Called when an inactive node is used after. Queue up an event that will be logged next time GC runs.
|
|
834
|
-
*/
|
|
835
|
-
inactiveNodeUsed(usageType, nodeId, nodeStateTracker, fromNodeId, packagePath, currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs(), requestHeaders) {
|
|
836
|
-
// If there is no reference timestamp to work with, no ops have been processed after creation. If so, skip
|
|
837
|
-
// logging as nothing interesting would have happened worth logging.
|
|
838
|
-
// If the node is active, skip logging.
|
|
839
|
-
if (currentReferenceTimestampMs === undefined ||
|
|
840
|
-
nodeStateTracker.state === UnreferencedState.Active) {
|
|
841
|
-
return;
|
|
842
|
-
}
|
|
843
|
-
// We only care about data stores and attachment blobs for this telemetry since GC only marks these objects
|
|
844
|
-
// as unreferenced. Also, if an inactive DDS is used, the corresponding data store store will also be used.
|
|
845
|
-
const nodeType = this.runtime.getNodeType(nodeId);
|
|
846
|
-
if (nodeType !== GCNodeType.DataStore && nodeType !== GCNodeType.Blob) {
|
|
847
|
-
return;
|
|
848
|
-
}
|
|
849
|
-
const state = nodeStateTracker.state;
|
|
850
|
-
const uniqueEventId = `${state}-${nodeId}-${usageType}`;
|
|
851
|
-
if (this.loggedUnreferencedEvents.has(uniqueEventId)) {
|
|
852
|
-
return;
|
|
853
|
-
}
|
|
854
|
-
this.loggedUnreferencedEvents.add(uniqueEventId);
|
|
855
|
-
const propsToLog = Object.assign(Object.assign({ id: nodeId, type: nodeType, unrefTime: nodeStateTracker.unreferencedTimestampMs, age: currentReferenceTimestampMs - nodeStateTracker.unreferencedTimestampMs, timeout: nodeStateTracker.state === UnreferencedState.Inactive
|
|
856
|
-
? this.configs.inactiveTimeoutMs
|
|
857
|
-
: this.configs.sweepTimeoutMs, completedGCRuns: this.completedRuns, lastSummaryTime: this.getLastSummaryTimestampMs() }, this.createContainerMetadata), { viaHandle: requestHeaders === null || requestHeaders === void 0 ? void 0 : requestHeaders[RuntimeHeaders.viaHandle], fromId: fromNodeId });
|
|
858
|
-
// For summarizer client, queue the event so it is logged the next time GC runs if the event is still valid.
|
|
859
|
-
// For non-summarizer client, log the event now since GC won't run on it. This may result in false positives
|
|
860
|
-
// but it's a good signal nonetheless and we can consume it with a grain of salt.
|
|
861
|
-
// Inactive errors are usages of Objects that are unreferenced for at least a period of 7 days.
|
|
862
|
-
// SweepReady errors are usages of Objects that will be deleted by GC Sweep!
|
|
863
|
-
if (this.isSummarizerClient) {
|
|
864
|
-
this.pendingEventsQueue.push(Object.assign(Object.assign({}, propsToLog), { usageType, state }));
|
|
865
|
-
}
|
|
866
|
-
else {
|
|
867
|
-
// For non-summarizer clients, only log "Loaded" type events since these objects may not be loaded in the
|
|
868
|
-
// summarizer clients if they are based off of user actions (such as scrolling to content for these objects)
|
|
869
|
-
// Events generated:
|
|
870
|
-
// InactiveObject_Loaded, SweepReadyObject_Loaded
|
|
871
|
-
if (usageType === "Loaded") {
|
|
872
|
-
const event = Object.assign(Object.assign({}, propsToLog), { eventName: `${state}Object_${usageType}`, pkg: packagePathToTelemetryProperty(packagePath), stack: generateStack() });
|
|
873
|
-
// Do not log the inactive object x events as error events as they are not the best signal for
|
|
874
|
-
// detecting something wrong with GC either from the partner or from the runtime itself.
|
|
875
|
-
if (state === UnreferencedState.Inactive) {
|
|
876
|
-
this.mc.logger.sendTelemetryEvent(event);
|
|
877
|
-
}
|
|
878
|
-
else {
|
|
879
|
-
this.mc.logger.sendErrorEvent(event);
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
async logUnreferencedEvents(logger) {
|
|
885
|
-
// Events sent come only from the summarizer client. In between summaries, events are pushed to a queue and at
|
|
886
|
-
// summary time they are then logged.
|
|
887
|
-
// Events generated:
|
|
888
|
-
// InactiveObject_Loaded, InactiveObject_Changed, InactiveObject_Revived
|
|
889
|
-
// SweepReadyObject_Loaded, SweepReadyObject_Changed, SweepReadyObject_Revived
|
|
890
|
-
for (const eventProps of this.pendingEventsQueue) {
|
|
891
|
-
const { usageType, state } = eventProps, propsToLog = __rest(eventProps, ["usageType", "state"]);
|
|
892
|
-
/**
|
|
893
|
-
* Revived event is logged only if the node is active. If the node is not active, the reference to it was
|
|
894
|
-
* from another unreferenced node and this scenario is not interesting to log.
|
|
895
|
-
* Loaded and Changed events are logged only if the node is not active. If the node is active, it was
|
|
896
|
-
* revived and a Revived event will be logged for it.
|
|
897
|
-
*/
|
|
898
|
-
const nodeStateTracker = this.unreferencedNodesState.get(eventProps.id);
|
|
899
|
-
const active = nodeStateTracker === undefined ||
|
|
900
|
-
nodeStateTracker.state === UnreferencedState.Active;
|
|
901
|
-
if ((usageType === "Revived") === active) {
|
|
902
|
-
const pkg = await this.getNodePackagePath(eventProps.id);
|
|
903
|
-
const fromPkg = eventProps.fromId
|
|
904
|
-
? await this.getNodePackagePath(eventProps.fromId)
|
|
905
|
-
: undefined;
|
|
906
|
-
const event = Object.assign(Object.assign({}, propsToLog), { eventName: `${state}Object_${usageType}`, pkg: pkg
|
|
907
|
-
? { value: pkg.join("/"), tag: TelemetryDataTag.CodeArtifact }
|
|
908
|
-
: undefined, fromPkg: fromPkg
|
|
909
|
-
? { value: fromPkg.join("/"), tag: TelemetryDataTag.CodeArtifact }
|
|
910
|
-
: undefined });
|
|
911
|
-
if (state === UnreferencedState.Inactive) {
|
|
912
|
-
logger.sendTelemetryEvent(event);
|
|
913
|
-
}
|
|
914
|
-
else {
|
|
915
|
-
logger.sendErrorEvent(event);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
this.pendingEventsQueue = [];
|
|
920
|
-
}
|
|
921
724
|
}
|
|
922
725
|
//# sourceMappingURL=garbageCollection.js.map
|