@fluidframework/fluid-telemetry 2.0.0-rc.4.0.6 → 2.0.0-rc.5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/api-extractor/api-extractor-lint-beta.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-beta.esm.json +5 -0
- package/api-extractor/api-extractor-lint-bundle.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
- package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-public.esm.json +5 -0
- package/api-extractor.json +1 -1
- package/api-report/fluid-telemetry.alpha.api.md +75 -0
- package/api-report/{fluid-telemetry.api.md → fluid-telemetry.beta.api.md} +2 -2
- package/api-report/fluid-telemetry.public.api.md +13 -0
- package/biome.jsonc +4 -0
- package/dist/app-insights/appInsightsTelemetryConsumer.d.ts +1 -1
- package/dist/app-insights/appInsightsTelemetryConsumer.d.ts.map +1 -1
- package/dist/app-insights/appInsightsTelemetryConsumer.js.map +1 -1
- package/dist/container/containerTelemetry.d.ts +2 -2
- package/dist/container/containerTelemetry.d.ts.map +1 -1
- package/dist/container/containerTelemetry.js.map +1 -1
- package/dist/container/telemetryManager.d.ts +1 -1
- package/dist/container/telemetryManager.d.ts.map +1 -1
- package/dist/container/telemetryManager.js.map +1 -1
- package/dist/container/telemetryProducer.d.ts +1 -1
- package/dist/container/telemetryProducer.d.ts.map +1 -1
- package/dist/container/telemetryProducer.js +1 -1
- package/dist/container/telemetryProducer.js.map +1 -1
- package/dist/factory/index.d.ts +1 -1
- package/dist/factory/index.d.ts.map +1 -1
- package/dist/factory/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -15
- package/lib/app-insights/appInsightsTelemetryConsumer.d.ts +1 -1
- package/lib/app-insights/appInsightsTelemetryConsumer.d.ts.map +1 -1
- package/lib/app-insights/appInsightsTelemetryConsumer.js.map +1 -1
- package/lib/container/containerTelemetry.d.ts +2 -2
- package/lib/container/containerTelemetry.d.ts.map +1 -1
- package/lib/container/containerTelemetry.js.map +1 -1
- package/lib/container/telemetryManager.d.ts +1 -1
- package/lib/container/telemetryManager.d.ts.map +1 -1
- package/lib/container/telemetryManager.js.map +1 -1
- package/lib/container/telemetryProducer.d.ts +1 -1
- package/lib/container/telemetryProducer.d.ts.map +1 -1
- package/lib/container/telemetryProducer.js +1 -1
- package/lib/container/telemetryProducer.js.map +1 -1
- package/lib/factory/index.d.ts +1 -1
- package/lib/factory/index.d.ts.map +1 -1
- package/lib/factory/index.js +1 -1
- package/lib/factory/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -15
- package/lib/test/containerTelemetry.spec.js +16 -19
- package/lib/test/containerTelemetry.spec.js.map +1 -1
- package/lib/test/containerTelemetryEndToEnd.spec.realsvc.d.ts +6 -0
- package/lib/test/containerTelemetryEndToEnd.spec.realsvc.d.ts.map +1 -0
- package/lib/test/containerTelemetryEndToEnd.spec.realsvc.js +160 -0
- package/lib/test/containerTelemetryEndToEnd.spec.realsvc.js.map +1 -0
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +44 -16
- package/src/app-insights/appInsightsTelemetryConsumer.ts +2 -1
- package/src/container/containerTelemetry.ts +3 -2
- package/src/container/telemetryManager.ts +7 -5
- package/src/container/telemetryProducer.ts +8 -8
- package/src/factory/index.ts +6 -2
- package/tsconfig.json +1 -0
- package/tsdoc.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @fluidframework/fluid-telemetry
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.5.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Updated server dependencies ([#21514](https://github.com/microsoft/FluidFramework/pull/21514)) [9629f1d93a](https://github.com/microsoft/FluidFramework/commit/9629f1d93a7e412c0cb2f65cc21da0c95ff8981d)
|
|
8
|
+
|
|
9
|
+
The following Fluid server dependencies have been updated to the latest version, 5.0.0. [See the full changelog.](https://github.com/microsoft/FluidFramework/blob/main/server/routerlicious/RELEASE_NOTES/5.0.0.md)
|
|
10
|
+
|
|
11
|
+
- @fluidframework/gitresources
|
|
12
|
+
- @fluidframework/server-kafka-orderer
|
|
13
|
+
- @fluidframework/server-lambdas
|
|
14
|
+
- @fluidframework/server-lambdas-driver
|
|
15
|
+
- @fluidframework/server-local-server
|
|
16
|
+
- @fluidframework/server-memory-orderer
|
|
17
|
+
- @fluidframework/protocol-base
|
|
18
|
+
- @fluidframework/server-routerlicious
|
|
19
|
+
- @fluidframework/server-routerlicious-base
|
|
20
|
+
- @fluidframework/server-services
|
|
21
|
+
- @fluidframework/server-services-client
|
|
22
|
+
- @fluidframework/server-services-core
|
|
23
|
+
- @fluidframework/server-services-ordering-kafkanode
|
|
24
|
+
- @fluidframework/server-services-ordering-rdkafka
|
|
25
|
+
- @fluidframework/server-services-ordering-zookeeper
|
|
26
|
+
- @fluidframework/server-services-shared
|
|
27
|
+
- @fluidframework/server-services-telemetry
|
|
28
|
+
- @fluidframework/server-services-utils
|
|
29
|
+
- @fluidframework/server-test-utils
|
|
30
|
+
- tinylicious
|
|
31
|
+
|
|
32
|
+
- Update to TypeScript 5.4 ([#21214](https://github.com/microsoft/FluidFramework/pull/21214)) [0e6256c722](https://github.com/microsoft/FluidFramework/commit/0e6256c722d8bf024f4325bf02547daeeb18bfa6)
|
|
33
|
+
|
|
34
|
+
Update package implementations to use TypeScript 5.4.5.
|
|
35
|
+
|
|
3
36
|
## 2.0.0-rc.4.0.0
|
|
4
37
|
|
|
5
38
|
Dependency updates only.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/dist/beta.d.ts"
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/lib/beta.d.ts"
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/dist/legacy.d.ts"
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/lib/legacy.d.ts"
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/dist/public.d.ts"
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../../common/build/build-common/api-extractor-lint.entrypoint.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/lib/public.d.ts"
|
|
5
|
+
}
|
package/api-extractor.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../../common/build/build-common/api-extractor-base.esm.
|
|
3
|
+
"extends": "../../../../common/build/build-common/api-extractor-base.esm.current.json",
|
|
4
4
|
"messages": {
|
|
5
5
|
// The following overrides are workarounds for API-Extractor incorrectly running analysis on our application
|
|
6
6
|
// insights dependency.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
## Alpha API Report File for "@fluidframework/fluid-telemetry"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import type { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
8
|
+
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
9
|
+
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
10
|
+
|
|
11
|
+
// @beta
|
|
12
|
+
export class AppInsightsTelemetryConsumer implements ITelemetryConsumer {
|
|
13
|
+
constructor(appInsightsClient: ApplicationInsights);
|
|
14
|
+
consume(event: IFluidTelemetry): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// @beta
|
|
18
|
+
export interface ContainerConnectedTelemetry extends IContainerTelemetry {
|
|
19
|
+
eventName: "fluidframework.container.connected";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// @beta
|
|
23
|
+
export interface ContainerDisconnectedTelemetry extends IContainerTelemetry {
|
|
24
|
+
eventName: "fluidframework.container.disconnected";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// @beta
|
|
28
|
+
export interface ContainerDisposedTelemetry extends IContainerTelemetry {
|
|
29
|
+
error?: ICriticalContainerError;
|
|
30
|
+
eventName: "fluidframework.container.disposed";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// @beta
|
|
34
|
+
export type ContainerTelemetryEventName = (typeof ContainerTelemetryEventNames)[keyof typeof ContainerTelemetryEventNames];
|
|
35
|
+
|
|
36
|
+
// @beta
|
|
37
|
+
export const ContainerTelemetryEventNames: {
|
|
38
|
+
readonly CONNECTED: "fluidframework.container.connected";
|
|
39
|
+
readonly DISCONNECTED: "fluidframework.container.disconnected";
|
|
40
|
+
readonly DISPOSED: "fluidframework.container.disposed";
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// @beta
|
|
44
|
+
export type FluidTelemetryEventName = ContainerTelemetryEventName;
|
|
45
|
+
|
|
46
|
+
// @beta
|
|
47
|
+
export interface IContainerTelemetry extends IFluidTelemetry {
|
|
48
|
+
containerId?: string;
|
|
49
|
+
containerInstanceId: string;
|
|
50
|
+
eventName: ContainerTelemetryEventName;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { ICriticalContainerError }
|
|
54
|
+
|
|
55
|
+
// @beta
|
|
56
|
+
export interface IFluidTelemetry {
|
|
57
|
+
eventName: FluidTelemetryEventName;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// @beta
|
|
61
|
+
export interface ITelemetryConsumer {
|
|
62
|
+
consume(event: IFluidTelemetry): any;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// @beta
|
|
66
|
+
export const startTelemetry: (config: TelemetryConfig) => void;
|
|
67
|
+
|
|
68
|
+
// @beta
|
|
69
|
+
export interface TelemetryConfig {
|
|
70
|
+
consumers: ITelemetryConsumer[];
|
|
71
|
+
container: IFluidContainer;
|
|
72
|
+
containerId: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
```
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
## API Report File for "@fluidframework/fluid-telemetry"
|
|
1
|
+
## Beta API Report File for "@fluidframework/fluid-telemetry"
|
|
2
2
|
|
|
3
3
|
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
7
|
+
import type { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
8
8
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
9
9
|
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
10
10
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Public API Report File for "@fluidframework/fluid-telemetry"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import type { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
8
|
+
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
9
|
+
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
10
|
+
|
|
11
|
+
export { ICriticalContainerError }
|
|
12
|
+
|
|
13
|
+
```
|
package/biome.jsonc
ADDED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import type { ApplicationInsights } from "@microsoft/applicationinsights-web";
|
|
6
6
|
import type { IFluidTelemetry, ITelemetryConsumer } from "../common/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appInsightsTelemetryConsumer.d.ts","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"appInsightsTelemetryConsumer.d.ts","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,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;;;
|
|
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"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import type { ICriticalContainerError } from "@fluidframework/container-definitions";
|
|
6
|
+
import type { IFluidTelemetry } from "../common/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* This file contains the types for container telemetry that can be produced.
|
|
9
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerTelemetry.d.ts","sourceRoot":"","sources":["../../src/container/containerTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"containerTelemetry.d.ts","sourceRoot":"","sources":["../../src/container/containerTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAErF,OAAO,KAAK,EAAE,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;;;
|
|
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"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { IFluidContainer } from "@fluidframework/fluid-static";
|
|
6
|
-
import {
|
|
6
|
+
import type { ITelemetryConsumer } from "../common/index.js";
|
|
7
7
|
import type { ContainerEventTelemetryProducer } from "./telemetryProducer.js";
|
|
8
8
|
/**
|
|
9
9
|
* This class manages container telemetry intended for customers to consume by wiring together the provided container system events, telemetry producers and consumers together.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetryManager.d.ts","sourceRoot":"","sources":["../../src/container/telemetryManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
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,KAAK,EAAE,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;;;
|
|
1
|
+
{"version":3,"file":"telemetryManager.js","sourceRoot":"","sources":["../../src/container/telemetryManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uEAAmE;AAKnE,yEAGoC;AAIpC;;;;GAIG;AACH,MAAa,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,0DAA+B,CAAC,SAAS,EAAE,GAAG,EAAE,CACjE,IAAI,CAAC,0BAA0B,CAAC,0DAA+B,CAAC,SAAS,CAAC,CAC1E,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,0DAA+B,CAAC,YAAY,EAAE,GAAG,EAAE,CACpE,IAAI,CAAC,0BAA0B,CAAC,0DAA+B,CAAC,YAAY,CAAC,CAC7E,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,EAAE,CAChB,0DAA+B,CAAC,QAAQ,EACxC,CAAC,KAA+B,EAAE,EAAE,CACnC,IAAI,CAAC,0BAA0B,CAAC,0DAA+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,kCAAe,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;;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;
|
|
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;IAkB3B,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;
|
|
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;QAyBvC,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;IArDwD,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,CAAC,oDAA4B,CAAC,YAAY,CAAC,CAAC;YACtF,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;AA5DD,0EA4DC","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(ContainerTelemetryEventNames.DISCONNECTED);\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"]}
|
package/dist/factory/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { IFluidContainer } from "@fluidframework/fluid-static";
|
|
6
|
-
import {
|
|
6
|
+
import type { ITelemetryConsumer } from "../common/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* Configuration object for subscribing to {@link @fluidframework/fluid-telemetry#IFluidTelemetry} and consuming said telemetry via one or more {@link ITelemetryConsumer}
|
|
9
9
|
*
|
|
@@ -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,
|
|
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,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAM7D;;;;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;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,oDAG+B;AAyB/B;;;;;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 {\n\tContainerTelemetryManager,\n\tContainerEventTelemetryProducer,\n} 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"]}
|
package/dist/legacy.d.ts
CHANGED
|
@@ -10,19 +10,5 @@
|
|
|
10
10
|
|
|
11
11
|
export {
|
|
12
12
|
// @public APIs
|
|
13
|
-
ICriticalContainerError
|
|
14
|
-
|
|
15
|
-
// @beta APIs
|
|
16
|
-
AppInsightsTelemetryConsumer,
|
|
17
|
-
ContainerConnectedTelemetry,
|
|
18
|
-
ContainerDisconnectedTelemetry,
|
|
19
|
-
ContainerDisposedTelemetry,
|
|
20
|
-
ContainerTelemetryEventName,
|
|
21
|
-
ContainerTelemetryEventNames,
|
|
22
|
-
FluidTelemetryEventName,
|
|
23
|
-
IContainerTelemetry,
|
|
24
|
-
IFluidTelemetry,
|
|
25
|
-
ITelemetryConsumer,
|
|
26
|
-
TelemetryConfig,
|
|
27
|
-
startTelemetry
|
|
13
|
+
ICriticalContainerError
|
|
28
14
|
} from "./index.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import type { ApplicationInsights } from "@microsoft/applicationinsights-web";
|
|
6
6
|
import type { IFluidTelemetry, ITelemetryConsumer } from "../common/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appInsightsTelemetryConsumer.d.ts","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"appInsightsTelemetryConsumer.d.ts","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,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;
|
|
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"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import type { ICriticalContainerError } from "@fluidframework/container-definitions";
|
|
6
|
+
import type { IFluidTelemetry } from "../common/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* This file contains the types for container telemetry that can be produced.
|
|
9
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerTelemetry.d.ts","sourceRoot":"","sources":["../../src/container/containerTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"containerTelemetry.d.ts","sourceRoot":"","sources":["../../src/container/containerTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAErF,OAAO,KAAK,EAAE,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;
|
|
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"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { IFluidContainer } from "@fluidframework/fluid-static";
|
|
6
|
-
import {
|
|
6
|
+
import type { ITelemetryConsumer } from "../common/index.js";
|
|
7
7
|
import type { ContainerEventTelemetryProducer } from "./telemetryProducer.js";
|
|
8
8
|
/**
|
|
9
9
|
* This class manages container telemetry intended for customers to consume by wiring together the provided container system events, telemetry producers and consumers together.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetryManager.d.ts","sourceRoot":"","sources":["../../src/container/telemetryManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
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,KAAK,EAAE,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;
|
|
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;
|
|
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;IAkB3B,yBAAyB,QAAO,eAAe,CAMpD;IAEF,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAQ5C;IAEF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAYtC;CACF"}
|