@fluidframework/container-runtime 2.0.0-internal.7.2.0 → 2.0.0-internal.7.2.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.
Files changed (70) hide show
  1. package/api-report/container-runtime.api.md +0 -1
  2. package/dist/blobManager.d.ts +3 -4
  3. package/dist/blobManager.d.ts.map +1 -1
  4. package/dist/blobManager.js +17 -36
  5. package/dist/blobManager.js.map +1 -1
  6. package/dist/containerRuntime.d.ts +1 -2
  7. package/dist/containerRuntime.d.ts.map +1 -1
  8. package/dist/containerRuntime.js +11 -7
  9. package/dist/containerRuntime.js.map +1 -1
  10. package/dist/dataStoreContext.d.ts +1 -0
  11. package/dist/dataStoreContext.d.ts.map +1 -1
  12. package/dist/dataStoreContext.js +38 -29
  13. package/dist/dataStoreContext.js.map +1 -1
  14. package/dist/dataStores.d.ts +0 -14
  15. package/dist/dataStores.d.ts.map +1 -1
  16. package/dist/dataStores.js +0 -43
  17. package/dist/dataStores.js.map +1 -1
  18. package/dist/gc/garbageCollection.d.ts +6 -3
  19. package/dist/gc/garbageCollection.d.ts.map +1 -1
  20. package/dist/gc/garbageCollection.js +27 -17
  21. package/dist/gc/garbageCollection.js.map +1 -1
  22. package/dist/gc/gcDefinitions.d.ts +7 -3
  23. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  24. package/dist/gc/gcDefinitions.js.map +1 -1
  25. package/dist/gc/gcTelemetry.d.ts +11 -4
  26. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  27. package/dist/gc/gcTelemetry.js +72 -39
  28. package/dist/gc/gcTelemetry.js.map +1 -1
  29. package/dist/packageVersion.d.ts +1 -1
  30. package/dist/packageVersion.js +1 -1
  31. package/dist/packageVersion.js.map +1 -1
  32. package/lib/blobManager.d.ts +3 -4
  33. package/lib/blobManager.d.ts.map +1 -1
  34. package/lib/blobManager.js +18 -37
  35. package/lib/blobManager.js.map +1 -1
  36. package/lib/containerRuntime.d.ts +1 -2
  37. package/lib/containerRuntime.d.ts.map +1 -1
  38. package/lib/containerRuntime.js +11 -7
  39. package/lib/containerRuntime.js.map +1 -1
  40. package/lib/dataStoreContext.d.ts +1 -0
  41. package/lib/dataStoreContext.d.ts.map +1 -1
  42. package/lib/dataStoreContext.js +38 -29
  43. package/lib/dataStoreContext.js.map +1 -1
  44. package/lib/dataStores.d.ts +0 -14
  45. package/lib/dataStores.d.ts.map +1 -1
  46. package/lib/dataStores.js +1 -44
  47. package/lib/dataStores.js.map +1 -1
  48. package/lib/gc/garbageCollection.d.ts +6 -3
  49. package/lib/gc/garbageCollection.d.ts.map +1 -1
  50. package/lib/gc/garbageCollection.js +28 -18
  51. package/lib/gc/garbageCollection.js.map +1 -1
  52. package/lib/gc/gcDefinitions.d.ts +7 -3
  53. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  54. package/lib/gc/gcDefinitions.js.map +1 -1
  55. package/lib/gc/gcTelemetry.d.ts +11 -4
  56. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  57. package/lib/gc/gcTelemetry.js +72 -39
  58. package/lib/gc/gcTelemetry.js.map +1 -1
  59. package/lib/packageVersion.d.ts +1 -1
  60. package/lib/packageVersion.js +1 -1
  61. package/lib/packageVersion.js.map +1 -1
  62. package/package.json +15 -15
  63. package/src/blobManager.ts +18 -46
  64. package/src/containerRuntime.ts +20 -10
  65. package/src/dataStoreContext.ts +15 -2
  66. package/src/dataStores.ts +1 -67
  67. package/src/gc/garbageCollection.ts +39 -25
  68. package/src/gc/gcDefinitions.ts +8 -3
  69. package/src/gc/gcTelemetry.ts +102 -54
  70. package/src/packageVersion.ts +1 -1
package/src/dataStores.ts CHANGED
@@ -50,12 +50,7 @@ import { buildSnapshotTree } from "@fluidframework/driver-utils";
50
50
  import { assert, Lazy } from "@fluidframework/core-utils";
51
51
  import { v4 as uuid } from "uuid";
52
52
  import { DataStoreContexts } from "./dataStoreContexts";
53
- import {
54
- ContainerRuntime,
55
- defaultRuntimeHeaderData,
56
- RuntimeHeaderData,
57
- TombstoneResponseHeaderKey,
58
- } from "./containerRuntime";
53
+ import { ContainerRuntime, defaultRuntimeHeaderData, RuntimeHeaderData } from "./containerRuntime";
59
54
  import {
60
55
  FluidDataStoreContext,
61
56
  RemoteFluidDataStoreContext,
@@ -442,9 +437,6 @@ export class DataStores implements IDisposable {
442
437
  const request: IRequest = { url: id };
443
438
  throw responseToException(create404Response(request), request);
444
439
  }
445
-
446
- this.validateNotTombstoned(context, requestHeaderData);
447
-
448
440
  return context;
449
441
  }
450
442
 
@@ -464,8 +456,6 @@ export class DataStores implements IDisposable {
464
456
  if (context === undefined) {
465
457
  return undefined;
466
458
  }
467
- // Check if the data store is tombstoned. If so, we want to log a telemetry event.
468
- this.checkIfTombstoned(context, requestHeaderData);
469
459
  return context;
470
460
  }
471
461
 
@@ -516,62 +506,6 @@ export class DataStores implements IDisposable {
516
506
  }
517
507
  }
518
508
 
519
- /**
520
- * Checks if the data store has not been marked as tombstone by GC or not.
521
- * @param context - the data store context in question
522
- * @param requestHeaderData - the request header information to log if the validation detects the data store has been tombstoned
523
- * @returns true if the data store is tombstoned. Otherwise, returns false.
524
- */
525
- private checkIfTombstoned(
526
- context: FluidDataStoreContext,
527
- requestHeaderData: RuntimeHeaderData,
528
- ) {
529
- if (!context.tombstoned) {
530
- return false;
531
- }
532
- const logErrorEvent =
533
- this.runtime.gcThrowOnTombstoneLoad && !requestHeaderData.allowTombstone;
534
- sendGCUnexpectedUsageEvent(
535
- this.mc,
536
- {
537
- eventName: "GC_Tombstone_DataStore_Requested",
538
- category: logErrorEvent ? "error" : "generic",
539
- isSummarizerClient: this.runtime.clientDetails.type === summarizerClientType,
540
- id: context.id,
541
- headers: JSON.stringify(requestHeaderData),
542
- gcTombstoneEnforcementAllowed: this.runtime.gcTombstoneEnforcementAllowed,
543
- },
544
- context.isLoaded ? context.packagePath : undefined,
545
- );
546
- return true;
547
- }
548
-
549
- /**
550
- * Validates that the data store context requested has not been marked as tombstone by GC.
551
- * @param context - the data store context in question
552
- * @param request - the request information to log if the validation detects the data store has been tombstoned
553
- * @param requestHeaderData - the request header information to log if the validation detects the data store has been tombstoned
554
- */
555
- private validateNotTombstoned(
556
- context: FluidDataStoreContext,
557
- requestHeaderData: RuntimeHeaderData,
558
- ) {
559
- if (this.checkIfTombstoned(context, requestHeaderData)) {
560
- // The requested data store is removed by gc. Create a 404 gc response exception.
561
- const request: IRequest = { url: context.id };
562
- const error = responseToException(
563
- createResponseError(404, "DataStore was deleted", request, {
564
- [TombstoneResponseHeaderKey]: true,
565
- }),
566
- request,
567
- );
568
- // Throw an error if configured via options and via request headers.
569
- if (this.runtime.gcThrowOnTombstoneLoad && !requestHeaderData.allowTombstone) {
570
- throw error;
571
- }
572
- }
573
- }
574
-
575
509
  public processSignal(fluidDataStoreId: string, message: IInboundSignalMessage, local: boolean) {
576
510
  this.validateNotDeleted(fluidDataStoreId);
577
511
  const context = this.contexts.get(fluidDataStoreId);
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { LazyPromise, Timer } from "@fluidframework/core-utils";
7
- import { IRequest, IRequestHeader } from "@fluidframework/core-interfaces";
7
+ import { IRequest } from "@fluidframework/core-interfaces";
8
8
  import {
9
9
  gcTreeKey,
10
10
  IGarbageCollectionData,
@@ -23,9 +23,9 @@ import {
23
23
  } from "@fluidframework/telemetry-utils";
24
24
 
25
25
  import {
26
- AllowInactiveRequestHeaderKey,
27
26
  InactiveResponseHeaderKey,
28
- RuntimeHeaders,
27
+ RuntimeHeaderData,
28
+ TombstoneResponseHeaderKey,
29
29
  } from "../containerRuntime";
30
30
  import { ClientSessionExpiredError } from "../error";
31
31
  import { IRefreshSummaryResult } from "../summary";
@@ -862,11 +862,13 @@ export class GarbageCollector implements IGarbageCollector {
862
862
  }
863
863
 
864
864
  /**
865
- * Called when a node with the given id is updated. If the node is inactive, log an error.
865
+ * Called when a node with the given id is updated. If the node is inactive or tombstoned, this will log an error
866
+ * or throw an error if failing on incorrect usage is configured.
866
867
  * @param nodePath - The path of the node that changed.
867
868
  * @param reason - Whether the node was loaded or changed.
868
869
  * @param timestampMs - The timestamp when the node changed.
869
870
  * @param packagePath - The package path of the node. This may not be available if the node hasn't been loaded yet.
871
+ * @param request - The original request for loads to preserve it in telemetry.
870
872
  * @param requestHeaders - If the node was loaded via request path, the headers in the request.
871
873
  */
872
874
  public nodeUpdated(
@@ -874,12 +876,15 @@ export class GarbageCollector implements IGarbageCollector {
874
876
  reason: "Loaded" | "Changed",
875
877
  timestampMs?: number,
876
878
  packagePath?: readonly string[],
877
- requestHeaders?: IRequestHeader,
879
+ request?: IRequest,
880
+ headerData?: RuntimeHeaderData,
878
881
  ) {
879
882
  if (!this.configs.shouldRunGC) {
880
883
  return;
881
884
  }
882
885
 
886
+ const isTombstoned = this.tombstones.includes(nodePath);
887
+
883
888
  // This will log if appropriate
884
889
  this.telemetryTracker.nodeUsed({
885
890
  id: nodePath,
@@ -888,35 +893,44 @@ export class GarbageCollector implements IGarbageCollector {
888
893
  timestampMs ?? this.runtime.getCurrentReferenceTimestampMs(),
889
894
  packagePath,
890
895
  completedGCRuns: this.completedRuns,
891
- isTombstoned: this.tombstones.includes(nodePath),
896
+ isTombstoned,
892
897
  lastSummaryTime: this.getLastSummaryTimestampMs(),
893
- viaHandle: requestHeaders?.[RuntimeHeaders.viaHandle],
898
+ headers: headerData,
894
899
  });
895
900
 
901
+ const nodeType = this.runtime.getNodeType(nodePath);
902
+
896
903
  // Unless this is a Loaded event for a Blob or DataStore, we're done after telemetry tracking
897
- if (
898
- reason !== "Loaded" ||
899
- ![GCNodeType.Blob, GCNodeType.DataStore].includes(this.runtime.getNodeType(nodePath))
900
- ) {
904
+ if (reason !== "Loaded" || ![GCNodeType.Blob, GCNodeType.DataStore].includes(nodeType)) {
901
905
  return;
902
906
  }
903
907
 
904
- // We may throw when loading an Inactive object, depending on these preconditions
905
- const shouldThrowOnInactiveLoad =
906
- !this.isSummarizerClient &&
907
- this.configs.throwOnInactiveLoad === true &&
908
- requestHeaders?.[AllowInactiveRequestHeaderKey] !== true;
909
- const state = this.unreferencedNodesState.get(nodePath)?.state;
910
-
911
- if (shouldThrowOnInactiveLoad && state === "Inactive") {
912
- const request: IRequest = { url: nodePath };
913
- const error = responseToException(
914
- createResponseError(404, "Object is inactive", request, {
915
- [InactiveResponseHeaderKey]: true,
908
+ const errorRequest: IRequest = request ?? { url: nodePath };
909
+ // If the object is tombstoned and tombstone enforcement is configured, throw an error.
910
+ if (isTombstoned && this.throwOnTombstoneLoad && headerData?.allowTombstone !== true) {
911
+ // The requested data store is removed by gc. Create a 404 gc response exception.
912
+ throw responseToException(
913
+ createResponseError(404, `${nodeType} was tombstoned`, errorRequest, {
914
+ [TombstoneResponseHeaderKey]: true,
916
915
  }),
917
- request,
916
+ errorRequest,
918
917
  );
919
- throw error;
918
+ }
919
+
920
+ // If the object is inactive and inactive enforcement is configured, throw an error.
921
+ if (this.unreferencedNodesState.get(nodePath)?.state === "Inactive") {
922
+ const shouldThrowOnInactiveLoad =
923
+ !this.isSummarizerClient &&
924
+ this.configs.throwOnInactiveLoad === true &&
925
+ headerData?.allowInactive !== true;
926
+ if (shouldThrowOnInactiveLoad) {
927
+ throw responseToException(
928
+ createResponseError(404, `${nodeType} is inactive`, errorRequest, {
929
+ [InactiveResponseHeaderKey]: true,
930
+ }),
931
+ errorRequest,
932
+ );
933
+ }
920
934
  }
921
935
  }
922
936
 
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { ICriticalContainerError } from "@fluidframework/container-definitions";
7
- import { IRequestHeader } from "@fluidframework/core-interfaces";
7
+ import { IRequest } from "@fluidframework/core-interfaces";
8
8
  import { ISnapshotTree } from "@fluidframework/protocol-definitions";
9
9
  import {
10
10
  IGarbageCollectionData,
@@ -19,6 +19,7 @@ import {
19
19
  ICreateContainerMetadata,
20
20
  IRefreshSummaryResult,
21
21
  } from "../summary";
22
+ import { RuntimeHeaderData } from "../containerRuntime";
22
23
 
23
24
  /**
24
25
  * @public
@@ -251,13 +252,17 @@ export interface IGarbageCollector {
251
252
  getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;
252
253
  /** Called when the latest summary of the system has been refreshed. */
253
254
  refreshLatestSummary(result: IRefreshSummaryResult): Promise<void>;
254
- /** Called when a node is updated. Used to detect and log when an inactive node is changed or loaded. */
255
+ /**
256
+ * Called when a node with the given path is updated. If the node is inactive or tombstoned, this will log an error
257
+ * or throw an error if failing on incorrect usage is configured.
258
+ */
255
259
  nodeUpdated(
256
260
  nodePath: string,
257
261
  reason: "Loaded" | "Changed",
258
262
  timestampMs?: number,
259
263
  packagePath?: readonly string[],
260
- requestHeaders?: IRequestHeader,
264
+ request?: IRequest,
265
+ headerData?: RuntimeHeaderData,
261
266
  ): void;
262
267
  /** Called when a reference is added to a node. Used to identify nodes that were referenced between summaries. */
263
268
  addedOutboundReference(fromNodePath: string, toNodePath: string): void;
@@ -11,6 +11,7 @@ import {
11
11
  MonitoringContext,
12
12
  tagCodeArtifacts,
13
13
  } from "@fluidframework/telemetry-utils";
14
+ import { RuntimeHeaderData } from "../containerRuntime";
14
15
  import { ICreateContainerMetadata } from "../summary";
15
16
  import {
16
17
  disableSweepLogKey,
@@ -32,7 +33,7 @@ interface ICommonProps {
32
33
  completedGCRuns: number;
33
34
  isTombstoned: boolean;
34
35
  lastSummaryTime?: number;
35
- viaHandle?: boolean;
36
+ headers?: RuntimeHeaderData;
36
37
  }
37
38
 
38
39
  /** The event that is logged when unreferenced node is used after a certain time. */
@@ -80,7 +81,11 @@ export class GCTelemetryTracker {
80
81
  private readonly mc: MonitoringContext,
81
82
  private readonly configs: Pick<
82
83
  IGarbageCollectorConfigs,
83
- "inactiveTimeoutMs" | "sweepTimeoutMs" | "tombstoneEnforcementAllowed"
84
+ | "inactiveTimeoutMs"
85
+ | "sweepTimeoutMs"
86
+ | "tombstoneEnforcementAllowed"
87
+ | "throwOnTombstoneLoad"
88
+ | "throwOnTombstoneUsage"
84
89
  >,
85
90
  private readonly isSummarizerClient: boolean,
86
91
  private readonly createContainerMetadata: ICreateContainerMetadata,
@@ -94,12 +99,12 @@ export class GCTelemetryTracker {
94
99
  ) {}
95
100
 
96
101
  /**
97
- * Returns whether an event should be logged for a node that isn't active anymore. Some scenarios where we won't log:
102
+ * Returns whether an event should be logged for a node that isn't active anymore. This does not apply to
103
+ * tombstoned nodes for which an event is always logged. Some scenarios where we won't log:
98
104
  * 1. When a DDS is changed. The corresponding data store's event will be logged instead.
99
105
  * 2. An event is logged only once per container instance per event per node.
100
106
  */
101
107
  private shouldLogNonActiveEvent(
102
- nodeId: string,
103
108
  nodeType: GCNodeType,
104
109
  usageType: NodeUsageType,
105
110
  nodeStateTracker: UnreferencedStateTracker,
@@ -119,6 +124,8 @@ export class GCTelemetryTracker {
119
124
  return false;
120
125
  }
121
126
 
127
+ // Non-tombstone events are logged once per event per node. A unique id is generated by joining
128
+ // node state (inactive / sweep ready), node's id and usage (loaded / changed / revived).
122
129
  if (this.loggedUnreferencedEvents.has(uniqueEventId)) {
123
130
  return false;
124
131
  }
@@ -126,24 +133,61 @@ export class GCTelemetryTracker {
126
133
  }
127
134
 
128
135
  /**
129
- * Called when a node is used. If the node is not active, log an event indicating object is used when its not active.
136
+ * Called when a node is used. If the node is not active or tombstoned, log telemetry indicating object is used
137
+ * when it should not have been.
130
138
  */
131
139
  public nodeUsed(nodeUsageProps: INodeUsageProps) {
132
140
  // If there is no reference timestamp to work with, no ops have been processed after creation. If so, skip
133
141
  // logging as nothing interesting would have happened worth logging.
134
- // If the node is not unreferenced, skip logging.
135
- const nodeStateTracker = this.getNodeStateTracker(nodeUsageProps.id);
136
- if (!nodeStateTracker || nodeUsageProps.currentReferenceTimestampMs === undefined) {
142
+ if (nodeUsageProps.currentReferenceTimestampMs === undefined) {
137
143
  return;
138
144
  }
139
145
 
140
- // We log these events once per event per node. A unique id is generated by joining node state (inactive / sweep ready),
141
- // node's id and usage (loaded / changed / revived).
142
- const uniqueEventId = `${nodeStateTracker.state}-${nodeUsageProps.id}-${nodeUsageProps.usageType}`;
146
+ const nodeStateTracker = this.getNodeStateTracker(nodeUsageProps.id);
143
147
  const nodeType = this.getNodeType(nodeUsageProps.id);
148
+ const {
149
+ usageType,
150
+ currentReferenceTimestampMs,
151
+ packagePath,
152
+ id: untaggedId,
153
+ fromId: untaggedFromId,
154
+ ...propsToLog
155
+ } = nodeUsageProps;
156
+ const unrefEventProps: Omit<IUnreferencedEventProps, "state" | "usageType"> = {
157
+ type: nodeType,
158
+ unrefTime: nodeStateTracker?.unreferencedTimestampMs ?? -1,
159
+ age:
160
+ nodeStateTracker !== undefined
161
+ ? nodeUsageProps.currentReferenceTimestampMs -
162
+ nodeStateTracker.unreferencedTimestampMs
163
+ : -1,
164
+ timeout:
165
+ nodeStateTracker?.state === UnreferencedState.Inactive
166
+ ? this.configs.inactiveTimeoutMs
167
+ : this.configs.sweepTimeoutMs,
168
+ ...tagCodeArtifacts({ id: untaggedId, fromId: untaggedFromId }),
169
+ ...propsToLog,
170
+ ...this.createContainerMetadata,
171
+ };
172
+
173
+ // If the node that is used is tombstoned, log a tombstone telemetry.
174
+ // Note that this is done before checking if "nodeStateTracker" is undefined below because unreferenced
175
+ // tracking may not have yet been enabled. That happens only after the client transitions to write mode.
176
+ if (nodeUsageProps.isTombstoned) {
177
+ this.logTombstoneUsageTelemetry(nodeUsageProps, unrefEventProps, nodeType, usageType);
178
+ }
179
+
180
+ // After logging tombstone telemetry, if the node's unreferenced state is not tracked, there is nothing
181
+ // else to log.
182
+ if (nodeStateTracker === undefined) {
183
+ return;
184
+ }
185
+
186
+ const state = nodeStateTracker.state;
187
+ const uniqueEventId = `${state}-${nodeUsageProps.id}-${nodeUsageProps.usageType}`;
188
+
144
189
  if (
145
190
  !this.shouldLogNonActiveEvent(
146
- nodeUsageProps.id,
147
191
  nodeType,
148
192
  nodeUsageProps.usageType,
149
193
  nodeStateTracker,
@@ -153,42 +197,9 @@ export class GCTelemetryTracker {
153
197
  return;
154
198
  }
155
199
 
156
- // Add the unique event id so that we don't generate a log for this event again in this session..
200
+ // Add the unique event id so that we don't generate a log for this event again in this session.
157
201
  this.loggedUnreferencedEvents.add(uniqueEventId);
158
202
 
159
- const state = nodeStateTracker.state;
160
- const { usageType, currentReferenceTimestampMs, packagePath, id, fromId, ...propsToLog } =
161
- nodeUsageProps;
162
- const eventProps: Omit<IUnreferencedEventProps, "state" | "usageType"> = {
163
- type: nodeType,
164
- unrefTime: nodeStateTracker.unreferencedTimestampMs,
165
- age:
166
- nodeUsageProps.currentReferenceTimestampMs -
167
- nodeStateTracker.unreferencedTimestampMs,
168
- timeout:
169
- state === UnreferencedState.Inactive
170
- ? this.configs.inactiveTimeoutMs
171
- : this.configs.sweepTimeoutMs,
172
- ...tagCodeArtifacts({ id, fromId }),
173
- ...propsToLog,
174
- ...this.createContainerMetadata,
175
- };
176
-
177
- // This will log the following events:
178
- // GC_Tombstone_DataStore_Revived, GC_Tombstone_SubDataStore_Revived, GC_Tombstone_Blob_Revived
179
- if (nodeUsageProps.usageType === "Revived" && nodeUsageProps.isTombstoned) {
180
- sendGCUnexpectedUsageEvent(
181
- this.mc,
182
- {
183
- eventName: `GC_Tombstone_${nodeType}_Revived`,
184
- category: "generic",
185
- ...tagCodeArtifacts({ url: id }),
186
- gcTombstoneEnforcementAllowed: this.configs.tombstoneEnforcementAllowed,
187
- },
188
- undefined /* packagePath */,
189
- );
190
- }
191
-
192
203
  // For summarizer client, queue the event so it is logged the next time GC runs if the event is still valid.
193
204
  // For non-summarizer client, log the event now since GC won't run on it. This may result in false positives
194
205
  // but it's a good signal nonetheless and we can consume it with a grain of salt.
@@ -196,7 +207,7 @@ export class GCTelemetryTracker {
196
207
  // SweepReady errors are usages of Objects that will be deleted by GC Sweep!
197
208
  if (this.isSummarizerClient) {
198
209
  this.pendingEventsQueue.push({
199
- ...eventProps,
210
+ ...unrefEventProps,
200
211
  usageType: nodeUsageProps.usageType,
201
212
  state,
202
213
  });
@@ -206,16 +217,15 @@ export class GCTelemetryTracker {
206
217
  // Events generated:
207
218
  // InactiveObject_Loaded, SweepReadyObject_Loaded
208
219
  if (nodeUsageProps.usageType === "Loaded") {
209
- const { id: taggedId, fromId: taggedFromId, ...otherProps } = eventProps;
220
+ const { id, fromId, headers, ...detailedProps } = unrefEventProps;
210
221
  const event = {
211
222
  eventName: `${state}Object_${nodeUsageProps.usageType}`,
212
- pkg: tagCodeArtifacts({ pkg: nodeUsageProps.packagePath?.join("/") }).pkg,
223
+ ...tagCodeArtifacts({ pkg: nodeUsageProps.packagePath?.join("/") }),
213
224
  stack: generateStack(),
214
- id: taggedId,
215
- fromId: taggedFromId,
216
- details: JSON.stringify({
217
- ...otherProps,
218
- }),
225
+ id,
226
+ fromId,
227
+ headers: { ...headers },
228
+ details: detailedProps,
219
229
  };
220
230
 
221
231
  // Do not log the inactive object x events as error events as they are not the best signal for
@@ -229,6 +239,44 @@ export class GCTelemetryTracker {
229
239
  }
230
240
  }
231
241
 
242
+ /**
243
+ * Logs telemetry when a tombstoned object is changed, revived or loaded.
244
+ */
245
+ private logTombstoneUsageTelemetry(
246
+ nodeUsageProps: INodeUsageProps,
247
+ unrefEventProps: Omit<IUnreferencedEventProps, "state" | "usageType">,
248
+ nodeType: GCNodeType,
249
+ usageType: NodeUsageType,
250
+ ) {
251
+ // This will log the following events:
252
+ // GC_Tombstone_DataStore_Requested, GC_Tombstone_DataStore_Changed, GC_Tombstone_DataStore_Revived
253
+ // GC_Tombstone_SubDataStore_Requested, GC_Tombstone_SubDataStore_Changed, GC_Tombstone_SubDataStore_Revived
254
+ // GC_Tombstone_Blob_Requested, GC_Tombstone_Blob_Changed, GC_Tombstone_Blob_Revived
255
+ const { id, fromId, headers, ...detailedProps } = unrefEventProps;
256
+ const eventUsageName = usageType === "Loaded" ? "Requested" : usageType;
257
+ const event = {
258
+ eventName: `GC_Tombstone_${nodeType}_${eventUsageName}`,
259
+ pkg: tagCodeArtifacts({ pkg: nodeUsageProps.packagePath?.join("/") }).pkg,
260
+ stack: generateStack(),
261
+ id,
262
+ fromId,
263
+ headers: { ...headers },
264
+ details: detailedProps,
265
+ gcTombstoneEnforcementAllowed: this.configs.tombstoneEnforcementAllowed,
266
+ };
267
+
268
+ if (
269
+ (usageType === "Loaded" &&
270
+ this.configs.throwOnTombstoneLoad &&
271
+ !headers?.allowTombstone) ||
272
+ (usageType === "Changed" && this.configs.throwOnTombstoneUsage)
273
+ ) {
274
+ this.mc.logger.sendErrorEvent(event);
275
+ } else {
276
+ this.mc.logger.sendTelemetryEvent(event);
277
+ }
278
+ }
279
+
232
280
  /**
233
281
  * Log all new references or outbound routes in the current graph that haven't been explicitly notified to GC.
234
282
  * The principle is that every new reference or outbound route must be notified to GC via the
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-runtime";
9
- export const pkgVersion = "2.0.0-internal.7.2.0";
9
+ export const pkgVersion = "2.0.0-internal.7.2.1";