@fluidframework/fluid-telemetry 2.93.0 → 2.100.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @fluidframework/fluid-telemetry
|
|
2
2
|
|
|
3
|
+
## 2.100.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Node 22 is now the minimum supported Node.js version ([#27116](https://github.com/microsoft/FluidFramework/pull/27116)) [e8214d29663](https://github.com/microsoft/FluidFramework/commit/e8214d29663f5ee98d737daed82506a25d8de8d0)
|
|
8
|
+
|
|
9
|
+
All Fluid Framework client packages now require Node.js 22 or later. This aligns with the standing Node upgrade policy as Node 20 reaches end-of-life on April 30, 2026.
|
|
10
|
+
|
|
3
11
|
## 2.93.0
|
|
4
12
|
|
|
5
13
|
Dependency updates only.
|
|
@@ -123,7 +123,7 @@ describe("container telemetry via", () => {
|
|
|
123
123
|
startTelemetry(telemetryConfig);
|
|
124
124
|
const containerError = {
|
|
125
125
|
errorType: "unknown error",
|
|
126
|
-
message: "An unknown error
|
|
126
|
+
message: "An unknown error occurred",
|
|
127
127
|
stack: "example stack error at line 52 of Container.ts",
|
|
128
128
|
};
|
|
129
129
|
mockFluidContainer.dispose(containerError);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerTelemetry.spec.js","sourceRoot":"","sources":["../../src/test/containerTelemetry.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EAAE,mBAAmB,EAAwB,MAAM,oCAAoC,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5B,OAAO,EACN,+BAA+B,GAE/B,MAAM,uBAAuB,CAAC;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MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport type { IFluidContainer, IFluidContainerEvents } from \"@fluidframework/fluid-static\";\nimport { ApplicationInsights, type IEventTelemetry } from \"@microsoft/applicationinsights-web\";\nimport { expect } from \"chai\";\nimport { spy } from \"sinon\";\nimport type Sinon from \"sinon\";\n\nimport {\n\tIFluidContainerSystemEventNames,\n\ttype IContainerTelemetry,\n} from \"../container/index.js\";\nimport { startTelemetry, type TelemetryConfig } from \"../factory/index.js\";\nimport {\n\tAppInsightsTelemetryConsumer,\n\tContainerTelemetryEventNames,\n\ttype ContainerConnectedTelemetry,\n\ttype ContainerDisconnectedTelemetry,\n\ttype ContainerDisposedTelemetry,\n} from \"../index.js\";\n\n/**\n * For these unit tests, we are just interested in the event emitter part of the Fluid container.\n * The rest of the functionality of IFluidContainer is irrelevant.\n */\nclass MockFluidContainer extends TypedEventEmitter<IFluidContainerEvents> {\n\tpublic connect(): void {\n\t\tthis.emit(IFluidContainerSystemEventNames.CONNECTED);\n\t}\n\n\tpublic disconnect(): void {\n\t\tthis.emit(IFluidContainerSystemEventNames.DISCONNECTED);\n\t}\n\n\tpublic dispose(error?: ICriticalContainerError): void {\n\t\tthis.emit(IFluidContainerSystemEventNames.DISPOSED, error);\n\t}\n}\n\ndescribe(\"container telemetry via\", () => {\n\tlet mockFluidContainer: MockFluidContainer;\n\tconst mockContainerId = \"mockContainerId\";\n\tlet appInsightsClient: ApplicationInsights;\n\tlet trackEventSpy: Sinon.SinonSpy;\n\tlet telemetryConfig: TelemetryConfig;\n\n\t// Create the ApplicationInsights instance once for the suite and eagerly initialize it.\n\t// Without loadAppInsights(), the first trackEvent call triggers an expensive fallback\n\t// initialization path (~250ms locally, potentially much worse in CI). Calling\n\t// loadAppInsights() up front avoids that path entirely, reducing first trackEvent to ~1ms.\n\tbefore(function initializeAppInsights() {\n\t\tappInsightsClient = new ApplicationInsights({\n\t\t\tconfig: {\n\t\t\t\tconnectionString:\n\t\t\t\t\t// (this is an example string)\n\t\t\t\t\t\"InstrumentationKey=abcdefgh-ijkl-mnop-qrst-uvwxyz6ffd9c;IngestionEndpoint=https://westus2-2.in.applicationinsights.azure.com/;LiveEndpoint=https://westus2.livediagnostics.monitor.azure.com/\",\n\t\t\t},\n\t\t});\n\t\tappInsightsClient.loadAppInsights();\n\t});\n\n\tbeforeEach(function createSpiesAndConfig() {\n\t\ttrackEventSpy = spy(appInsightsClient, \"trackEvent\");\n\t\tmockFluidContainer = new MockFluidContainer();\n\n\t\ttelemetryConfig = {\n\t\t\tcontainer: mockFluidContainer as unknown as IFluidContainer,\n\t\t\tcontainerId: mockContainerId,\n\t\t\tconsumers: [new AppInsightsTelemetryConsumer(appInsightsClient)],\n\t\t};\n\t});\n\n\tafterEach(function restoreSpy() {\n\t\ttrackEventSpy.restore();\n\t});\n\n\tit(\"Emitting 'connected' container system event produces expected ContainerConnectedTelemetry using Azure App Insights\", () => {\n\t\tstartTelemetry(telemetryConfig);\n\n\t\tmockFluidContainer.connect();\n\n\t\texpect(trackEventSpy.callCount).to.equal(1);\n\n\t\t// Obtain the events from the method that the spy was called with\n\t\tconst actualAppInsightsTelemetry = trackEventSpy.getCall(0).args[0] as IEventTelemetry;\n\t\tconst actualContainerTelemetry =\n\t\t\tactualAppInsightsTelemetry.properties as IContainerTelemetry;\n\n\t\tconst expectedAppInsightsTelemetry: IEventTelemetry = {\n\t\t\tname: ContainerTelemetryEventNames.CONNECTED,\n\t\t\tproperties: {\n\t\t\t\teventName: ContainerTelemetryEventNames.CONNECTED,\n\t\t\t\tcontainerId: mockContainerId,\n\t\t\t\tcontainerInstanceId: actualContainerTelemetry.containerInstanceId,\n\t\t\t} satisfies ContainerConnectedTelemetry,\n\t\t};\n\n\t\texpect(expectedAppInsightsTelemetry).to.deep.equal(actualAppInsightsTelemetry);\n\t\t// We won't know what the container containerInstanceId will be but we can still check that it is defined.\n\t\texpect(actualContainerTelemetry.containerInstanceId)\n\t\t\t.to.be.a(\"string\")\n\t\t\t.with.length.above(0);\n\t});\n\n\tit(\"Emitting 'disconnected' container system event produces expected ContainerDisconnectedTelemetry using Azure App Insights\", () => {\n\t\tstartTelemetry(telemetryConfig);\n\n\t\tmockFluidContainer.disconnect();\n\n\t\texpect(trackEventSpy.callCount).to.equal(1);\n\n\t\t// Obtain the events from the method that the spy was called with\n\t\tconst actualAppInsightsTelemetry = trackEventSpy.getCall(0).args[0] as IEventTelemetry;\n\t\tconst actualContainerTelemetry =\n\t\t\tactualAppInsightsTelemetry.properties as IContainerTelemetry;\n\n\t\tconst expectedAppInsightsTelemetry: IEventTelemetry = {\n\t\t\tname: ContainerTelemetryEventNames.DISCONNECTED,\n\t\t\tproperties: {\n\t\t\t\teventName: ContainerTelemetryEventNames.DISCONNECTED,\n\t\t\t\tcontainerId: mockContainerId,\n\t\t\t\tcontainerInstanceId: actualContainerTelemetry.containerInstanceId,\n\t\t\t} satisfies ContainerDisconnectedTelemetry,\n\t\t};\n\n\t\texpect(expectedAppInsightsTelemetry).to.deep.equal(actualAppInsightsTelemetry);\n\t\t// We won't know what the container containerInstanceId will be but we can still check that it is defined.\n\t\texpect(actualContainerTelemetry.containerInstanceId)\n\t\t\t.to.be.a(\"string\")\n\t\t\t.with.length.above(0);\n\t});\n\n\tit(\"Emitting 'disposed' system event produces expected ContainerDisposedTelemetry using Azure App Insights\", () => {\n\t\tstartTelemetry(telemetryConfig);\n\n\t\tmockFluidContainer.dispose();\n\n\t\texpect(trackEventSpy.callCount).to.equal(1);\n\n\t\t// Obtain the events from the method that the spy was called with\n\t\tconst actualAppInsightsTelemetry = trackEventSpy.getCall(0).args[0] as IEventTelemetry;\n\t\tconst actualContainerTelemetry =\n\t\t\tactualAppInsightsTelemetry.properties as IContainerTelemetry;\n\n\t\tconst expectedAppInsightsTelemetry: IEventTelemetry = {\n\t\t\tname: ContainerTelemetryEventNames.DISPOSED,\n\t\t\tproperties: {\n\t\t\t\teventName: ContainerTelemetryEventNames.DISPOSED,\n\t\t\t\tcontainerId: mockContainerId,\n\t\t\t\tcontainerInstanceId: actualContainerTelemetry.containerInstanceId,\n\t\t\t} satisfies ContainerDisposedTelemetry,\n\t\t};\n\n\t\texpect(expectedAppInsightsTelemetry).to.deep.equal(actualAppInsightsTelemetry);\n\t\t// We won't know what the container containerInstanceId will be but we can still check that it is defined.\n\t\texpect(actualContainerTelemetry.containerInstanceId)\n\t\t\t.to.be.a(\"string\")\n\t\t\t.with.length.above(0);\n\t});\n\n\tit(\"Emitting 'disposed' system event with an error produces expected ContainerDisposedTelemetry using Azure App Insights\", () => {\n\t\tstartTelemetry(telemetryConfig);\n\n\t\tconst containerError: ICriticalContainerError = {\n\t\t\terrorType: \"unknown error\",\n\t\t\tmessage: \"An unknown error occured\",\n\t\t\tstack: \"example stack error at line 52 of Container.ts\",\n\t\t};\n\n\t\tmockFluidContainer.dispose(containerError);\n\n\t\t// Obtain the events from the method that the spy was called with\n\t\tconst actualAppInsightsTelemetry = trackEventSpy.getCall(0).args[0] as IEventTelemetry;\n\t\tconst actualContainerTelemetry =\n\t\t\tactualAppInsightsTelemetry.properties as IContainerTelemetry;\n\n\t\tconst expectedAppInsightsTelemetry: IEventTelemetry = {\n\t\t\tname: ContainerTelemetryEventNames.DISPOSED,\n\t\t\tproperties: {\n\t\t\t\teventName: ContainerTelemetryEventNames.DISPOSED,\n\t\t\t\tcontainerId: mockContainerId,\n\t\t\t\tcontainerInstanceId: actualContainerTelemetry.containerInstanceId,\n\t\t\t\terror: containerError,\n\t\t\t} satisfies ContainerDisposedTelemetry,\n\t\t};\n\n\t\texpect(expectedAppInsightsTelemetry).to.deep.equal(actualAppInsightsTelemetry);\n\t\t// We won't know what the container containerInstanceId will be but we can still check that it is defined.\n\t\texpect(actualContainerTelemetry.containerInstanceId)\n\t\t\t.to.be.a(\"string\")\n\t\t\t.with.length.above(0);\n\t});\n});\n"]}
|
|
1
|
+
{"version":3,"file":"containerTelemetry.spec.js","sourceRoot":"","sources":["../../src/test/containerTelemetry.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EAAE,mBAAmB,EAAwB,MAAM,oCAAoC,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5B,OAAO,EACN,+BAA+B,GAE/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAwB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EACN,4BAA4B,EAC5B,4BAA4B,GAI5B,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,kBAAmB,SAAQ,iBAAwC;IACjE,OAAO;QACb,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;IAEM,UAAU;QAChB,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC;IAEM,OAAO,CAAC,KAA+B;QAC7C,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC5D,CAAC;CACD;AAED,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACxC,IAAI,kBAAsC,CAAC;IAC3C,MAAM,eAAe,GAAG,iBAAiB,CAAC;IAC1C,IAAI,iBAAsC,CAAC;IAC3C,IAAI,aAA6B,CAAC;IAClC,IAAI,eAAgC,CAAC;IAErC,wFAAwF;IACxF,sFAAsF;IACtF,8EAA8E;IAC9E,2FAA2F;IAC3F,MAAM,CAAC,SAAS,qBAAqB;QACp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iC,CAAC;QAE9D,MAAM,4BAA4B,GAAoB;YACrD,IAAI,EAAE,4BAA4B,CAAC,QAAQ;YAC3C,UAAU,EAAE;gBACX,SAAS,EAAE,4BAA4B,CAAC,QAAQ;gBAChD,WAAW,EAAE,eAAe;gBAC5B,mBAAmB,EAAE,wBAAwB,CAAC,mBAAmB;gBACjE,KAAK,EAAE,cAAc;aACgB;SACtC,CAAC;QAEF,MAAM,CAAC,4BAA4B,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC/E,0GAA0G;QAC1G,MAAM,CAAC,wBAAwB,CAAC,mBAAmB,CAAC;aAClD,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;aACjB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport type { IFluidContainer, IFluidContainerEvents } from \"@fluidframework/fluid-static\";\nimport { ApplicationInsights, type IEventTelemetry } from \"@microsoft/applicationinsights-web\";\nimport { expect } from \"chai\";\nimport { spy } from \"sinon\";\nimport type Sinon from \"sinon\";\n\nimport {\n\tIFluidContainerSystemEventNames,\n\ttype IContainerTelemetry,\n} from \"../container/index.js\";\nimport { startTelemetry, type TelemetryConfig } from \"../factory/index.js\";\nimport {\n\tAppInsightsTelemetryConsumer,\n\tContainerTelemetryEventNames,\n\ttype ContainerConnectedTelemetry,\n\ttype ContainerDisconnectedTelemetry,\n\ttype ContainerDisposedTelemetry,\n} from \"../index.js\";\n\n/**\n * For these unit tests, we are just interested in the event emitter part of the Fluid container.\n * The rest of the functionality of IFluidContainer is irrelevant.\n */\nclass MockFluidContainer extends TypedEventEmitter<IFluidContainerEvents> {\n\tpublic connect(): void {\n\t\tthis.emit(IFluidContainerSystemEventNames.CONNECTED);\n\t}\n\n\tpublic disconnect(): void {\n\t\tthis.emit(IFluidContainerSystemEventNames.DISCONNECTED);\n\t}\n\n\tpublic dispose(error?: ICriticalContainerError): void {\n\t\tthis.emit(IFluidContainerSystemEventNames.DISPOSED, error);\n\t}\n}\n\ndescribe(\"container telemetry via\", () => {\n\tlet mockFluidContainer: MockFluidContainer;\n\tconst mockContainerId = \"mockContainerId\";\n\tlet appInsightsClient: ApplicationInsights;\n\tlet trackEventSpy: Sinon.SinonSpy;\n\tlet telemetryConfig: TelemetryConfig;\n\n\t// Create the ApplicationInsights instance once for the suite and eagerly initialize it.\n\t// Without loadAppInsights(), the first trackEvent call triggers an expensive fallback\n\t// initialization path (~250ms locally, potentially much worse in CI). Calling\n\t// loadAppInsights() up front avoids that path entirely, reducing first trackEvent to ~1ms.\n\tbefore(function initializeAppInsights() {\n\t\tappInsightsClient = new ApplicationInsights({\n\t\t\tconfig: {\n\t\t\t\tconnectionString:\n\t\t\t\t\t// (this is an example string)\n\t\t\t\t\t\"InstrumentationKey=abcdefgh-ijkl-mnop-qrst-uvwxyz6ffd9c;IngestionEndpoint=https://westus2-2.in.applicationinsights.azure.com/;LiveEndpoint=https://westus2.livediagnostics.monitor.azure.com/\",\n\t\t\t},\n\t\t});\n\t\tappInsightsClient.loadAppInsights();\n\t});\n\n\tbeforeEach(function createSpiesAndConfig() {\n\t\ttrackEventSpy = spy(appInsightsClient, \"trackEvent\");\n\t\tmockFluidContainer = new MockFluidContainer();\n\n\t\ttelemetryConfig = {\n\t\t\tcontainer: mockFluidContainer as unknown as IFluidContainer,\n\t\t\tcontainerId: mockContainerId,\n\t\t\tconsumers: [new AppInsightsTelemetryConsumer(appInsightsClient)],\n\t\t};\n\t});\n\n\tafterEach(function restoreSpy() {\n\t\ttrackEventSpy.restore();\n\t});\n\n\tit(\"Emitting 'connected' container system event produces expected ContainerConnectedTelemetry using Azure App Insights\", () => {\n\t\tstartTelemetry(telemetryConfig);\n\n\t\tmockFluidContainer.connect();\n\n\t\texpect(trackEventSpy.callCount).to.equal(1);\n\n\t\t// Obtain the events from the method that the spy was called with\n\t\tconst actualAppInsightsTelemetry = trackEventSpy.getCall(0).args[0] as IEventTelemetry;\n\t\tconst actualContainerTelemetry =\n\t\t\tactualAppInsightsTelemetry.properties as IContainerTelemetry;\n\n\t\tconst expectedAppInsightsTelemetry: IEventTelemetry = {\n\t\t\tname: ContainerTelemetryEventNames.CONNECTED,\n\t\t\tproperties: {\n\t\t\t\teventName: ContainerTelemetryEventNames.CONNECTED,\n\t\t\t\tcontainerId: mockContainerId,\n\t\t\t\tcontainerInstanceId: actualContainerTelemetry.containerInstanceId,\n\t\t\t} satisfies ContainerConnectedTelemetry,\n\t\t};\n\n\t\texpect(expectedAppInsightsTelemetry).to.deep.equal(actualAppInsightsTelemetry);\n\t\t// We won't know what the container containerInstanceId will be but we can still check that it is defined.\n\t\texpect(actualContainerTelemetry.containerInstanceId)\n\t\t\t.to.be.a(\"string\")\n\t\t\t.with.length.above(0);\n\t});\n\n\tit(\"Emitting 'disconnected' container system event produces expected ContainerDisconnectedTelemetry using Azure App Insights\", () => {\n\t\tstartTelemetry(telemetryConfig);\n\n\t\tmockFluidContainer.disconnect();\n\n\t\texpect(trackEventSpy.callCount).to.equal(1);\n\n\t\t// Obtain the events from the method that the spy was called with\n\t\tconst actualAppInsightsTelemetry = trackEventSpy.getCall(0).args[0] as IEventTelemetry;\n\t\tconst actualContainerTelemetry =\n\t\t\tactualAppInsightsTelemetry.properties as IContainerTelemetry;\n\n\t\tconst expectedAppInsightsTelemetry: IEventTelemetry = {\n\t\t\tname: ContainerTelemetryEventNames.DISCONNECTED,\n\t\t\tproperties: {\n\t\t\t\teventName: ContainerTelemetryEventNames.DISCONNECTED,\n\t\t\t\tcontainerId: mockContainerId,\n\t\t\t\tcontainerInstanceId: actualContainerTelemetry.containerInstanceId,\n\t\t\t} satisfies ContainerDisconnectedTelemetry,\n\t\t};\n\n\t\texpect(expectedAppInsightsTelemetry).to.deep.equal(actualAppInsightsTelemetry);\n\t\t// We won't know what the container containerInstanceId will be but we can still check that it is defined.\n\t\texpect(actualContainerTelemetry.containerInstanceId)\n\t\t\t.to.be.a(\"string\")\n\t\t\t.with.length.above(0);\n\t});\n\n\tit(\"Emitting 'disposed' system event produces expected ContainerDisposedTelemetry using Azure App Insights\", () => {\n\t\tstartTelemetry(telemetryConfig);\n\n\t\tmockFluidContainer.dispose();\n\n\t\texpect(trackEventSpy.callCount).to.equal(1);\n\n\t\t// Obtain the events from the method that the spy was called with\n\t\tconst actualAppInsightsTelemetry = trackEventSpy.getCall(0).args[0] as IEventTelemetry;\n\t\tconst actualContainerTelemetry =\n\t\t\tactualAppInsightsTelemetry.properties as IContainerTelemetry;\n\n\t\tconst expectedAppInsightsTelemetry: IEventTelemetry = {\n\t\t\tname: ContainerTelemetryEventNames.DISPOSED,\n\t\t\tproperties: {\n\t\t\t\teventName: ContainerTelemetryEventNames.DISPOSED,\n\t\t\t\tcontainerId: mockContainerId,\n\t\t\t\tcontainerInstanceId: actualContainerTelemetry.containerInstanceId,\n\t\t\t} satisfies ContainerDisposedTelemetry,\n\t\t};\n\n\t\texpect(expectedAppInsightsTelemetry).to.deep.equal(actualAppInsightsTelemetry);\n\t\t// We won't know what the container containerInstanceId will be but we can still check that it is defined.\n\t\texpect(actualContainerTelemetry.containerInstanceId)\n\t\t\t.to.be.a(\"string\")\n\t\t\t.with.length.above(0);\n\t});\n\n\tit(\"Emitting 'disposed' system event with an error produces expected ContainerDisposedTelemetry using Azure App Insights\", () => {\n\t\tstartTelemetry(telemetryConfig);\n\n\t\tconst containerError: ICriticalContainerError = {\n\t\t\terrorType: \"unknown error\",\n\t\t\tmessage: \"An unknown error occurred\",\n\t\t\tstack: \"example stack error at line 52 of Container.ts\",\n\t\t};\n\n\t\tmockFluidContainer.dispose(containerError);\n\n\t\t// Obtain the events from the method that the spy was called with\n\t\tconst actualAppInsightsTelemetry = trackEventSpy.getCall(0).args[0] as IEventTelemetry;\n\t\tconst actualContainerTelemetry =\n\t\t\tactualAppInsightsTelemetry.properties as IContainerTelemetry;\n\n\t\tconst expectedAppInsightsTelemetry: IEventTelemetry = {\n\t\t\tname: ContainerTelemetryEventNames.DISPOSED,\n\t\t\tproperties: {\n\t\t\t\teventName: ContainerTelemetryEventNames.DISPOSED,\n\t\t\t\tcontainerId: mockContainerId,\n\t\t\t\tcontainerInstanceId: actualContainerTelemetry.containerInstanceId,\n\t\t\t\terror: containerError,\n\t\t\t} satisfies ContainerDisposedTelemetry,\n\t\t};\n\n\t\texpect(expectedAppInsightsTelemetry).to.deep.equal(actualAppInsightsTelemetry);\n\t\t// We won't know what the container containerInstanceId will be but we can still check that it is defined.\n\t\texpect(actualContainerTelemetry.containerInstanceId)\n\t\t\t.to.be.a(\"string\")\n\t\t\t.with.length.above(0);\n\t});\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/fluid-telemetry",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.100.0",
|
|
4
4
|
"description": "Customer facing Fluid telemetry types and classes for both producing and consuming said telemetry",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -47,22 +47,22 @@
|
|
|
47
47
|
"main": "lib/index.js",
|
|
48
48
|
"types": "lib/index.d.ts",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@fluidframework/container-definitions": "~2.
|
|
51
|
-
"@fluidframework/container-loader": "~2.
|
|
52
|
-
"@fluidframework/fluid-static": "~2.
|
|
50
|
+
"@fluidframework/container-definitions": "~2.100.0",
|
|
51
|
+
"@fluidframework/container-loader": "~2.100.0",
|
|
52
|
+
"@fluidframework/fluid-static": "~2.100.0",
|
|
53
53
|
"@microsoft/applicationinsights-web": "^2.8.11",
|
|
54
54
|
"uuid": "^11.1.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
58
58
|
"@biomejs/biome": "~2.4.5",
|
|
59
|
-
"@fluid-internal/client-utils": "~2.
|
|
60
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
61
|
-
"@fluid-tools/build-cli": "^0.
|
|
62
|
-
"@fluidframework/build-tools": "^0.
|
|
63
|
-
"@fluidframework/test-utils": "~2.
|
|
64
|
-
"@fluidframework/tinylicious-client": "~2.
|
|
65
|
-
"@fluidframework/tree": "~2.
|
|
59
|
+
"@fluid-internal/client-utils": "~2.100.0",
|
|
60
|
+
"@fluid-internal/mocha-test-setup": "~2.100.0",
|
|
61
|
+
"@fluid-tools/build-cli": "^0.65.0",
|
|
62
|
+
"@fluidframework/build-tools": "^0.65.0",
|
|
63
|
+
"@fluidframework/test-utils": "~2.100.0",
|
|
64
|
+
"@fluidframework/tinylicious-client": "~2.100.0",
|
|
65
|
+
"@fluidframework/tree": "~2.100.0",
|
|
66
66
|
"@microsoft/api-extractor": "7.58.1",
|
|
67
67
|
"@types/chai": "^4.0.0",
|
|
68
68
|
"@types/mocha": "^10.0.10",
|
|
@@ -80,6 +80,28 @@
|
|
|
80
80
|
"tslib": "^1.10.0",
|
|
81
81
|
"typescript": "~5.4.5"
|
|
82
82
|
},
|
|
83
|
+
"fluidBuild": {
|
|
84
|
+
"tasks": {
|
|
85
|
+
"test:mocha:cjs:all": [
|
|
86
|
+
"build:test:cjs"
|
|
87
|
+
],
|
|
88
|
+
"test:mocha:cjs:end-to-end": [
|
|
89
|
+
"build:test:cjs"
|
|
90
|
+
],
|
|
91
|
+
"test:mocha:cjs:unit": [
|
|
92
|
+
"build:test:cjs"
|
|
93
|
+
],
|
|
94
|
+
"test:mocha:esm:all": [
|
|
95
|
+
"build:test:esm"
|
|
96
|
+
],
|
|
97
|
+
"test:mocha:esm:end-to-end": [
|
|
98
|
+
"build:test:esm"
|
|
99
|
+
],
|
|
100
|
+
"test:mocha:esm:unit": [
|
|
101
|
+
"build:test:esm"
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
},
|
|
83
105
|
"typeValidation": {
|
|
84
106
|
"disabled": true
|
|
85
107
|
},
|
|
@@ -118,10 +140,12 @@
|
|
|
118
140
|
"test": "start-server-and-test start:tinylicious:test 7070 test:mocha:all",
|
|
119
141
|
"test:mocha": "npm run test:mocha:esm:unit && echo skipping cjs to avoid overhead - npm run test:mocha:cjs:unit",
|
|
120
142
|
"test:mocha:all": "npm run test:mocha:esm:all && echo skipping cjs to avoid overhead - npm run test:mocha:cjs:all",
|
|
143
|
+
"test:mocha:cjs": "npm run test:mocha:cjs:unit && echo note: not running end-to-end tests",
|
|
121
144
|
"test:mocha:cjs:all": "mocha \"dist/test/**/*.spec*.js\"",
|
|
122
145
|
"test:mocha:cjs:end-to-end": "mocha \"dist/test/**/*.spec.realsvc.js\"",
|
|
123
146
|
"test:mocha:cjs:unit": "mocha \"dist/test/**/*.spec.js\"",
|
|
124
147
|
"test:mocha:end-to-end": "npm run test:mocha:esm:end-to-end && echo skipping cjs to avoid overhead - npm run test:mocha:cjs:end-to-end",
|
|
148
|
+
"test:mocha:esm": "npm run test:mocha:esm:unit && echo note: not running end-to-end tests",
|
|
125
149
|
"test:mocha:esm:all": "mocha \"lib/test/**/*.spec*.js\"",
|
|
126
150
|
"test:mocha:esm:end-to-end": "mocha \"lib/test/**/*.spec.realsvc.js\"",
|
|
127
151
|
"test:mocha:esm:unit": "mocha \"lib/test/**/*.spec.js\"",
|