@fluidframework/fluid-telemetry 2.0.0-dev-rc.5.0.0.263932 → 2.0.0-dev-rc.5.0.0.267932

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 (33) hide show
  1. package/dist/app-insights/appInsightsTelemetryConsumer.d.ts.map +1 -1
  2. package/dist/app-insights/appInsightsTelemetryConsumer.js.map +1 -1
  3. package/dist/container/containerTelemetry.d.ts.map +1 -1
  4. package/dist/container/containerTelemetry.js.map +1 -1
  5. package/dist/container/telemetryManager.d.ts.map +1 -1
  6. package/dist/container/telemetryManager.js.map +1 -1
  7. package/dist/container/telemetryProducer.d.ts +1 -1
  8. package/dist/container/telemetryProducer.d.ts.map +1 -1
  9. package/dist/container/telemetryProducer.js +1 -1
  10. package/dist/container/telemetryProducer.js.map +1 -1
  11. package/dist/factory/index.d.ts.map +1 -1
  12. package/dist/factory/index.js.map +1 -1
  13. package/lib/app-insights/appInsightsTelemetryConsumer.d.ts.map +1 -1
  14. package/lib/app-insights/appInsightsTelemetryConsumer.js.map +1 -1
  15. package/lib/container/containerTelemetry.d.ts.map +1 -1
  16. package/lib/container/containerTelemetry.js.map +1 -1
  17. package/lib/container/telemetryManager.d.ts.map +1 -1
  18. package/lib/container/telemetryManager.js.map +1 -1
  19. package/lib/container/telemetryProducer.d.ts +1 -1
  20. package/lib/container/telemetryProducer.d.ts.map +1 -1
  21. package/lib/container/telemetryProducer.js +1 -1
  22. package/lib/container/telemetryProducer.js.map +1 -1
  23. package/lib/factory/index.d.ts.map +1 -1
  24. package/lib/factory/index.js.map +1 -1
  25. package/lib/test/containerTelemetry.spec.js +3 -3
  26. package/lib/test/containerTelemetry.spec.js.map +1 -1
  27. package/lib/tsdoc-metadata.json +1 -1
  28. package/package.json +10 -10
  29. package/src/app-insights/appInsightsTelemetryConsumer.ts +1 -0
  30. package/src/container/containerTelemetry.ts +1 -0
  31. package/src/container/telemetryManager.ts +5 -3
  32. package/src/container/telemetryProducer.ts +6 -4
  33. package/src/factory/index.ts +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"appInsightsTelemetryConsumer.d.ts","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE9E;;;;;GAKG;AACH,qBAAa,4BAA6B,YAAW,kBAAkB;IACnD,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,mBAAmB;IAE1E;;OAEG;IACI,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;CAM5C"}
1
+ {"version":3,"file":"appInsightsTelemetryConsumer.d.ts","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE9E;;;;;GAKG;AACH,qBAAa,4BAA6B,YAAW,kBAAkB;IACnD,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,mBAAmB;IAE1E;;OAEG;IACI,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;CAM5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"appInsightsTelemetryConsumer.js","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;;;;GAKG;AACH,MAAa,4BAA4B;IACxC,YAAoC,iBAAsC;QAAtC,sBAAiB,GAAjB,iBAAiB,CAAqB;IAAG,CAAC;IAE9E;;OAEG;IACI,OAAO,CAAC,KAAsB;QACpC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC;YACjC,IAAI,EAAE,KAAK,CAAC,SAAS;YACrB,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;IACJ,CAAC;CACD;AAZD,oEAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ApplicationInsights } from \"@microsoft/applicationinsights-web\";\nimport type { IFluidTelemetry, ITelemetryConsumer } from \"../common/index.js\";\n\n/**\n * An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights\n * in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.\n *\n * @beta\n */\nexport class AppInsightsTelemetryConsumer implements ITelemetryConsumer {\n\tpublic constructor(private readonly appInsightsClient: ApplicationInsights) {}\n\n\t/**\n\t * Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights\n\t */\n\tpublic consume(event: IFluidTelemetry): void {\n\t\tthis.appInsightsClient.trackEvent({\n\t\t\tname: event.eventName,\n\t\t\tproperties: event,\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"appInsightsTelemetryConsumer.js","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH;;;;;GAKG;AACH,MAAa,4BAA4B;IACxC,YAAoC,iBAAsC;QAAtC,sBAAiB,GAAjB,iBAAiB,CAAqB;IAAG,CAAC;IAE9E;;OAEG;IACI,OAAO,CAAC,KAAsB;QACpC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC;YACjC,IAAI,EAAE,KAAK,CAAC,SAAS;YACrB,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;IACJ,CAAC;CACD;AAZD,oEAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ApplicationInsights } from \"@microsoft/applicationinsights-web\";\n\nimport type { IFluidTelemetry, ITelemetryConsumer } from \"../common/index.js\";\n\n/**\n * An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights\n * in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.\n *\n * @beta\n */\nexport class AppInsightsTelemetryConsumer implements ITelemetryConsumer {\n\tpublic constructor(private readonly appInsightsClient: ApplicationInsights) {}\n\n\t/**\n\t * Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights\n\t */\n\tpublic consume(event: IFluidTelemetry): void {\n\t\tthis.appInsightsClient.trackEvent({\n\t\t\tname: event.eventName,\n\t\t\tproperties: event,\n\t\t});\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"containerTelemetry.d.ts","sourceRoot":"","sources":["../../src/container/containerTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;GAEG;AAEH;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;IACxC;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;CAEM,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GACtC,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,OAAO,4BAA4B,CAAC,CAAC;AAElF;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC3D;;OAEG;IACH,SAAS,EAAE,2BAA2B,CAAC;IACvC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,mBAAmB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACvE;;OAEG;IACH,SAAS,EAAE,oCAAoC,CAAC;CAChD;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,8BAA+B,SAAQ,mBAAmB;IAC1E;;OAEG;IACH,SAAS,EAAE,uCAAuC,CAAC;CACnD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACtE;;OAEG;IACH,SAAS,EAAE,mCAAmC,CAAC;IAC/C;;;OAGG;IACH,KAAK,CAAC,EAAE,uBAAuB,CAAC;CAChC"}
1
+ {"version":3,"file":"containerTelemetry.d.ts","sourceRoot":"","sources":["../../src/container/containerTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAErF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;GAEG;AAEH;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;IACxC;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;CAEM,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GACtC,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,OAAO,4BAA4B,CAAC,CAAC;AAElF;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC3D;;OAEG;IACH,SAAS,EAAE,2BAA2B,CAAC;IACvC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,mBAAmB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACvE;;OAEG;IACH,SAAS,EAAE,oCAAoC,CAAC;CAChD;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,8BAA+B,SAAQ,mBAAmB;IAC1E;;OAEG;IACH,SAAS,EAAE,uCAAuC,CAAC;CACnD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACtE;;OAEG;IACH,SAAS,EAAE,mCAAmC,CAAC;IAC/C;;;OAGG;IACH,KAAK,CAAC,EAAE,uBAAuB,CAAC;CAChC"}
@@ -1 +1 @@
1
- {"version":3,"file":"containerTelemetry.js","sourceRoot":"","sources":["../../src/container/containerTelemetry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;GAEG;AAEH;;;;GAIG;AACU,QAAA,4BAA4B,GAAG;IAC3C;;;;OAIG;IACH,SAAS,EAAE,oCAAoC;IAC/C;;;;OAIG;IACH,YAAY,EAAE,uCAAuC;IACrD;;;;OAIG;IACH,QAAQ,EAAE,mCAAmC;CACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { type IFluidTelemetry } from \"../common/index.js\";\n\n/**\n * This file contains the types for container telemetry that can be produced.\n */\n\n/**\n * This object contains names for Container Telemetry. Unlike the raw {@link @fluidframework/fluid-static#IFluidContainerEvents | IFluidContainer system event names} they contain more information such as the scope\n *\n * @beta\n */\nexport const ContainerTelemetryEventNames = {\n\t/**\n\t * Name for the container telemetry event that is intended to be produced from the IFluidContainer \"connected\" {@link @fluidframework/fluid-static#IFluidContainerEvents | system event}\n\t *\n\t * @see {@link ContainerConnectedTelemetry}\n\t */\n\tCONNECTED: \"fluidframework.container.connected\",\n\t/**\n\t * Name for the container telemetry event that is intended to be produced from the IFluidContainer \"disconnected\" {@link @fluidframework/fluid-static#IFluidContainerEvents | system event}\n\t *\n\t * @see {@link ContainerDisconnectedTelemetry}\n\t */\n\tDISCONNECTED: \"fluidframework.container.disconnected\",\n\t/**\n\t * Name for the container telemetry event that is intended to be produced from the IFluidContainer \"disposed\" {@link @fluidframework/fluid-static#IFluidContainerEvents | system event}\n\t *\n\t * @see {@link ContainerDisposedTelemetry}\n\t */\n\tDISPOSED: \"fluidframework.container.disposed\",\n} as const;\n\n/**\n * The aggregate type for all values within {@link ContainerTelemetryEventNames}\n * @beta\n */\nexport type ContainerTelemetryEventName =\n\t(typeof ContainerTelemetryEventNames)[keyof typeof ContainerTelemetryEventNames];\n\n/**\n * The base interface for all Container telemetry\n * @beta\n */\nexport interface IContainerTelemetry extends IFluidTelemetry {\n\t/**\n\t * {@inheritdoc IFluidTelemetry.eventName}\n\t */\n\teventName: ContainerTelemetryEventName;\n\t/**\n\t * Unique identifier for a container, stable across creation and load.\n\t * I.e. different clients loading the same container (or the same client loading the container two separate times)\n\t * will agree on this value.\n\t *\n\t * @remarks This can be undefined for a container that has not been attached.\n\t */\n\tcontainerId?: string;\n\t/**\n\t * Unique identifier for the container instance that generated the telemetry.\n\t * This is not a stable identifier for the container across clients/time.\n\t * Every load of the container will result in a different value.\n\t *\n\t */\n\tcontainerInstanceId: string;\n}\n\n/**\n * The container \"connected\" telemetry event.\n * It is produced from an internal Fluid container system event {@link @fluidframework/container-definitions#IContainerEvents} which is emitted when the {@link @fluidframework/container-definitions#IContainer} completes connecting to the Fluid service.\n *\n * @see More details about {@link @fluidframework/container-definitions#IContainer.connectionState | the containers connection state}\n * @see More details about {@link @fluidframework/container-definitions#IContainer.connect | the function to connect a container }\n * @see More details about {@link @fluidframework/container-definitions#IContainer.connectionState | the containers connection state}\n *\n * @beta\n */\nexport interface ContainerConnectedTelemetry extends IContainerTelemetry {\n\t/**\n\t * {@inheritDoc IFluidTelemetry.eventName}\n\t */\n\teventName: \"fluidframework.container.connected\";\n}\n\n/**\n * The container \"disconnected\" telemetry event. This telemetry is produced from an internal Fluid container system event\n * {@link @fluidframework/container-definitions#IContainerEvents} which is emitted when the {@link @fluidframework/container-definitions#IContainer}\n * becomes disconnected from the Fluid service.\n *\n * @see More details about{@link @fluidframework/container-definitions#IContainer.connectionState | the containers connection state}\n *\n * @see More details about{@link @fluidframework/container-definitions#IContainer.disconnect | the function to disconnect a container}\n *\n * @beta\n */\nexport interface ContainerDisconnectedTelemetry extends IContainerTelemetry {\n\t/**\n\t * {@inheritDoc IFluidTelemetry.eventName}\n\t */\n\teventName: \"fluidframework.container.disconnected\";\n}\n\n/**\n *\n * The Fluid container \"disposed\" telemetry event. This telemetry is produced from the \"disposed\" Fluid container system event\n * which is emitted when the {@link @fluidframework/fluid-static#IFluidContainer} is closed, which permanently disables it.\n *\n * @see More details about{@link @fluidframework/container-definitions#IContainer.close | the container close event}\n *\n * @beta\n */\nexport interface ContainerDisposedTelemetry extends IContainerTelemetry {\n\t/**\n\t * {@inheritDoc IFluidTelemetry.eventName}\n\t */\n\teventName: \"fluidframework.container.disposed\";\n\t/**\n\t * If the container was closed due to error (as opposed to an explicit call to\n\t * {@link @fluidframework/fluid-static#IFluidContainer.\"dispose\"}), this will contain details about the error that caused it.\n\t */\n\terror?: ICriticalContainerError;\n}\n"]}
1
+ {"version":3,"file":"containerTelemetry.js","sourceRoot":"","sources":["../../src/container/containerTelemetry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH;;GAEG;AAEH;;;;GAIG;AACU,QAAA,4BAA4B,GAAG;IAC3C;;;;OAIG;IACH,SAAS,EAAE,oCAAoC;IAC/C;;;;OAIG;IACH,YAAY,EAAE,uCAAuC;IACrD;;;;OAIG;IACH,QAAQ,EAAE,mCAAmC;CACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\n\nimport { type IFluidTelemetry } from \"../common/index.js\";\n\n/**\n * This file contains the types for container telemetry that can be produced.\n */\n\n/**\n * This object contains names for Container Telemetry. Unlike the raw {@link @fluidframework/fluid-static#IFluidContainerEvents | IFluidContainer system event names} they contain more information such as the scope\n *\n * @beta\n */\nexport const ContainerTelemetryEventNames = {\n\t/**\n\t * Name for the container telemetry event that is intended to be produced from the IFluidContainer \"connected\" {@link @fluidframework/fluid-static#IFluidContainerEvents | system event}\n\t *\n\t * @see {@link ContainerConnectedTelemetry}\n\t */\n\tCONNECTED: \"fluidframework.container.connected\",\n\t/**\n\t * Name for the container telemetry event that is intended to be produced from the IFluidContainer \"disconnected\" {@link @fluidframework/fluid-static#IFluidContainerEvents | system event}\n\t *\n\t * @see {@link ContainerDisconnectedTelemetry}\n\t */\n\tDISCONNECTED: \"fluidframework.container.disconnected\",\n\t/**\n\t * Name for the container telemetry event that is intended to be produced from the IFluidContainer \"disposed\" {@link @fluidframework/fluid-static#IFluidContainerEvents | system event}\n\t *\n\t * @see {@link ContainerDisposedTelemetry}\n\t */\n\tDISPOSED: \"fluidframework.container.disposed\",\n} as const;\n\n/**\n * The aggregate type for all values within {@link ContainerTelemetryEventNames}\n * @beta\n */\nexport type ContainerTelemetryEventName =\n\t(typeof ContainerTelemetryEventNames)[keyof typeof ContainerTelemetryEventNames];\n\n/**\n * The base interface for all Container telemetry\n * @beta\n */\nexport interface IContainerTelemetry extends IFluidTelemetry {\n\t/**\n\t * {@inheritdoc IFluidTelemetry.eventName}\n\t */\n\teventName: ContainerTelemetryEventName;\n\t/**\n\t * Unique identifier for a container, stable across creation and load.\n\t * I.e. different clients loading the same container (or the same client loading the container two separate times)\n\t * will agree on this value.\n\t *\n\t * @remarks This can be undefined for a container that has not been attached.\n\t */\n\tcontainerId?: string;\n\t/**\n\t * Unique identifier for the container instance that generated the telemetry.\n\t * This is not a stable identifier for the container across clients/time.\n\t * Every load of the container will result in a different value.\n\t *\n\t */\n\tcontainerInstanceId: string;\n}\n\n/**\n * The container \"connected\" telemetry event.\n * It is produced from an internal Fluid container system event {@link @fluidframework/container-definitions#IContainerEvents} which is emitted when the {@link @fluidframework/container-definitions#IContainer} completes connecting to the Fluid service.\n *\n * @see More details about {@link @fluidframework/container-definitions#IContainer.connectionState | the containers connection state}\n * @see More details about {@link @fluidframework/container-definitions#IContainer.connect | the function to connect a container }\n * @see More details about {@link @fluidframework/container-definitions#IContainer.connectionState | the containers connection state}\n *\n * @beta\n */\nexport interface ContainerConnectedTelemetry extends IContainerTelemetry {\n\t/**\n\t * {@inheritDoc IFluidTelemetry.eventName}\n\t */\n\teventName: \"fluidframework.container.connected\";\n}\n\n/**\n * The container \"disconnected\" telemetry event. This telemetry is produced from an internal Fluid container system event\n * {@link @fluidframework/container-definitions#IContainerEvents} which is emitted when the {@link @fluidframework/container-definitions#IContainer}\n * becomes disconnected from the Fluid service.\n *\n * @see More details about{@link @fluidframework/container-definitions#IContainer.connectionState | the containers connection state}\n *\n * @see More details about{@link @fluidframework/container-definitions#IContainer.disconnect | the function to disconnect a container}\n *\n * @beta\n */\nexport interface ContainerDisconnectedTelemetry extends IContainerTelemetry {\n\t/**\n\t * {@inheritDoc IFluidTelemetry.eventName}\n\t */\n\teventName: \"fluidframework.container.disconnected\";\n}\n\n/**\n *\n * The Fluid container \"disposed\" telemetry event. This telemetry is produced from the \"disposed\" Fluid container system event\n * which is emitted when the {@link @fluidframework/fluid-static#IFluidContainer} is closed, which permanently disables it.\n *\n * @see More details about{@link @fluidframework/container-definitions#IContainer.close | the container close event}\n *\n * @beta\n */\nexport interface ContainerDisposedTelemetry extends IContainerTelemetry {\n\t/**\n\t * {@inheritDoc IFluidTelemetry.eventName}\n\t */\n\teventName: \"fluidframework.container.disposed\";\n\t/**\n\t * If the container was closed due to error (as opposed to an explicit call to\n\t * {@link @fluidframework/fluid-static#IFluidContainer.\"dispose\"}), this will contain details about the error that caused it.\n\t */\n\terror?: ICriticalContainerError;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryManager.d.ts","sourceRoot":"","sources":["../../src/container/telemetryManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAM9E;;;;GAIG;AACH,qBAAa,yBAAyB;IAIpC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IALpC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,8BAA8B,CAAS;gBAG7C,SAAS,EAAE,eAAe,EAC1B,iBAAiB,EAAE,+BAA+B,EAClD,kBAAkB,EAAE,kBAAkB,EAAE;IAM1D;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAgB1B;;;OAGG;IACH,OAAO,CAAC,+BAA+B;IAWvC;;;OAGG;IACH,OAAO,CAAC,0BAA0B;CAalC"}
1
+ {"version":3,"file":"telemetryManager.d.ts","sourceRoot":"","sources":["../../src/container/telemetryManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAO7D,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAE9E;;;;GAIG;AACH,qBAAa,yBAAyB;IAIpC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IALpC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,8BAA8B,CAAS;gBAG7C,SAAS,EAAE,eAAe,EAC1B,iBAAiB,EAAE,+BAA+B,EAClD,kBAAkB,EAAE,kBAAkB,EAAE;IAM1D;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAgB1B;;;OAGG;IACH,OAAO,CAAC,+BAA+B;IAWvC;;;OAGG;IACH,OAAO,CAAC,0BAA0B;CAalC"}
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryManager.js","sourceRoot":"","sources":["../../src/container/telemetryManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,uEAAmE;AAInE,yEAGoC;AAEpC;;;;GAIG;AACH,MAAa,yBAAyB;IAGrC,YACkB,SAA0B,EAC1B,iBAAkD,EAClD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sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAEnE,IAAI,SAAS,KAAK,SAAS,EAAE;YAC5B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,kBAAkB,EAAE;gBAC/C,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;aAC5B;SACD;IACF,CAAC;;AA9DF,8DA+DC;AA9DwB,wDAA8B,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\nimport { ConnectionState } from \"@fluidframework/container-loader\";\nimport { type ITelemetryConsumer } from \"../common/index.js\";\nimport { type IContainerTelemetry } from \"./containerTelemetry.js\";\nimport type { ContainerEventTelemetryProducer } from \"./telemetryProducer.js\";\nimport {\n\ttype IFluidContainerSystemEventName,\n\tIFluidContainerSystemEventNames,\n} from \"./containerSystemEvents.js\";\n\n/**\n * This class manages container telemetry intended for customers to consume by wiring together the provided container system events, telemetry producers and consumers together.\n * It manages subcribing to the proper raw container system events, sending them to the {@link ContainerEventTelemetryProducer}\n * to be transformed into {@link IContainerTelemetry} and finally sending them to the provided {@link ITelemetryConsumer}\n */\nexport class ContainerTelemetryManager {\n\tprivate static readonly HEARTBEAT_EMISSION_INTERNAL_MS = 60000;\n\n\tpublic constructor(\n\t\tprivate readonly container: IFluidContainer,\n\t\tprivate readonly telemetryProducer: ContainerEventTelemetryProducer,\n\t\tprivate readonly telemetryConsumers: ITelemetryConsumer[],\n\t) {\n\t\tthis.setupEventHandlers();\n\t\tthis.setupHeartbeatTelemetryEmission();\n\t}\n\n\t/**\n\t * Subscribes to the raw container system events and routes them to telemetry producers.\n\t */\n\tprivate setupEventHandlers(): void {\n\t\tthis.container.on(IFluidContainerSystemEventNames.CONNECTED, () =>\n\t\t\tthis.handleContainerSystemEvent(IFluidContainerSystemEventNames.CONNECTED),\n\t\t);\n\t\tthis.container.on(IFluidContainerSystemEventNames.DISCONNECTED, () =>\n\t\t\tthis.handleContainerSystemEvent(IFluidContainerSystemEventNames.DISCONNECTED),\n\t\t);\n\t\tthis.container.on(\n\t\t\tIFluidContainerSystemEventNames.DISPOSED,\n\t\t\t(error?: ICriticalContainerError) =>\n\t\t\t\tthis.handleContainerSystemEvent(IFluidContainerSystemEventNames.DISPOSED, {\n\t\t\t\t\terror,\n\t\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Sets up the synthetic telemetry event for the container heartbeat telemetry to be emitted on a given time interval\n\t * if and only if the container is in a \"connected\" state. It is used to keep a pulse check on a live container\n\t */\n\tprivate setupHeartbeatTelemetryEmission(): void {\n\t\tsetInterval(() => {\n\t\t\tif (this.container.connectionState === ConnectionState.Connected) {\n\t\t\t\tconst telemetry = this.telemetryProducer.produceHeartbeatTelemetry();\n\t\t\t\tfor (const consumer of this.telemetryConsumers) {\n\t\t\t\t\tconsumer.consume(telemetry);\n\t\t\t\t}\n\t\t\t}\n\t\t}, ContainerTelemetryManager.HEARTBEAT_EMISSION_INTERNAL_MS);\n\t}\n\n\t/**\n\t * Handles the incoming raw container sysytem event, sending it to the {@link ContainerEventTelemetryProducer} to\n\t * produce {@link IContainerTelemetry} and sending it to the {@link ITelemetryConsumer} to be consumed.\n\t */\n\tprivate handleContainerSystemEvent(\n\t\teventName: IFluidContainerSystemEventName,\n\t\tpayload?: unknown,\n\t): void {\n\t\tconst telemetry: IContainerTelemetry | undefined =\n\t\t\tthis.telemetryProducer.produceFromSystemEvent(eventName, payload);\n\n\t\tif (telemetry !== undefined) {\n\t\t\tfor (const consumer of this.telemetryConsumers) {\n\t\t\t\tconsumer.consume(telemetry);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"telemetryManager.js","sourceRoot":"","sources":["../../src/container/telemetryManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uEAAmE;AAKnE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CAAC;IAED;;;OAGG;IACK,0BAA0B,CACjC,SAAyC,EACzC,OAAiB;QAEjB,MAAM,SAAS,GACd,IAAI,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAEnE,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC7B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBAChD,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;IACF,CAAC;;AA9DF,8DA+DC;AA9DwB,wDAA8B,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { ConnectionState } from \"@fluidframework/container-loader\";\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\n\nimport { type ITelemetryConsumer } from \"../common/index.js\";\n\nimport {\n\ttype IFluidContainerSystemEventName,\n\tIFluidContainerSystemEventNames,\n} from \"./containerSystemEvents.js\";\nimport { type IContainerTelemetry } from \"./containerTelemetry.js\";\nimport type { ContainerEventTelemetryProducer } from \"./telemetryProducer.js\";\n\n/**\n * This class manages container telemetry intended for customers to consume by wiring together the provided container system events, telemetry producers and consumers together.\n * It manages subcribing to the proper raw container system events, sending them to the {@link ContainerEventTelemetryProducer}\n * to be transformed into {@link IContainerTelemetry} and finally sending them to the provided {@link ITelemetryConsumer}\n */\nexport class ContainerTelemetryManager {\n\tprivate static readonly HEARTBEAT_EMISSION_INTERNAL_MS = 60000;\n\n\tpublic constructor(\n\t\tprivate readonly container: IFluidContainer,\n\t\tprivate readonly telemetryProducer: ContainerEventTelemetryProducer,\n\t\tprivate readonly telemetryConsumers: ITelemetryConsumer[],\n\t) {\n\t\tthis.setupEventHandlers();\n\t\tthis.setupHeartbeatTelemetryEmission();\n\t}\n\n\t/**\n\t * Subscribes to the raw container system events and routes them to telemetry producers.\n\t */\n\tprivate setupEventHandlers(): void {\n\t\tthis.container.on(IFluidContainerSystemEventNames.CONNECTED, () =>\n\t\t\tthis.handleContainerSystemEvent(IFluidContainerSystemEventNames.CONNECTED),\n\t\t);\n\t\tthis.container.on(IFluidContainerSystemEventNames.DISCONNECTED, () =>\n\t\t\tthis.handleContainerSystemEvent(IFluidContainerSystemEventNames.DISCONNECTED),\n\t\t);\n\t\tthis.container.on(\n\t\t\tIFluidContainerSystemEventNames.DISPOSED,\n\t\t\t(error?: ICriticalContainerError) =>\n\t\t\t\tthis.handleContainerSystemEvent(IFluidContainerSystemEventNames.DISPOSED, {\n\t\t\t\t\terror,\n\t\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Sets up the synthetic telemetry event for the container heartbeat telemetry to be emitted on a given time interval\n\t * if and only if the container is in a \"connected\" state. It is used to keep a pulse check on a live container\n\t */\n\tprivate setupHeartbeatTelemetryEmission(): void {\n\t\tsetInterval(() => {\n\t\t\tif (this.container.connectionState === ConnectionState.Connected) {\n\t\t\t\tconst telemetry = this.telemetryProducer.produceHeartbeatTelemetry();\n\t\t\t\tfor (const consumer of this.telemetryConsumers) {\n\t\t\t\t\tconsumer.consume(telemetry);\n\t\t\t\t}\n\t\t\t}\n\t\t}, ContainerTelemetryManager.HEARTBEAT_EMISSION_INTERNAL_MS);\n\t}\n\n\t/**\n\t * Handles the incoming raw container sysytem event, sending it to the {@link ContainerEventTelemetryProducer} to\n\t * produce {@link IContainerTelemetry} and sending it to the {@link ITelemetryConsumer} to be consumed.\n\t */\n\tprivate handleContainerSystemEvent(\n\t\teventName: IFluidContainerSystemEventName,\n\t\tpayload?: unknown,\n\t): void {\n\t\tconst telemetry: IContainerTelemetry | undefined =\n\t\t\tthis.telemetryProducer.produceFromSystemEvent(eventName, payload);\n\n\t\tif (telemetry !== undefined) {\n\t\t\tfor (const consumer of this.telemetryConsumers) {\n\t\t\t\tconsumer.consume(telemetry);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IFluidTelemetry } from "../index.js";
6
- import { type IContainerTelemetry } from "./containerTelemetry.js";
7
6
  import { type IFluidContainerSystemEventName } from "./containerSystemEvents.js";
7
+ import { type IContainerTelemetry } from "./containerTelemetry.js";
8
8
  /**
9
9
  * This class produces {@link IContainerTelemetry} from raw container system events {@link @fluidframework/fluid-static#IFluidContainerEvents}.
10
10
  * The class contains different helper methods for simplifying and standardizing logic for adding additional information necessary
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryProducer.d.ts","sourceRoot":"","sources":["../../src/container/telemetryProducer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAGN,KAAK,mBAAmB,EAExB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,KAAK,8BAA8B,EAEnC,MAAM,4BAA4B,CAAC;AAEpC;;;;GAIG;AACH,qBAAa,+BAA+B;IAMxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAL/C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAU;gBAEV,WAAW,EAAE,MAAM;IAEhD,sBAAsB,CAC5B,SAAS,EAAE,8BAA8B,EACzC,OAAO,CAAC,EAAE,OAAO,GACf,mBAAmB,GAAG,SAAS;IAoB3B,yBAAyB,QAAO,eAAe,CAMpD;IAEF,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAQ5C;IAEF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAYtC;CACF"}
1
+ {"version":3,"file":"telemetryProducer.d.ts","sourceRoot":"","sources":["../../src/container/telemetryProducer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EACN,KAAK,8BAA8B,EAEnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGN,KAAK,mBAAmB,EAExB,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,qBAAa,+BAA+B;IAMxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAL/C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAU;gBAEV,WAAW,EAAE,MAAM;IAEhD,sBAAsB,CAC5B,SAAS,EAAE,8BAA8B,EACzC,OAAO,CAAC,EAAE,OAAO,GACf,mBAAmB,GAAG,SAAS;IAoB3B,yBAAyB,QAAO,eAAe,CAMpD;IAEF,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAQ5C;IAEF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAYtC;CACF"}
@@ -6,8 +6,8 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ContainerEventTelemetryProducer = void 0;
8
8
  const uuid_1 = require("uuid");
9
- const containerTelemetry_js_1 = require("./containerTelemetry.js");
10
9
  const containerSystemEvents_js_1 = require("./containerSystemEvents.js");
10
+ const containerTelemetry_js_1 = require("./containerTelemetry.js");
11
11
  /**
12
12
  * This class produces {@link IContainerTelemetry} from raw container system events {@link @fluidframework/fluid-static#IFluidContainerEvents}.
13
13
  * The class contains different helper methods for simplifying and standardizing logic for adding additional information necessary
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryProducer.js","sourceRoot":"","sources":["../../src/container/telemetryProducer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+BAAkC;AAElC,mEAKiC;AACjC,yEAGoC;AAEpC;;;;GAIG;AACH,MAAa,+BAA+B;IAM3C,YAAoC,WAAmB;QAAnB,gBAAW,GAAX,WAAW,CAAQ;QALvD;;WAEG;QACc,wBAAmB,GAAG,IAAA,SAAI,GAAE,CAAC;QA2BvC,8BAAyB,GAAG,GAAoB,EAAE;YACxD,OAAO;gBACN,SAAS,EAAE,oCAAoC;gBAC/C,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;aACf,CAAC;QACjC,CAAC,CAAC;QAEe,kCAA6B,GAAG,CAChD,SAAsC,EAChB,EAAE;YACxB,OAAO;gBACN,SAAS;gBACT,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;aACf,CAAC;QACjC,CAAC,CAAC;QAEe,4BAAuB,GAAG,CAAC,OAE3C,EAA8B,EAAE;YAChC,MAAM,SAAS,GAA+B;gBAC7C,SAAS,EAAE,oDAA4B,CAAC,QAAQ;gBAChD,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;aAC7C,CAAC;YACF,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE;gBACjC,SAAS,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;aAChC;YACD,OAAO,SAAS,CAAC;QAClB,CAAC,CAAC;IAvDwD,CAAC;IAEpD,sBAAsB,CAC5B,SAAyC,EACzC,OAAiB;QAEjB,QAAQ,SAAS,EAAE;YAClB,KAAK,0DAA+B,CAAC,SAAS,CAAC,CAAC;gBAC/C,OAAO,IAAI,CAAC,6BAA6B,CAAC,oDAA4B,CAAC,SAAS,CAAC,CAAC;aAClF;YACD,KAAK,0DAA+B,CAAC,YAAY,CAAC,CAAC;gBAClD,OAAO,IAAI,CAAC,6BAA6B,CACxC,oDAA4B,CAAC,YAAY,CACzC,CAAC;aACF;YACD,KAAK,0DAA+B,CAAC,QAAQ,CAAC,CAAC;gBAC9C,MAAM,YAAY,GAAG,OAA8C,CAAC;gBACpE,OAAO,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;aAClD;YACD,OAAO,CAAC,CAAC;gBACR,MAAM;aACN;SACD;IACF,CAAC;CAiCD;AA9DD,0EA8DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { v4 as uuid } from \"uuid\";\nimport type { IFluidTelemetry } from \"../index.js\";\nimport {\n\tContainerTelemetryEventNames,\n\ttype ContainerTelemetryEventName,\n\ttype IContainerTelemetry,\n\ttype ContainerDisposedTelemetry,\n} from \"./containerTelemetry.js\";\nimport {\n\ttype IFluidContainerSystemEventName,\n\tIFluidContainerSystemEventNames,\n} from \"./containerSystemEvents.js\";\n\n/**\n * This class produces {@link IContainerTelemetry} from raw container system events {@link @fluidframework/fluid-static#IFluidContainerEvents}.\n * The class contains different helper methods for simplifying and standardizing logic for adding additional information necessary\n * to produce different {@link IContainerTelemetry}.\n */\nexport class ContainerEventTelemetryProducer {\n\t/**\n\t * Unique identifier for the instance of the container that this class is generating telemetry for.\n\t */\n\tprivate readonly containerInstanceId = uuid();\n\n\tpublic constructor(private readonly containerId: string) {}\n\n\tpublic produceFromSystemEvent(\n\t\teventName: IFluidContainerSystemEventName,\n\t\tpayload?: unknown,\n\t): IContainerTelemetry | undefined {\n\t\tswitch (eventName) {\n\t\t\tcase IFluidContainerSystemEventNames.CONNECTED: {\n\t\t\t\treturn this.produceBaseContainerTelemetry(ContainerTelemetryEventNames.CONNECTED);\n\t\t\t}\n\t\t\tcase IFluidContainerSystemEventNames.DISCONNECTED: {\n\t\t\t\treturn this.produceBaseContainerTelemetry(\n\t\t\t\t\tContainerTelemetryEventNames.DISCONNECTED,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase IFluidContainerSystemEventNames.DISPOSED: {\n\t\t\t\tconst typedPayload = payload as { error?: ICriticalContainerError };\n\t\t\t\treturn this.produceDiposedTelemetry(typedPayload);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic produceHeartbeatTelemetry = (): IFluidTelemetry => {\n\t\treturn {\n\t\t\teventName: \"fluidframework.container.heartbeat\",\n\t\t\tcontainerId: this.containerId,\n\t\t\tcontainerInstanceId: this.containerInstanceId,\n\t\t} as unknown as IFluidTelemetry;\n\t};\n\n\tprivate readonly produceBaseContainerTelemetry = (\n\t\teventName: ContainerTelemetryEventName,\n\t): IContainerTelemetry => {\n\t\treturn {\n\t\t\teventName,\n\t\t\tcontainerId: this.containerId,\n\t\t\tcontainerInstanceId: this.containerInstanceId,\n\t\t} satisfies IContainerTelemetry;\n\t};\n\n\tprivate readonly produceDiposedTelemetry = (payload?: {\n\t\terror?: ICriticalContainerError;\n\t}): ContainerDisposedTelemetry => {\n\t\tconst telemetry: ContainerDisposedTelemetry = {\n\t\t\teventName: ContainerTelemetryEventNames.DISPOSED,\n\t\t\tcontainerId: this.containerId,\n\t\t\tcontainerInstanceId: this.containerInstanceId,\n\t\t};\n\t\tif (payload?.error !== undefined) {\n\t\t\ttelemetry.error = payload.error;\n\t\t}\n\t\treturn telemetry;\n\t};\n}\n"]}
1
+ {"version":3,"file":"telemetryProducer.js","sourceRoot":"","sources":["../../src/container/telemetryProducer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+BAAkC;AAIlC,yEAGoC;AACpC,mEAKiC;AAEjC;;;;GAIG;AACH,MAAa,+BAA+B;IAM3C,YAAoC,WAAmB;QAAnB,gBAAW,GAAX,WAAW,CAAQ;QALvD;;WAEG;QACc,wBAAmB,GAAG,IAAA,SAAI,GAAE,CAAC;QA2BvC,8BAAyB,GAAG,GAAoB,EAAE;YACxD,OAAO;gBACN,SAAS,EAAE,oCAAoC;gBAC/C,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;aACf,CAAC;QACjC,CAAC,CAAC;QAEe,kCAA6B,GAAG,CAChD,SAAsC,EAChB,EAAE;YACxB,OAAO;gBACN,SAAS;gBACT,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;aACf,CAAC;QACjC,CAAC,CAAC;QAEe,4BAAuB,GAAG,CAAC,OAE3C,EAA8B,EAAE;YAChC,MAAM,SAAS,GAA+B;gBAC7C,SAAS,EAAE,oDAA4B,CAAC,QAAQ;gBAChD,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;aAC7C,CAAC;YACF,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;gBAClC,SAAS,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YACjC,CAAC;YACD,OAAO,SAAS,CAAC;QAClB,CAAC,CAAC;IAvDwD,CAAC;IAEpD,sBAAsB,CAC5B,SAAyC,EACzC,OAAiB;QAEjB,QAAQ,SAAS,EAAE,CAAC;YACnB,KAAK,0DAA+B,CAAC,SAAS,CAAC,CAAC,CAAC;gBAChD,OAAO,IAAI,CAAC,6BAA6B,CAAC,oDAA4B,CAAC,SAAS,CAAC,CAAC;YACnF,CAAC;YACD,KAAK,0DAA+B,CAAC,YAAY,CAAC,CAAC,CAAC;gBACnD,OAAO,IAAI,CAAC,6BAA6B,CACxC,oDAA4B,CAAC,YAAY,CACzC,CAAC;YACH,CAAC;YACD,KAAK,0DAA+B,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC/C,MAAM,YAAY,GAAG,OAA8C,CAAC;gBACpE,OAAO,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;YACnD,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACT,MAAM;YACP,CAAC;QACF,CAAC;IACF,CAAC;CAiCD;AA9DD,0EA8DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type { IFluidTelemetry } from \"../index.js\";\n\nimport {\n\ttype IFluidContainerSystemEventName,\n\tIFluidContainerSystemEventNames,\n} from \"./containerSystemEvents.js\";\nimport {\n\tContainerTelemetryEventNames,\n\ttype ContainerTelemetryEventName,\n\ttype IContainerTelemetry,\n\ttype ContainerDisposedTelemetry,\n} from \"./containerTelemetry.js\";\n\n/**\n * This class produces {@link IContainerTelemetry} from raw container system events {@link @fluidframework/fluid-static#IFluidContainerEvents}.\n * The class contains different helper methods for simplifying and standardizing logic for adding additional information necessary\n * to produce different {@link IContainerTelemetry}.\n */\nexport class ContainerEventTelemetryProducer {\n\t/**\n\t * Unique identifier for the instance of the container that this class is generating telemetry for.\n\t */\n\tprivate readonly containerInstanceId = uuid();\n\n\tpublic constructor(private readonly containerId: string) {}\n\n\tpublic produceFromSystemEvent(\n\t\teventName: IFluidContainerSystemEventName,\n\t\tpayload?: unknown,\n\t): IContainerTelemetry | undefined {\n\t\tswitch (eventName) {\n\t\t\tcase IFluidContainerSystemEventNames.CONNECTED: {\n\t\t\t\treturn this.produceBaseContainerTelemetry(ContainerTelemetryEventNames.CONNECTED);\n\t\t\t}\n\t\t\tcase IFluidContainerSystemEventNames.DISCONNECTED: {\n\t\t\t\treturn this.produceBaseContainerTelemetry(\n\t\t\t\t\tContainerTelemetryEventNames.DISCONNECTED,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase IFluidContainerSystemEventNames.DISPOSED: {\n\t\t\t\tconst typedPayload = payload as { error?: ICriticalContainerError };\n\t\t\t\treturn this.produceDiposedTelemetry(typedPayload);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic produceHeartbeatTelemetry = (): IFluidTelemetry => {\n\t\treturn {\n\t\t\teventName: \"fluidframework.container.heartbeat\",\n\t\t\tcontainerId: this.containerId,\n\t\t\tcontainerInstanceId: this.containerInstanceId,\n\t\t} as unknown as IFluidTelemetry;\n\t};\n\n\tprivate readonly produceBaseContainerTelemetry = (\n\t\teventName: ContainerTelemetryEventName,\n\t): IContainerTelemetry => {\n\t\treturn {\n\t\t\teventName,\n\t\t\tcontainerId: this.containerId,\n\t\t\tcontainerInstanceId: this.containerInstanceId,\n\t\t} satisfies IContainerTelemetry;\n\t};\n\n\tprivate readonly produceDiposedTelemetry = (payload?: {\n\t\terror?: ICriticalContainerError;\n\t}): ContainerDisposedTelemetry => {\n\t\tconst telemetry: ContainerDisposedTelemetry = {\n\t\t\teventName: ContainerTelemetryEventNames.DISPOSED,\n\t\t\tcontainerId: this.containerId,\n\t\t\tcontainerInstanceId: this.containerInstanceId,\n\t\t};\n\t\tif (payload?.error !== undefined) {\n\t\t\ttelemetry.error = payload.error;\n\t\t}\n\t\treturn telemetry;\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,SAAS,EAAE,eAAe,CAAC;IAC3B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,EAAE,kBAAkB,EAAE,CAAC;CAChC;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,WAAY,eAAe,KAAG,IAGxD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG7D;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,SAAS,EAAE,eAAe,CAAC;IAC3B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,EAAE,kBAAkB,EAAE,CAAC;CAChC;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,WAAY,eAAe,KAAG,IAGxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,oDAAmG;AA0BnG;;;;;GAKG;AACI,MAAM,cAAc,GAAG,CAAC,MAAuB,EAAQ,EAAE;IAC/D,MAAM,iBAAiB,GAAG,IAAI,0CAA+B,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAClF,IAAI,oCAAyB,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;AACtF,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\nimport { ContainerTelemetryManager, ContainerEventTelemetryProducer } from \"../container/index.js\";\nimport { type ITelemetryConsumer } from \"../common/index.js\";\n\n/**\n * Configuration object for subscribing to {@link @fluidframework/fluid-telemetry#IFluidTelemetry} and consuming said telemetry via one or more {@link ITelemetryConsumer}\n *\n * @beta\n */\nexport interface TelemetryConfig {\n\t/**\n\t * The container whose events should be monitored, transformed into Fluid telemetry, and sent to a {@link ITelemetryConsumer}.\n\t */\n\tcontainer: IFluidContainer;\n\t/**\n\t * Unique identifier for the passed in container, i.e. the return value of a call\n\t * to {@link @fluidframework/fluid-static#IFluidContainer.attach | `IFluidContainer.attach()`} when creating a new\n\t * Fluid container, or the id used to load a pre-existing one.\n\t */\n\tcontainerId: string;\n\t/**\n\t * Conusmers take incoming produced {@link @fluidframework/fluid-telemetry#IFluidTelemetry} and do something of your choice with it.\n\t * This could be sending the telemetry to a cloud platform or just console logging.\n\t */\n\tconsumers: ITelemetryConsumer[];\n}\n\n/**\n * Starts creating {@link @fluidframework/fluid-telemetry#IFluidTelemetry} by transforming raw system events emitted by the specified container\n * into said telemetry and passing it onto to the specified {@link ITelemetryConsumer}\n *\n * @beta\n */\nexport const startTelemetry = (config: TelemetryConfig): void => {\n\tconst telemetryProducer = new ContainerEventTelemetryProducer(config.containerId);\n\tnew ContainerTelemetryManager(config.container, telemetryProducer, config.consumers);\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,oDAAmG;AAyBnG;;;;;GAKG;AACI,MAAM,cAAc,GAAG,CAAC,MAAuB,EAAQ,EAAE;IAC/D,MAAM,iBAAiB,GAAG,IAAI,0CAA+B,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAClF,IAAI,oCAAyB,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;AACtF,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\n\nimport { type ITelemetryConsumer } from \"../common/index.js\";\nimport { ContainerTelemetryManager, ContainerEventTelemetryProducer } from \"../container/index.js\";\n\n/**\n * Configuration object for subscribing to {@link @fluidframework/fluid-telemetry#IFluidTelemetry} and consuming said telemetry via one or more {@link ITelemetryConsumer}\n *\n * @beta\n */\nexport interface TelemetryConfig {\n\t/**\n\t * The container whose events should be monitored, transformed into Fluid telemetry, and sent to a {@link ITelemetryConsumer}.\n\t */\n\tcontainer: IFluidContainer;\n\t/**\n\t * Unique identifier for the passed in container, i.e. the return value of a call\n\t * to {@link @fluidframework/fluid-static#IFluidContainer.attach | `IFluidContainer.attach()`} when creating a new\n\t * Fluid container, or the id used to load a pre-existing one.\n\t */\n\tcontainerId: string;\n\t/**\n\t * Conusmers take incoming produced {@link @fluidframework/fluid-telemetry#IFluidTelemetry} and do something of your choice with it.\n\t * This could be sending the telemetry to a cloud platform or just console logging.\n\t */\n\tconsumers: ITelemetryConsumer[];\n}\n\n/**\n * Starts creating {@link @fluidframework/fluid-telemetry#IFluidTelemetry} by transforming raw system events emitted by the specified container\n * into said telemetry and passing it onto to the specified {@link ITelemetryConsumer}\n *\n * @beta\n */\nexport const startTelemetry = (config: TelemetryConfig): void => {\n\tconst telemetryProducer = new ContainerEventTelemetryProducer(config.containerId);\n\tnew ContainerTelemetryManager(config.container, telemetryProducer, config.consumers);\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"appInsightsTelemetryConsumer.d.ts","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE9E;;;;;GAKG;AACH,qBAAa,4BAA6B,YAAW,kBAAkB;IACnD,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,mBAAmB;IAE1E;;OAEG;IACI,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;CAM5C"}
1
+ {"version":3,"file":"appInsightsTelemetryConsumer.d.ts","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE9E;;;;;GAKG;AACH,qBAAa,4BAA6B,YAAW,kBAAkB;IACnD,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,mBAAmB;IAE1E;;OAEG;IACI,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;CAM5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"appInsightsTelemetryConsumer.js","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;GAKG;AACH,MAAM,OAAO,4BAA4B;IACxC,YAAoC,iBAAsC;QAAtC,sBAAiB,GAAjB,iBAAiB,CAAqB;IAAG,CAAC;IAE9E;;OAEG;IACI,OAAO,CAAC,KAAsB;QACpC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC;YACjC,IAAI,EAAE,KAAK,CAAC,SAAS;YACrB,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ApplicationInsights } from \"@microsoft/applicationinsights-web\";\nimport type { IFluidTelemetry, ITelemetryConsumer } from \"../common/index.js\";\n\n/**\n * An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights\n * in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.\n *\n * @beta\n */\nexport class AppInsightsTelemetryConsumer implements ITelemetryConsumer {\n\tpublic constructor(private readonly appInsightsClient: ApplicationInsights) {}\n\n\t/**\n\t * Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights\n\t */\n\tpublic consume(event: IFluidTelemetry): void {\n\t\tthis.appInsightsClient.trackEvent({\n\t\t\tname: event.eventName,\n\t\t\tproperties: event,\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"appInsightsTelemetryConsumer.js","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;GAKG;AACH,MAAM,OAAO,4BAA4B;IACxC,YAAoC,iBAAsC;QAAtC,sBAAiB,GAAjB,iBAAiB,CAAqB;IAAG,CAAC;IAE9E;;OAEG;IACI,OAAO,CAAC,KAAsB;QACpC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC;YACjC,IAAI,EAAE,KAAK,CAAC,SAAS;YACrB,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ApplicationInsights } from \"@microsoft/applicationinsights-web\";\n\nimport type { IFluidTelemetry, ITelemetryConsumer } from \"../common/index.js\";\n\n/**\n * An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights\n * in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.\n *\n * @beta\n */\nexport class AppInsightsTelemetryConsumer implements ITelemetryConsumer {\n\tpublic constructor(private readonly appInsightsClient: ApplicationInsights) {}\n\n\t/**\n\t * Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights\n\t */\n\tpublic consume(event: IFluidTelemetry): void {\n\t\tthis.appInsightsClient.trackEvent({\n\t\t\tname: event.eventName,\n\t\t\tproperties: event,\n\t\t});\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"containerTelemetry.d.ts","sourceRoot":"","sources":["../../src/container/containerTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;GAEG;AAEH;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;IACxC;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;CAEM,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GACtC,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,OAAO,4BAA4B,CAAC,CAAC;AAElF;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC3D;;OAEG;IACH,SAAS,EAAE,2BAA2B,CAAC;IACvC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,mBAAmB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACvE;;OAEG;IACH,SAAS,EAAE,oCAAoC,CAAC;CAChD;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,8BAA+B,SAAQ,mBAAmB;IAC1E;;OAEG;IACH,SAAS,EAAE,uCAAuC,CAAC;CACnD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACtE;;OAEG;IACH,SAAS,EAAE,mCAAmC,CAAC;IAC/C;;;OAGG;IACH,KAAK,CAAC,EAAE,uBAAuB,CAAC;CAChC"}
1
+ {"version":3,"file":"containerTelemetry.d.ts","sourceRoot":"","sources":["../../src/container/containerTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAErF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;GAEG;AAEH;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;IACxC;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;CAEM,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GACtC,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,OAAO,4BAA4B,CAAC,CAAC;AAElF;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC3D;;OAEG;IACH,SAAS,EAAE,2BAA2B,CAAC;IACvC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,mBAAmB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACvE;;OAEG;IACH,SAAS,EAAE,oCAAoC,CAAC;CAChD;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,8BAA+B,SAAQ,mBAAmB;IAC1E;;OAEG;IACH,SAAS,EAAE,uCAAuC,CAAC;CACnD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACtE;;OAEG;IACH,SAAS,EAAE,mCAAmC,CAAC;IAC/C;;;OAGG;IACH,KAAK,CAAC,EAAE,uBAAuB,CAAC;CAChC"}
@@ -1 +1 @@
1
- {"version":3,"file":"containerTelemetry.js","sourceRoot":"","sources":["../../src/container/containerTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC3C;;;;OAIG;IACH,SAAS,EAAE,oCAAoC;IAC/C;;;;OAIG;IACH,YAAY,EAAE,uCAAuC;IACrD;;;;OAIG;IACH,QAAQ,EAAE,mCAAmC;CACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { type IFluidTelemetry } from \"../common/index.js\";\n\n/**\n * This file contains the types for container telemetry that can be produced.\n */\n\n/**\n * This object contains names for Container Telemetry. Unlike the raw {@link @fluidframework/fluid-static#IFluidContainerEvents | IFluidContainer system event names} they contain more information such as the scope\n *\n * @beta\n */\nexport const ContainerTelemetryEventNames = {\n\t/**\n\t * Name for the container telemetry event that is intended to be produced from the IFluidContainer \"connected\" {@link @fluidframework/fluid-static#IFluidContainerEvents | system event}\n\t *\n\t * @see {@link ContainerConnectedTelemetry}\n\t */\n\tCONNECTED: \"fluidframework.container.connected\",\n\t/**\n\t * Name for the container telemetry event that is intended to be produced from the IFluidContainer \"disconnected\" {@link @fluidframework/fluid-static#IFluidContainerEvents | system event}\n\t *\n\t * @see {@link ContainerDisconnectedTelemetry}\n\t */\n\tDISCONNECTED: \"fluidframework.container.disconnected\",\n\t/**\n\t * Name for the container telemetry event that is intended to be produced from the IFluidContainer \"disposed\" {@link @fluidframework/fluid-static#IFluidContainerEvents | system event}\n\t *\n\t * @see {@link ContainerDisposedTelemetry}\n\t */\n\tDISPOSED: \"fluidframework.container.disposed\",\n} as const;\n\n/**\n * The aggregate type for all values within {@link ContainerTelemetryEventNames}\n * @beta\n */\nexport type ContainerTelemetryEventName =\n\t(typeof ContainerTelemetryEventNames)[keyof typeof ContainerTelemetryEventNames];\n\n/**\n * The base interface for all Container telemetry\n * @beta\n */\nexport interface IContainerTelemetry extends IFluidTelemetry {\n\t/**\n\t * {@inheritdoc IFluidTelemetry.eventName}\n\t */\n\teventName: ContainerTelemetryEventName;\n\t/**\n\t * Unique identifier for a container, stable across creation and load.\n\t * I.e. different clients loading the same container (or the same client loading the container two separate times)\n\t * will agree on this value.\n\t *\n\t * @remarks This can be undefined for a container that has not been attached.\n\t */\n\tcontainerId?: string;\n\t/**\n\t * Unique identifier for the container instance that generated the telemetry.\n\t * This is not a stable identifier for the container across clients/time.\n\t * Every load of the container will result in a different value.\n\t *\n\t */\n\tcontainerInstanceId: string;\n}\n\n/**\n * The container \"connected\" telemetry event.\n * It is produced from an internal Fluid container system event {@link @fluidframework/container-definitions#IContainerEvents} which is emitted when the {@link @fluidframework/container-definitions#IContainer} completes connecting to the Fluid service.\n *\n * @see More details about {@link @fluidframework/container-definitions#IContainer.connectionState | the containers connection state}\n * @see More details about {@link @fluidframework/container-definitions#IContainer.connect | the function to connect a container }\n * @see More details about {@link @fluidframework/container-definitions#IContainer.connectionState | the containers connection state}\n *\n * @beta\n */\nexport interface ContainerConnectedTelemetry extends IContainerTelemetry {\n\t/**\n\t * {@inheritDoc IFluidTelemetry.eventName}\n\t */\n\teventName: \"fluidframework.container.connected\";\n}\n\n/**\n * The container \"disconnected\" telemetry event. This telemetry is produced from an internal Fluid container system event\n * {@link @fluidframework/container-definitions#IContainerEvents} which is emitted when the {@link @fluidframework/container-definitions#IContainer}\n * becomes disconnected from the Fluid service.\n *\n * @see More details about{@link @fluidframework/container-definitions#IContainer.connectionState | the containers connection state}\n *\n * @see More details about{@link @fluidframework/container-definitions#IContainer.disconnect | the function to disconnect a container}\n *\n * @beta\n */\nexport interface ContainerDisconnectedTelemetry extends IContainerTelemetry {\n\t/**\n\t * {@inheritDoc IFluidTelemetry.eventName}\n\t */\n\teventName: \"fluidframework.container.disconnected\";\n}\n\n/**\n *\n * The Fluid container \"disposed\" telemetry event. This telemetry is produced from the \"disposed\" Fluid container system event\n * which is emitted when the {@link @fluidframework/fluid-static#IFluidContainer} is closed, which permanently disables it.\n *\n * @see More details about{@link @fluidframework/container-definitions#IContainer.close | the container close event}\n *\n * @beta\n */\nexport interface ContainerDisposedTelemetry extends IContainerTelemetry {\n\t/**\n\t * {@inheritDoc IFluidTelemetry.eventName}\n\t */\n\teventName: \"fluidframework.container.disposed\";\n\t/**\n\t * If the container was closed due to error (as opposed to an explicit call to\n\t * {@link @fluidframework/fluid-static#IFluidContainer.\"dispose\"}), this will contain details about the error that caused it.\n\t */\n\terror?: ICriticalContainerError;\n}\n"]}
1
+ {"version":3,"file":"containerTelemetry.js","sourceRoot":"","sources":["../../src/container/containerTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC3C;;;;OAIG;IACH,SAAS,EAAE,oCAAoC;IAC/C;;;;OAIG;IACH,YAAY,EAAE,uCAAuC;IACrD;;;;OAIG;IACH,QAAQ,EAAE,mCAAmC;CACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\n\nimport { type IFluidTelemetry } from \"../common/index.js\";\n\n/**\n * This file contains the types for container telemetry that can be produced.\n */\n\n/**\n * This object contains names for Container Telemetry. Unlike the raw {@link @fluidframework/fluid-static#IFluidContainerEvents | IFluidContainer system event names} they contain more information such as the scope\n *\n * @beta\n */\nexport const ContainerTelemetryEventNames = {\n\t/**\n\t * Name for the container telemetry event that is intended to be produced from the IFluidContainer \"connected\" {@link @fluidframework/fluid-static#IFluidContainerEvents | system event}\n\t *\n\t * @see {@link ContainerConnectedTelemetry}\n\t */\n\tCONNECTED: \"fluidframework.container.connected\",\n\t/**\n\t * Name for the container telemetry event that is intended to be produced from the IFluidContainer \"disconnected\" {@link @fluidframework/fluid-static#IFluidContainerEvents | system event}\n\t *\n\t * @see {@link ContainerDisconnectedTelemetry}\n\t */\n\tDISCONNECTED: \"fluidframework.container.disconnected\",\n\t/**\n\t * Name for the container telemetry event that is intended to be produced from the IFluidContainer \"disposed\" {@link @fluidframework/fluid-static#IFluidContainerEvents | system event}\n\t *\n\t * @see {@link ContainerDisposedTelemetry}\n\t */\n\tDISPOSED: \"fluidframework.container.disposed\",\n} as const;\n\n/**\n * The aggregate type for all values within {@link ContainerTelemetryEventNames}\n * @beta\n */\nexport type ContainerTelemetryEventName =\n\t(typeof ContainerTelemetryEventNames)[keyof typeof ContainerTelemetryEventNames];\n\n/**\n * The base interface for all Container telemetry\n * @beta\n */\nexport interface IContainerTelemetry extends IFluidTelemetry {\n\t/**\n\t * {@inheritdoc IFluidTelemetry.eventName}\n\t */\n\teventName: ContainerTelemetryEventName;\n\t/**\n\t * Unique identifier for a container, stable across creation and load.\n\t * I.e. different clients loading the same container (or the same client loading the container two separate times)\n\t * will agree on this value.\n\t *\n\t * @remarks This can be undefined for a container that has not been attached.\n\t */\n\tcontainerId?: string;\n\t/**\n\t * Unique identifier for the container instance that generated the telemetry.\n\t * This is not a stable identifier for the container across clients/time.\n\t * Every load of the container will result in a different value.\n\t *\n\t */\n\tcontainerInstanceId: string;\n}\n\n/**\n * The container \"connected\" telemetry event.\n * It is produced from an internal Fluid container system event {@link @fluidframework/container-definitions#IContainerEvents} which is emitted when the {@link @fluidframework/container-definitions#IContainer} completes connecting to the Fluid service.\n *\n * @see More details about {@link @fluidframework/container-definitions#IContainer.connectionState | the containers connection state}\n * @see More details about {@link @fluidframework/container-definitions#IContainer.connect | the function to connect a container }\n * @see More details about {@link @fluidframework/container-definitions#IContainer.connectionState | the containers connection state}\n *\n * @beta\n */\nexport interface ContainerConnectedTelemetry extends IContainerTelemetry {\n\t/**\n\t * {@inheritDoc IFluidTelemetry.eventName}\n\t */\n\teventName: \"fluidframework.container.connected\";\n}\n\n/**\n * The container \"disconnected\" telemetry event. This telemetry is produced from an internal Fluid container system event\n * {@link @fluidframework/container-definitions#IContainerEvents} which is emitted when the {@link @fluidframework/container-definitions#IContainer}\n * becomes disconnected from the Fluid service.\n *\n * @see More details about{@link @fluidframework/container-definitions#IContainer.connectionState | the containers connection state}\n *\n * @see More details about{@link @fluidframework/container-definitions#IContainer.disconnect | the function to disconnect a container}\n *\n * @beta\n */\nexport interface ContainerDisconnectedTelemetry extends IContainerTelemetry {\n\t/**\n\t * {@inheritDoc IFluidTelemetry.eventName}\n\t */\n\teventName: \"fluidframework.container.disconnected\";\n}\n\n/**\n *\n * The Fluid container \"disposed\" telemetry event. This telemetry is produced from the \"disposed\" Fluid container system event\n * which is emitted when the {@link @fluidframework/fluid-static#IFluidContainer} is closed, which permanently disables it.\n *\n * @see More details about{@link @fluidframework/container-definitions#IContainer.close | the container close event}\n *\n * @beta\n */\nexport interface ContainerDisposedTelemetry extends IContainerTelemetry {\n\t/**\n\t * {@inheritDoc IFluidTelemetry.eventName}\n\t */\n\teventName: \"fluidframework.container.disposed\";\n\t/**\n\t * If the container was closed due to error (as opposed to an explicit call to\n\t * {@link @fluidframework/fluid-static#IFluidContainer.\"dispose\"}), this will contain details about the error that caused it.\n\t */\n\terror?: ICriticalContainerError;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryManager.d.ts","sourceRoot":"","sources":["../../src/container/telemetryManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,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GAAG,IAAI,CAAC,iBAAiB,CAAC,yBAAyB,EAAE,CAAC;gBACrE,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,kBAAkB,EAAE;oBAC/C,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;iBAC5B;aACD;QACF,CAAC,EAAE,yBAAyB,CAAC,8BAA8B,CAAC,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACK,0BAA0B,CACjC,SAAyC,EACzC,OAAiB;QAEjB,MAAM,SAAS,GACd,IAAI,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAEnE,IAAI,SAAS,KAAK,SAAS,EAAE;YAC5B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,kBAAkB,EAAE;gBAC/C,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;aAC5B;SACD;IACF,CAAC;;AA7DuB,wDAA8B,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\nimport { ConnectionState } from \"@fluidframework/container-loader\";\nimport { type ITelemetryConsumer } from \"../common/index.js\";\nimport { type IContainerTelemetry } from \"./containerTelemetry.js\";\nimport type { ContainerEventTelemetryProducer } from \"./telemetryProducer.js\";\nimport {\n\ttype IFluidContainerSystemEventName,\n\tIFluidContainerSystemEventNames,\n} from \"./containerSystemEvents.js\";\n\n/**\n * This class manages container telemetry intended for customers to consume by wiring together the provided container system events, telemetry producers and consumers together.\n * It manages subcribing to the proper raw container system events, sending them to the {@link ContainerEventTelemetryProducer}\n * to be transformed into {@link IContainerTelemetry} and finally sending them to the provided {@link ITelemetryConsumer}\n */\nexport class ContainerTelemetryManager {\n\tprivate static readonly HEARTBEAT_EMISSION_INTERNAL_MS = 60000;\n\n\tpublic constructor(\n\t\tprivate readonly container: IFluidContainer,\n\t\tprivate readonly telemetryProducer: ContainerEventTelemetryProducer,\n\t\tprivate readonly telemetryConsumers: ITelemetryConsumer[],\n\t) {\n\t\tthis.setupEventHandlers();\n\t\tthis.setupHeartbeatTelemetryEmission();\n\t}\n\n\t/**\n\t * Subscribes to the raw container system events and routes them to telemetry producers.\n\t */\n\tprivate setupEventHandlers(): void {\n\t\tthis.container.on(IFluidContainerSystemEventNames.CONNECTED, () =>\n\t\t\tthis.handleContainerSystemEvent(IFluidContainerSystemEventNames.CONNECTED),\n\t\t);\n\t\tthis.container.on(IFluidContainerSystemEventNames.DISCONNECTED, () =>\n\t\t\tthis.handleContainerSystemEvent(IFluidContainerSystemEventNames.DISCONNECTED),\n\t\t);\n\t\tthis.container.on(\n\t\t\tIFluidContainerSystemEventNames.DISPOSED,\n\t\t\t(error?: ICriticalContainerError) =>\n\t\t\t\tthis.handleContainerSystemEvent(IFluidContainerSystemEventNames.DISPOSED, {\n\t\t\t\t\terror,\n\t\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Sets up the synthetic telemetry event for the container heartbeat telemetry to be emitted on a given time interval\n\t * if and only if the container is in a \"connected\" state. It is used to keep a pulse check on a live container\n\t */\n\tprivate setupHeartbeatTelemetryEmission(): void {\n\t\tsetInterval(() => {\n\t\t\tif (this.container.connectionState === ConnectionState.Connected) {\n\t\t\t\tconst telemetry = this.telemetryProducer.produceHeartbeatTelemetry();\n\t\t\t\tfor (const consumer of this.telemetryConsumers) {\n\t\t\t\t\tconsumer.consume(telemetry);\n\t\t\t\t}\n\t\t\t}\n\t\t}, ContainerTelemetryManager.HEARTBEAT_EMISSION_INTERNAL_MS);\n\t}\n\n\t/**\n\t * Handles the incoming raw container sysytem event, sending it to the {@link ContainerEventTelemetryProducer} to\n\t * produce {@link IContainerTelemetry} and sending it to the {@link ITelemetryConsumer} to be consumed.\n\t */\n\tprivate handleContainerSystemEvent(\n\t\teventName: IFluidContainerSystemEventName,\n\t\tpayload?: unknown,\n\t): void {\n\t\tconst telemetry: IContainerTelemetry | undefined =\n\t\t\tthis.telemetryProducer.produceFromSystemEvent(eventName, payload);\n\n\t\tif (telemetry !== undefined) {\n\t\t\tfor (const consumer of this.telemetryConsumers) {\n\t\t\t\tconsumer.consume(telemetry);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"telemetryManager.js","sourceRoot":"","sources":["../../src/container/telemetryManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAKnE,OAAO,EAEN,+BAA+B,GAC/B,MAAM,4BAA4B,CAAC;AAIpC;;;;GAIG;AACH,MAAM,OAAO,yBAAyB;IAGrC,YACkB,SAA0B,EAC1B,iBAAkD,EAClD,kBAAwC;QAFxC,cAAS,GAAT,SAAS,CAAiB;QAC1B,sBAAiB,GAAjB,iBAAiB,CAAiC;QAClD,uBAAkB,GAAlB,kBAAkB,CAAsB;QAEzD,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,CAAC,+BAA+B,EAAE,CAAC;IACxC,CAAC;IAED;;OAEG;IACK,kBAAkB;QACzB,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,+BAA+B,CAAC,SAAS,EAAE,GAAG,EAAE,CACjE,IAAI,CAAC,0BAA0B,CAAC,+BAA+B,CAAC,SAAS,CAAC,CAC1E,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,+BAA+B,CAAC,YAAY,EAAE,GAAG,EAAE,CACpE,IAAI,CAAC,0BAA0B,CAAC,+BAA+B,CAAC,YAAY,CAAC,CAC7E,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,EAAE,CAChB,+BAA+B,CAAC,QAAQ,EACxC,CAAC,KAA+B,EAAE,EAAE,CACnC,IAAI,CAAC,0BAA0B,CAAC,+BAA+B,CAAC,QAAQ,EAAE;YACzE,KAAK;SACL,CAAC,CACH,CAAC;IACH,CAAC;IAED;;;OAGG;IACK,+BAA+B;QACtC,WAAW,CAAC,GAAG,EAAE;YAChB,IAAI,IAAI,CAAC,SAAS,CAAC,eAAe,KAAK,eAAe,CAAC,SAAS,EAAE,CAAC;gBAClE,MAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,yBAAyB,EAAE,CAAC;gBACrE,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;oBAChD,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;gBAC7B,CAAC;YACF,CAAC;QACF,CAAC,EAAE,yBAAyB,CAAC,8BAA8B,CAAC,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACK,0BAA0B,CACjC,SAAyC,EACzC,OAAiB;QAEjB,MAAM,SAAS,GACd,IAAI,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAEnE,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC7B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBAChD,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;IACF,CAAC;;AA7DuB,wDAA8B,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { ConnectionState } from \"@fluidframework/container-loader\";\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\n\nimport { type ITelemetryConsumer } from \"../common/index.js\";\n\nimport {\n\ttype IFluidContainerSystemEventName,\n\tIFluidContainerSystemEventNames,\n} from \"./containerSystemEvents.js\";\nimport { type IContainerTelemetry } from \"./containerTelemetry.js\";\nimport type { ContainerEventTelemetryProducer } from \"./telemetryProducer.js\";\n\n/**\n * This class manages container telemetry intended for customers to consume by wiring together the provided container system events, telemetry producers and consumers together.\n * It manages subcribing to the proper raw container system events, sending them to the {@link ContainerEventTelemetryProducer}\n * to be transformed into {@link IContainerTelemetry} and finally sending them to the provided {@link ITelemetryConsumer}\n */\nexport class ContainerTelemetryManager {\n\tprivate static readonly HEARTBEAT_EMISSION_INTERNAL_MS = 60000;\n\n\tpublic constructor(\n\t\tprivate readonly container: IFluidContainer,\n\t\tprivate readonly telemetryProducer: ContainerEventTelemetryProducer,\n\t\tprivate readonly telemetryConsumers: ITelemetryConsumer[],\n\t) {\n\t\tthis.setupEventHandlers();\n\t\tthis.setupHeartbeatTelemetryEmission();\n\t}\n\n\t/**\n\t * Subscribes to the raw container system events and routes them to telemetry producers.\n\t */\n\tprivate setupEventHandlers(): void {\n\t\tthis.container.on(IFluidContainerSystemEventNames.CONNECTED, () =>\n\t\t\tthis.handleContainerSystemEvent(IFluidContainerSystemEventNames.CONNECTED),\n\t\t);\n\t\tthis.container.on(IFluidContainerSystemEventNames.DISCONNECTED, () =>\n\t\t\tthis.handleContainerSystemEvent(IFluidContainerSystemEventNames.DISCONNECTED),\n\t\t);\n\t\tthis.container.on(\n\t\t\tIFluidContainerSystemEventNames.DISPOSED,\n\t\t\t(error?: ICriticalContainerError) =>\n\t\t\t\tthis.handleContainerSystemEvent(IFluidContainerSystemEventNames.DISPOSED, {\n\t\t\t\t\terror,\n\t\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Sets up the synthetic telemetry event for the container heartbeat telemetry to be emitted on a given time interval\n\t * if and only if the container is in a \"connected\" state. It is used to keep a pulse check on a live container\n\t */\n\tprivate setupHeartbeatTelemetryEmission(): void {\n\t\tsetInterval(() => {\n\t\t\tif (this.container.connectionState === ConnectionState.Connected) {\n\t\t\t\tconst telemetry = this.telemetryProducer.produceHeartbeatTelemetry();\n\t\t\t\tfor (const consumer of this.telemetryConsumers) {\n\t\t\t\t\tconsumer.consume(telemetry);\n\t\t\t\t}\n\t\t\t}\n\t\t}, ContainerTelemetryManager.HEARTBEAT_EMISSION_INTERNAL_MS);\n\t}\n\n\t/**\n\t * Handles the incoming raw container sysytem event, sending it to the {@link ContainerEventTelemetryProducer} to\n\t * produce {@link IContainerTelemetry} and sending it to the {@link ITelemetryConsumer} to be consumed.\n\t */\n\tprivate handleContainerSystemEvent(\n\t\teventName: IFluidContainerSystemEventName,\n\t\tpayload?: unknown,\n\t): void {\n\t\tconst telemetry: IContainerTelemetry | undefined =\n\t\t\tthis.telemetryProducer.produceFromSystemEvent(eventName, payload);\n\n\t\tif (telemetry !== undefined) {\n\t\t\tfor (const consumer of this.telemetryConsumers) {\n\t\t\t\tconsumer.consume(telemetry);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IFluidTelemetry } from "../index.js";
6
- import { type IContainerTelemetry } from "./containerTelemetry.js";
7
6
  import { type IFluidContainerSystemEventName } from "./containerSystemEvents.js";
7
+ import { type IContainerTelemetry } from "./containerTelemetry.js";
8
8
  /**
9
9
  * This class produces {@link IContainerTelemetry} from raw container system events {@link @fluidframework/fluid-static#IFluidContainerEvents}.
10
10
  * The class contains different helper methods for simplifying and standardizing logic for adding additional information necessary
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryProducer.d.ts","sourceRoot":"","sources":["../../src/container/telemetryProducer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAGN,KAAK,mBAAmB,EAExB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,KAAK,8BAA8B,EAEnC,MAAM,4BAA4B,CAAC;AAEpC;;;;GAIG;AACH,qBAAa,+BAA+B;IAMxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAL/C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAU;gBAEV,WAAW,EAAE,MAAM;IAEhD,sBAAsB,CAC5B,SAAS,EAAE,8BAA8B,EACzC,OAAO,CAAC,EAAE,OAAO,GACf,mBAAmB,GAAG,SAAS;IAoB3B,yBAAyB,QAAO,eAAe,CAMpD;IAEF,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAQ5C;IAEF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAYtC;CACF"}
1
+ {"version":3,"file":"telemetryProducer.d.ts","sourceRoot":"","sources":["../../src/container/telemetryProducer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EACN,KAAK,8BAA8B,EAEnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGN,KAAK,mBAAmB,EAExB,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,qBAAa,+BAA+B;IAMxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAL/C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAU;gBAEV,WAAW,EAAE,MAAM;IAEhD,sBAAsB,CAC5B,SAAS,EAAE,8BAA8B,EACzC,OAAO,CAAC,EAAE,OAAO,GACf,mBAAmB,GAAG,SAAS;IAoB3B,yBAAyB,QAAO,eAAe,CAMpD;IAEF,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAQ5C;IAEF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAYtC;CACF"}
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { v4 as uuid } from "uuid";
6
- import { ContainerTelemetryEventNames, } from "./containerTelemetry.js";
7
6
  import { IFluidContainerSystemEventNames, } from "./containerSystemEvents.js";
7
+ import { ContainerTelemetryEventNames, } from "./containerTelemetry.js";
8
8
  /**
9
9
  * This class produces {@link IContainerTelemetry} from raw container system events {@link @fluidframework/fluid-static#IFluidContainerEvents}.
10
10
  * The class contains different helper methods for simplifying and standardizing logic for adding additional information necessary
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryProducer.js","sourceRoot":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AO,IAAI,CAAC,6BAA6B,CAAC,4BAA4B,CAAC,SAAS,CAAC,CAAC;aAClF;YACD,KAAK,+BAA+B,CAAC,YAAY,CAAC,CAAC;gBAClD,OAAO,IAAI,CAAC,6BAA6B,CACxC,4BAA4B,CAAC,YAAY,CACzC,CAAC;aACF;YACD,KAAK,+BAA+B,CAAC,QAAQ,CAAC,CAAC;gBAC9C,MAAM,YAAY,GAAG,OAA8C,CAAC;gBACpE,OAAO,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;aAClD;YACD,OAAO,CAAC,CAAC;gBACR,MAAM;aACN;SACD;IACF,CAAC;CAiCD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { v4 as uuid } from \"uuid\";\nimport type { IFluidTelemetry } from \"../index.js\";\nimport {\n\tContainerTelemetryEventNames,\n\ttype ContainerTelemetryEventName,\n\ttype IContainerTelemetry,\n\ttype ContainerDisposedTelemetry,\n} from \"./containerTelemetry.js\";\nimport {\n\ttype IFluidContainerSystemEventName,\n\tIFluidContainerSystemEventNames,\n} from \"./containerSystemEvents.js\";\n\n/**\n * This class produces {@link IContainerTelemetry} from raw container system events {@link @fluidframework/fluid-static#IFluidContainerEvents}.\n * The class contains different helper methods for simplifying and standardizing logic for adding additional information necessary\n * to produce different {@link IContainerTelemetry}.\n */\nexport class ContainerEventTelemetryProducer {\n\t/**\n\t * Unique identifier for the instance of the container that this class is generating telemetry for.\n\t */\n\tprivate readonly containerInstanceId = uuid();\n\n\tpublic constructor(private readonly containerId: string) {}\n\n\tpublic produceFromSystemEvent(\n\t\teventName: IFluidContainerSystemEventName,\n\t\tpayload?: unknown,\n\t): IContainerTelemetry | undefined {\n\t\tswitch (eventName) {\n\t\t\tcase IFluidContainerSystemEventNames.CONNECTED: {\n\t\t\t\treturn this.produceBaseContainerTelemetry(ContainerTelemetryEventNames.CONNECTED);\n\t\t\t}\n\t\t\tcase IFluidContainerSystemEventNames.DISCONNECTED: {\n\t\t\t\treturn this.produceBaseContainerTelemetry(\n\t\t\t\t\tContainerTelemetryEventNames.DISCONNECTED,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase IFluidContainerSystemEventNames.DISPOSED: {\n\t\t\t\tconst typedPayload = payload as { error?: ICriticalContainerError };\n\t\t\t\treturn this.produceDiposedTelemetry(typedPayload);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic produceHeartbeatTelemetry = (): IFluidTelemetry => {\n\t\treturn {\n\t\t\teventName: \"fluidframework.container.heartbeat\",\n\t\t\tcontainerId: this.containerId,\n\t\t\tcontainerInstanceId: this.containerInstanceId,\n\t\t} as unknown as IFluidTelemetry;\n\t};\n\n\tprivate readonly produceBaseContainerTelemetry = (\n\t\teventName: ContainerTelemetryEventName,\n\t): IContainerTelemetry => {\n\t\treturn {\n\t\t\teventName,\n\t\t\tcontainerId: this.containerId,\n\t\t\tcontainerInstanceId: this.containerInstanceId,\n\t\t} satisfies IContainerTelemetry;\n\t};\n\n\tprivate readonly produceDiposedTelemetry = (payload?: {\n\t\terror?: ICriticalContainerError;\n\t}): ContainerDisposedTelemetry => {\n\t\tconst telemetry: ContainerDisposedTelemetry = {\n\t\t\teventName: ContainerTelemetryEventNames.DISPOSED,\n\t\t\tcontainerId: this.containerId,\n\t\t\tcontainerInstanceId: this.containerInstanceId,\n\t\t};\n\t\tif (payload?.error !== undefined) {\n\t\t\ttelemetry.error = payload.error;\n\t\t}\n\t\treturn telemetry;\n\t};\n}\n"]}
1
+ {"version":3,"file":"telemetryProducer.js","sourceRoot":"","sources":["../../src/container/telemetryProducer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAIlC,OAAO,EAEN,+BAA+B,GAC/B,MAAM,4BAA4B,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,CAAC,6BAA6B,CACxC,4BAA4B,CAAC,YAAY,CACzC,CAAC;YACH,CAAC;YACD,KAAK,+BAA+B,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC/C,MAAM,YAAY,GAAG,OAA8C,CAAC;gBACpE,OAAO,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;YACnD,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACT,MAAM;YACP,CAAC;QACF,CAAC;IACF,CAAC;CAiCD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type { IFluidTelemetry } from \"../index.js\";\n\nimport {\n\ttype IFluidContainerSystemEventName,\n\tIFluidContainerSystemEventNames,\n} from \"./containerSystemEvents.js\";\nimport {\n\tContainerTelemetryEventNames,\n\ttype ContainerTelemetryEventName,\n\ttype IContainerTelemetry,\n\ttype ContainerDisposedTelemetry,\n} from \"./containerTelemetry.js\";\n\n/**\n * This class produces {@link IContainerTelemetry} from raw container system events {@link @fluidframework/fluid-static#IFluidContainerEvents}.\n * The class contains different helper methods for simplifying and standardizing logic for adding additional information necessary\n * to produce different {@link IContainerTelemetry}.\n */\nexport class ContainerEventTelemetryProducer {\n\t/**\n\t * Unique identifier for the instance of the container that this class is generating telemetry for.\n\t */\n\tprivate readonly containerInstanceId = uuid();\n\n\tpublic constructor(private readonly containerId: string) {}\n\n\tpublic produceFromSystemEvent(\n\t\teventName: IFluidContainerSystemEventName,\n\t\tpayload?: unknown,\n\t): IContainerTelemetry | undefined {\n\t\tswitch (eventName) {\n\t\t\tcase IFluidContainerSystemEventNames.CONNECTED: {\n\t\t\t\treturn this.produceBaseContainerTelemetry(ContainerTelemetryEventNames.CONNECTED);\n\t\t\t}\n\t\t\tcase IFluidContainerSystemEventNames.DISCONNECTED: {\n\t\t\t\treturn this.produceBaseContainerTelemetry(\n\t\t\t\t\tContainerTelemetryEventNames.DISCONNECTED,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase IFluidContainerSystemEventNames.DISPOSED: {\n\t\t\t\tconst typedPayload = payload as { error?: ICriticalContainerError };\n\t\t\t\treturn this.produceDiposedTelemetry(typedPayload);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic produceHeartbeatTelemetry = (): IFluidTelemetry => {\n\t\treturn {\n\t\t\teventName: \"fluidframework.container.heartbeat\",\n\t\t\tcontainerId: this.containerId,\n\t\t\tcontainerInstanceId: this.containerInstanceId,\n\t\t} as unknown as IFluidTelemetry;\n\t};\n\n\tprivate readonly produceBaseContainerTelemetry = (\n\t\teventName: ContainerTelemetryEventName,\n\t): IContainerTelemetry => {\n\t\treturn {\n\t\t\teventName,\n\t\t\tcontainerId: this.containerId,\n\t\t\tcontainerInstanceId: this.containerInstanceId,\n\t\t} satisfies IContainerTelemetry;\n\t};\n\n\tprivate readonly produceDiposedTelemetry = (payload?: {\n\t\terror?: ICriticalContainerError;\n\t}): ContainerDisposedTelemetry => {\n\t\tconst telemetry: ContainerDisposedTelemetry = {\n\t\t\teventName: ContainerTelemetryEventNames.DISPOSED,\n\t\t\tcontainerId: this.containerId,\n\t\t\tcontainerInstanceId: this.containerInstanceId,\n\t\t};\n\t\tif (payload?.error !== undefined) {\n\t\t\ttelemetry.error = payload.error;\n\t\t}\n\t\treturn telemetry;\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,SAAS,EAAE,eAAe,CAAC;IAC3B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,EAAE,kBAAkB,EAAE,CAAC;CAChC;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,WAAY,eAAe,KAAG,IAGxD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG7D;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,SAAS,EAAE,eAAe,CAAC;IAC3B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,EAAE,kBAAkB,EAAE,CAAC;CAChC;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,WAAY,eAAe,KAAG,IAGxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AA0BnG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAuB,EAAQ,EAAE;IAC/D,MAAM,iBAAiB,GAAG,IAAI,+BAA+B,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAClF,IAAI,yBAAyB,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;AACtF,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\nimport { ContainerTelemetryManager, ContainerEventTelemetryProducer } from \"../container/index.js\";\nimport { type ITelemetryConsumer } from \"../common/index.js\";\n\n/**\n * Configuration object for subscribing to {@link @fluidframework/fluid-telemetry#IFluidTelemetry} and consuming said telemetry via one or more {@link ITelemetryConsumer}\n *\n * @beta\n */\nexport interface TelemetryConfig {\n\t/**\n\t * The container whose events should be monitored, transformed into Fluid telemetry, and sent to a {@link ITelemetryConsumer}.\n\t */\n\tcontainer: IFluidContainer;\n\t/**\n\t * Unique identifier for the passed in container, i.e. the return value of a call\n\t * to {@link @fluidframework/fluid-static#IFluidContainer.attach | `IFluidContainer.attach()`} when creating a new\n\t * Fluid container, or the id used to load a pre-existing one.\n\t */\n\tcontainerId: string;\n\t/**\n\t * Conusmers take incoming produced {@link @fluidframework/fluid-telemetry#IFluidTelemetry} and do something of your choice with it.\n\t * This could be sending the telemetry to a cloud platform or just console logging.\n\t */\n\tconsumers: ITelemetryConsumer[];\n}\n\n/**\n * Starts creating {@link @fluidframework/fluid-telemetry#IFluidTelemetry} by transforming raw system events emitted by the specified container\n * into said telemetry and passing it onto to the specified {@link ITelemetryConsumer}\n *\n * @beta\n */\nexport const startTelemetry = (config: TelemetryConfig): void => {\n\tconst telemetryProducer = new ContainerEventTelemetryProducer(config.containerId);\n\tnew ContainerTelemetryManager(config.container, telemetryProducer, config.consumers);\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,yBAAyB,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAyBnG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAuB,EAAQ,EAAE;IAC/D,MAAM,iBAAiB,GAAG,IAAI,+BAA+B,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAClF,IAAI,yBAAyB,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;AACtF,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\n\nimport { type ITelemetryConsumer } from \"../common/index.js\";\nimport { ContainerTelemetryManager, ContainerEventTelemetryProducer } from \"../container/index.js\";\n\n/**\n * Configuration object for subscribing to {@link @fluidframework/fluid-telemetry#IFluidTelemetry} and consuming said telemetry via one or more {@link ITelemetryConsumer}\n *\n * @beta\n */\nexport interface TelemetryConfig {\n\t/**\n\t * The container whose events should be monitored, transformed into Fluid telemetry, and sent to a {@link ITelemetryConsumer}.\n\t */\n\tcontainer: IFluidContainer;\n\t/**\n\t * Unique identifier for the passed in container, i.e. the return value of a call\n\t * to {@link @fluidframework/fluid-static#IFluidContainer.attach | `IFluidContainer.attach()`} when creating a new\n\t * Fluid container, or the id used to load a pre-existing one.\n\t */\n\tcontainerId: string;\n\t/**\n\t * Conusmers take incoming produced {@link @fluidframework/fluid-telemetry#IFluidTelemetry} and do something of your choice with it.\n\t * This could be sending the telemetry to a cloud platform or just console logging.\n\t */\n\tconsumers: ITelemetryConsumer[];\n}\n\n/**\n * Starts creating {@link @fluidframework/fluid-telemetry#IFluidTelemetry} by transforming raw system events emitted by the specified container\n * into said telemetry and passing it onto to the specified {@link ITelemetryConsumer}\n *\n * @beta\n */\nexport const startTelemetry = (config: TelemetryConfig): void => {\n\tconst telemetryProducer = new ContainerEventTelemetryProducer(config.containerId);\n\tnew ContainerTelemetryManager(config.container, telemetryProducer, config.consumers);\n};\n"]}
@@ -2,12 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { spy } from "sinon";
6
- import { expect } from "chai";
7
5
  import { TypedEventEmitter } from "@fluid-internal/client-utils";
8
6
  import { ApplicationInsights } from "@microsoft/applicationinsights-web";
9
- import { startTelemetry } from "../factory/index.js";
7
+ import { expect } from "chai";
8
+ import { spy } from "sinon";
10
9
  import { IFluidContainerSystemEventNames } from "../container/index.js";
10
+ import { startTelemetry } from "../factory/index.js";
11
11
  import { ContainerTelemetryEventNames, } from "../index.js";
12
12
  /**
13
13
  * For these unit tests, we are just interested in the event emitter part of the Fluid container.
@@ -1 +1 @@
1
- {"version":3,"file":"containerTelemetry.spec.js","sourceRoot":"","sources":["../../src/test/containerTelemetry.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAwB,MAAM,oCAAoC,CAAC;AAE/F,OAAO,EAAE,cAAc,EAAwB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,+BAA+B,EAA4B,MAAM,uBAAuB,CAAC;AAClG,OAAO,EACN,4BAA4B,GAM5B,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,UAAU,CAAC,GAAG,EAAE;QACf,iBAAiB,GAAG,IAAI,mBAAmB,CAA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AM,wBAAwB,GAC7B,0BAA0B,CAAC,UAAiC,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,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7F,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 type Sinon from \"sinon\";\nimport { spy } from \"sinon\";\nimport { expect } from \"chai\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { ApplicationInsights, type IEventTelemetry } from \"@microsoft/applicationinsights-web\";\nimport type { IFluidContainer, IFluidContainerEvents } from \"@fluidframework/fluid-static\";\nimport { startTelemetry, type TelemetryConfig } from \"../factory/index.js\";\nimport { IFluidContainerSystemEventNames, type IContainerTelemetry } from \"../container/index.js\";\nimport {\n\tContainerTelemetryEventNames,\n\ttype ContainerConnectedTelemetry,\n\ttype ContainerDisconnectedTelemetry,\n\ttype ContainerDisposedTelemetry,\n\ttype IFluidTelemetry,\n\ttype ITelemetryConsumer,\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\tbeforeEach(() => {\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\n\t\ttrackEventSpy = spy(appInsightsClient, \"trackEvent\");\n\t\tmockFluidContainer = new MockFluidContainer();\n\n\t\tclass AppInsightsTelemetryConsumer implements ITelemetryConsumer {\n\t\t\tpublic constructor(private readonly client: ApplicationInsights) {}\n\n\t\t\tpublic consume(event: IFluidTelemetry): void {\n\t\t\t\tthis.client.trackEvent({\n\t\t\t\t\tname: event.eventName,\n\t\t\t\t\tproperties: event,\n\t\t\t\t});\n\t\t\t}\n\t\t}\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\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).to.be.a(\"string\").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).to.be.a(\"string\").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).to.be.a(\"string\").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).to.be.a(\"string\").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,EAAE,+BAA+B,EAA4B,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAwB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EACN,4BAA4B,GAM5B,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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cAAc,CAAC,eAAe,CAAC,CAAC;QAEhC,MAAM,cAAc,GAA4B;YAC/C,SAAS,EAAE,eAAe;YAC1B,OAAO,EAAE,0BAA0B;YACnC,KAAK,EAAE,gDAAgD;SACvD,CAAC;QAEF,kBAAkB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAE3C,iEAAiE;QACjE,MAAM,0BAA0B,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAoB,CAAC;QACvF,MAAM,wBAAwB,GAC7B,0BAA0B,CAAC,UAAiC,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,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7F,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 { IFluidContainerSystemEventNames, type IContainerTelemetry } from \"../container/index.js\";\nimport { startTelemetry, type TelemetryConfig } from \"../factory/index.js\";\nimport {\n\tContainerTelemetryEventNames,\n\ttype ContainerConnectedTelemetry,\n\ttype ContainerDisconnectedTelemetry,\n\ttype ContainerDisposedTelemetry,\n\ttype IFluidTelemetry,\n\ttype ITelemetryConsumer,\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\tbeforeEach(() => {\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\n\t\ttrackEventSpy = spy(appInsightsClient, \"trackEvent\");\n\t\tmockFluidContainer = new MockFluidContainer();\n\n\t\tclass AppInsightsTelemetryConsumer implements ITelemetryConsumer {\n\t\t\tpublic constructor(private readonly client: ApplicationInsights) {}\n\n\t\t\tpublic consume(event: IFluidTelemetry): void {\n\t\t\t\tthis.client.trackEvent({\n\t\t\t\t\tname: event.eventName,\n\t\t\t\t\tproperties: event,\n\t\t\t\t});\n\t\t\t}\n\t\t}\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\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).to.be.a(\"string\").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).to.be.a(\"string\").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).to.be.a(\"string\").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).to.be.a(\"string\").with.length.above(0);\n\t});\n});\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.43.1"
8
+ "packageVersion": "7.45.1"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/fluid-telemetry",
3
- "version": "2.0.0-dev-rc.5.0.0.263932",
3
+ "version": "2.0.0-dev-rc.5.0.0.267932",
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": {
@@ -57,19 +57,19 @@
57
57
  "main": "lib/index.js",
58
58
  "types": "lib/index.d.ts",
59
59
  "dependencies": {
60
- "@fluidframework/container-definitions": "2.0.0-dev-rc.5.0.0.263932",
61
- "@fluidframework/container-loader": "2.0.0-dev-rc.5.0.0.263932",
62
- "@fluidframework/fluid-static": "2.0.0-dev-rc.5.0.0.263932",
60
+ "@fluidframework/container-definitions": "2.0.0-dev-rc.5.0.0.267932",
61
+ "@fluidframework/container-loader": "2.0.0-dev-rc.5.0.0.267932",
62
+ "@fluidframework/fluid-static": "2.0.0-dev-rc.5.0.0.267932",
63
63
  "@microsoft/applicationinsights-web": "^2.8.11",
64
64
  "uuid": "^9.0.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@arethetypeswrong/cli": "^0.15.2",
68
- "@fluid-internal/client-utils": "2.0.0-dev-rc.5.0.0.263932",
69
- "@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.5.0.0.263932",
70
- "@fluid-tools/build-cli": "^0.38.0",
71
- "@fluidframework/build-tools": "^0.38.0",
72
- "@microsoft/api-extractor": "^7.43.1",
68
+ "@fluid-internal/client-utils": "2.0.0-dev-rc.5.0.0.267932",
69
+ "@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.5.0.0.267932",
70
+ "@fluid-tools/build-cli": "^0.39.0-264124",
71
+ "@fluidframework/build-tools": "^0.39.0-264124",
72
+ "@microsoft/api-extractor": "^7.45.1",
73
73
  "@types/chai": "^4.0.0",
74
74
  "@types/mocha": "^9.1.1",
75
75
  "@types/sinon": "^17.0.3",
@@ -82,7 +82,7 @@
82
82
  "rimraf": "^4.4.0",
83
83
  "sinon": "^17.0.1",
84
84
  "tslib": "^1.10.0",
85
- "typescript": "~5.1.6"
85
+ "typescript": "~5.4.5"
86
86
  },
87
87
  "fluidBuild": {
88
88
  "tasks": {
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import { type ApplicationInsights } from "@microsoft/applicationinsights-web";
7
+
7
8
  import type { IFluidTelemetry, ITelemetryConsumer } from "../common/index.js";
8
9
 
9
10
  /**
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import { type ICriticalContainerError } from "@fluidframework/container-definitions";
7
+
7
8
  import { type IFluidTelemetry } from "../common/index.js";
8
9
 
9
10
  /**
@@ -4,15 +4,17 @@
4
4
  */
5
5
 
6
6
  import { type ICriticalContainerError } from "@fluidframework/container-definitions";
7
- import type { IFluidContainer } from "@fluidframework/fluid-static";
8
7
  import { ConnectionState } from "@fluidframework/container-loader";
8
+ import type { IFluidContainer } from "@fluidframework/fluid-static";
9
+
9
10
  import { type ITelemetryConsumer } from "../common/index.js";
10
- import { type IContainerTelemetry } from "./containerTelemetry.js";
11
- import type { ContainerEventTelemetryProducer } from "./telemetryProducer.js";
11
+
12
12
  import {
13
13
  type IFluidContainerSystemEventName,
14
14
  IFluidContainerSystemEventNames,
15
15
  } from "./containerSystemEvents.js";
16
+ import { type IContainerTelemetry } from "./containerTelemetry.js";
17
+ import type { ContainerEventTelemetryProducer } from "./telemetryProducer.js";
16
18
 
17
19
  /**
18
20
  * This class manages container telemetry intended for customers to consume by wiring together the provided container system events, telemetry producers and consumers together.
@@ -5,17 +5,19 @@
5
5
 
6
6
  import { type ICriticalContainerError } from "@fluidframework/container-definitions";
7
7
  import { v4 as uuid } from "uuid";
8
+
8
9
  import type { IFluidTelemetry } from "../index.js";
10
+
11
+ import {
12
+ type IFluidContainerSystemEventName,
13
+ IFluidContainerSystemEventNames,
14
+ } from "./containerSystemEvents.js";
9
15
  import {
10
16
  ContainerTelemetryEventNames,
11
17
  type ContainerTelemetryEventName,
12
18
  type IContainerTelemetry,
13
19
  type ContainerDisposedTelemetry,
14
20
  } from "./containerTelemetry.js";
15
- import {
16
- type IFluidContainerSystemEventName,
17
- IFluidContainerSystemEventNames,
18
- } from "./containerSystemEvents.js";
19
21
 
20
22
  /**
21
23
  * This class produces {@link IContainerTelemetry} from raw container system events {@link @fluidframework/fluid-static#IFluidContainerEvents}.
@@ -4,8 +4,9 @@
4
4
  */
5
5
 
6
6
  import type { IFluidContainer } from "@fluidframework/fluid-static";
7
- import { ContainerTelemetryManager, ContainerEventTelemetryProducer } from "../container/index.js";
7
+
8
8
  import { type ITelemetryConsumer } from "../common/index.js";
9
+ import { ContainerTelemetryManager, ContainerEventTelemetryProducer } from "../container/index.js";
9
10
 
10
11
  /**
11
12
  * Configuration object for subscribing to {@link @fluidframework/fluid-telemetry#IFluidTelemetry} and consuming said telemetry via one or more {@link ITelemetryConsumer}