@fluidframework/fluid-telemetry 2.0.0-dev-rc.3.0.0.253463 → 2.0.0-dev-rc.3.0.0.254513
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/README.md +1 -1
- package/api-report/fluid-telemetry.api.md +7 -0
- package/dist/app-insights/appInsightsTelemetryConsumer.d.ts +5 -0
- package/dist/app-insights/appInsightsTelemetryConsumer.d.ts.map +1 -1
- package/dist/app-insights/appInsightsTelemetryConsumer.js +5 -0
- package/dist/app-insights/appInsightsTelemetryConsumer.js.map +1 -1
- package/dist/fluid-telemetry-alpha.d.ts +16 -0
- package/dist/fluid-telemetry-beta.d.ts +16 -0
- package/dist/fluid-telemetry-public.d.ts +3 -0
- package/dist/fluid-telemetry-untrimmed.d.ts +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/lib/app-insights/appInsightsTelemetryConsumer.d.ts +5 -0
- package/lib/app-insights/appInsightsTelemetryConsumer.d.ts.map +1 -1
- package/lib/app-insights/appInsightsTelemetryConsumer.js +5 -0
- package/lib/app-insights/appInsightsTelemetryConsumer.js.map +1 -1
- package/lib/fluid-telemetry-alpha.d.ts +16 -0
- package/lib/fluid-telemetry-beta.d.ts +16 -0
- package/lib/fluid-telemetry-public.d.ts +3 -0
- package/lib/fluid-telemetry-untrimmed.d.ts +16 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/test/containerTelemetry.spec.d.ts +4 -0
- package/lib/test/containerTelemetry.spec.d.ts.map +1 -1
- package/lib/test/containerTelemetry.spec.js +4 -0
- package/lib/test/containerTelemetry.spec.js.map +1 -1
- package/package.json +8 -18
- package/src/app-insights/appInsightsTelemetryConsumer.ts +5 -0
- package/src/index.ts +1 -0
- package/api-report/external-telemetry.api.md +0 -68
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Before you can get telemetry sent to Azure App Insights, you'll need to create a
|
|
|
22
22
|
import { ApplicationInsights } from "@microsoft/applicationinsights-web";
|
|
23
23
|
import { IFluidContainer } from "@fluidframework/fluid-static";
|
|
24
24
|
import { ITelemetryConsumer , TelemetryConfig, startTelemetry, IFluidTelemetry } from "@fluidframework/fluid-telemetry"
|
|
25
|
-
import { AppInsightsTelemetryConsumer } from "@fluidframework/fluid-telemetry
|
|
25
|
+
import { AppInsightsTelemetryConsumer } from "@fluidframework/fluid-telemetry"
|
|
26
26
|
|
|
27
27
|
// 1: This is supposed to be your code for creating/loading a Fluid Container
|
|
28
28
|
let myAppContainer: IFluidContainer;
|
|
@@ -4,9 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
+
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
7
8
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
8
9
|
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
9
10
|
|
|
11
|
+
// @beta
|
|
12
|
+
export class AppInsightsTelemetryConsumer implements ITelemetryConsumer {
|
|
13
|
+
constructor(appInsightsClient: ApplicationInsights);
|
|
14
|
+
consume(event: IFluidTelemetry): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
// @beta
|
|
11
18
|
export interface ContainerConnectedTelemetry extends IContainerTelemetry {
|
|
12
19
|
eventName: "fluidframework.container.connected";
|
|
@@ -7,10 +7,15 @@ 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
|
|
9
9
|
* in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
10
12
|
*/
|
|
11
13
|
export declare class AppInsightsTelemetryConsumer implements ITelemetryConsumer {
|
|
12
14
|
private readonly appInsightsClient;
|
|
13
15
|
constructor(appInsightsClient: ApplicationInsights);
|
|
16
|
+
/**
|
|
17
|
+
* Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights
|
|
18
|
+
*/
|
|
14
19
|
consume(event: IFluidTelemetry): void;
|
|
15
20
|
}
|
|
16
21
|
//# sourceMappingURL=appInsightsTelemetryConsumer.d.ts.map
|
|
@@ -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
|
|
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"}
|
|
@@ -8,11 +8,16 @@ exports.AppInsightsTelemetryConsumer = void 0;
|
|
|
8
8
|
/**
|
|
9
9
|
* An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights
|
|
10
10
|
* in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.
|
|
11
|
+
*
|
|
12
|
+
* @beta
|
|
11
13
|
*/
|
|
12
14
|
class AppInsightsTelemetryConsumer {
|
|
13
15
|
constructor(appInsightsClient) {
|
|
14
16
|
this.appInsightsClient = appInsightsClient;
|
|
15
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights
|
|
20
|
+
*/
|
|
16
21
|
consume(event) {
|
|
17
22
|
this.appInsightsClient.trackEvent({
|
|
18
23
|
name: event.eventName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appInsightsTelemetryConsumer.js","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH
|
|
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"]}
|
|
@@ -3,9 +3,25 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
6
7
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
7
8
|
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights
|
|
12
|
+
* in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.
|
|
13
|
+
*
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export declare class AppInsightsTelemetryConsumer implements ITelemetryConsumer {
|
|
17
|
+
private readonly appInsightsClient;
|
|
18
|
+
constructor(appInsightsClient: ApplicationInsights);
|
|
19
|
+
/**
|
|
20
|
+
* Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights
|
|
21
|
+
*/
|
|
22
|
+
consume(event: IFluidTelemetry): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
/**
|
|
10
26
|
* The container "connected" telemetry event.
|
|
11
27
|
* 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.
|
|
@@ -3,9 +3,25 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
6
7
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
7
8
|
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights
|
|
12
|
+
* in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.
|
|
13
|
+
*
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export declare class AppInsightsTelemetryConsumer implements ITelemetryConsumer {
|
|
17
|
+
private readonly appInsightsClient;
|
|
18
|
+
constructor(appInsightsClient: ApplicationInsights);
|
|
19
|
+
/**
|
|
20
|
+
* Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights
|
|
21
|
+
*/
|
|
22
|
+
consume(event: IFluidTelemetry): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
/**
|
|
10
26
|
* The container "connected" telemetry event.
|
|
11
27
|
* 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.
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
6
7
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
7
8
|
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
8
9
|
|
|
10
|
+
/* Excluded from this release type: AppInsightsTelemetryConsumer */
|
|
11
|
+
|
|
9
12
|
/* Excluded from this release type: ContainerConnectedTelemetry */
|
|
10
13
|
|
|
11
14
|
/* Excluded from this release type: ContainerDisconnectedTelemetry */
|
|
@@ -3,9 +3,25 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
6
7
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
7
8
|
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights
|
|
12
|
+
* in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.
|
|
13
|
+
*
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export declare class AppInsightsTelemetryConsumer implements ITelemetryConsumer {
|
|
17
|
+
private readonly appInsightsClient;
|
|
18
|
+
constructor(appInsightsClient: ApplicationInsights);
|
|
19
|
+
/**
|
|
20
|
+
* Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights
|
|
21
|
+
*/
|
|
22
|
+
consume(event: IFluidTelemetry): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
/**
|
|
10
26
|
* The container "connected" telemetry event.
|
|
11
27
|
* 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.
|
package/dist/index.d.ts
CHANGED
|
@@ -9,5 +9,6 @@
|
|
|
9
9
|
export { type ICriticalContainerError } from "@fluidframework/container-definitions";
|
|
10
10
|
export { type IFluidTelemetry, type FluidTelemetryEventName, type ITelemetryConsumer, } from "./common/index.js";
|
|
11
11
|
export { type IContainerTelemetry, type ContainerTelemetryEventName, ContainerTelemetryEventNames, type ContainerConnectedTelemetry, type ContainerDisconnectedTelemetry, type ContainerDisposedTelemetry, } from "./container/index.js";
|
|
12
|
+
export { AppInsightsTelemetryConsumer } from "./app-insights/index.js";
|
|
12
13
|
export { startTelemetry, type TelemetryConfig } from "./factory/index.js";
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,4BAA4B,EAC5B,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,4BAA4B,EAC5B,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.startTelemetry = exports.ContainerTelemetryEventNames = void 0;
|
|
7
|
+
exports.startTelemetry = exports.AppInsightsTelemetryConsumer = exports.ContainerTelemetryEventNames = void 0;
|
|
8
8
|
var index_js_1 = require("./container/index.js");
|
|
9
9
|
Object.defineProperty(exports, "ContainerTelemetryEventNames", { enumerable: true, get: function () { return index_js_1.ContainerTelemetryEventNames; } });
|
|
10
|
-
var index_js_2 = require("./
|
|
11
|
-
Object.defineProperty(exports, "
|
|
10
|
+
var index_js_2 = require("./app-insights/index.js");
|
|
11
|
+
Object.defineProperty(exports, "AppInsightsTelemetryConsumer", { enumerable: true, get: function () { return index_js_2.AppInsightsTelemetryConsumer; } });
|
|
12
|
+
var index_js_3 = require("./factory/index.js");
|
|
13
|
+
Object.defineProperty(exports, "startTelemetry", { enumerable: true, get: function () { return index_js_3.startTelemetry; } });
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAYH,iDAO8B;AAJ7B,wHAAA,4BAA4B,OAAA;AAK7B,+CAA0E;AAAjE,0GAAA,cAAc,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This package provides an implementation and types for producing and consuming telemetry for Fluid Framework applications\n * @packageDocumentation\n */\nexport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nexport {\n\ttype IFluidTelemetry,\n\ttype FluidTelemetryEventName,\n\ttype ITelemetryConsumer,\n} from \"./common/index.js\";\nexport {\n\ttype IContainerTelemetry,\n\ttype ContainerTelemetryEventName,\n\tContainerTelemetryEventNames,\n\ttype ContainerConnectedTelemetry,\n\ttype ContainerDisconnectedTelemetry,\n\ttype ContainerDisposedTelemetry,\n} from \"./container/index.js\";\nexport { startTelemetry, type TelemetryConfig } from \"./factory/index.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAYH,iDAO8B;AAJ7B,wHAAA,4BAA4B,OAAA;AAK7B,oDAAuE;AAA9D,wHAAA,4BAA4B,OAAA;AACrC,+CAA0E;AAAjE,0GAAA,cAAc,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This package provides an implementation and types for producing and consuming telemetry for Fluid Framework applications\n * @packageDocumentation\n */\nexport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nexport {\n\ttype IFluidTelemetry,\n\ttype FluidTelemetryEventName,\n\ttype ITelemetryConsumer,\n} from \"./common/index.js\";\nexport {\n\ttype IContainerTelemetry,\n\ttype ContainerTelemetryEventName,\n\tContainerTelemetryEventNames,\n\ttype ContainerConnectedTelemetry,\n\ttype ContainerDisconnectedTelemetry,\n\ttype ContainerDisposedTelemetry,\n} from \"./container/index.js\";\nexport { AppInsightsTelemetryConsumer } from \"./app-insights/index.js\";\nexport { startTelemetry, type TelemetryConfig } from \"./factory/index.js\";\n"]}
|
|
@@ -7,10 +7,15 @@ 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
|
|
9
9
|
* in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
10
12
|
*/
|
|
11
13
|
export declare class AppInsightsTelemetryConsumer implements ITelemetryConsumer {
|
|
12
14
|
private readonly appInsightsClient;
|
|
13
15
|
constructor(appInsightsClient: ApplicationInsights);
|
|
16
|
+
/**
|
|
17
|
+
* Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights
|
|
18
|
+
*/
|
|
14
19
|
consume(event: IFluidTelemetry): void;
|
|
15
20
|
}
|
|
16
21
|
//# sourceMappingURL=appInsightsTelemetryConsumer.d.ts.map
|
|
@@ -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
|
|
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"}
|
|
@@ -5,11 +5,16 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights
|
|
7
7
|
* in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.
|
|
8
|
+
*
|
|
9
|
+
* @beta
|
|
8
10
|
*/
|
|
9
11
|
export class AppInsightsTelemetryConsumer {
|
|
10
12
|
constructor(appInsightsClient) {
|
|
11
13
|
this.appInsightsClient = appInsightsClient;
|
|
12
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights
|
|
17
|
+
*/
|
|
13
18
|
consume(event) {
|
|
14
19
|
this.appInsightsClient.trackEvent({
|
|
15
20
|
name: event.eventName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appInsightsTelemetryConsumer.js","sourceRoot":"","sources":["../../src/app-insights/appInsightsTelemetryConsumer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH
|
|
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"]}
|
|
@@ -3,9 +3,25 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
6
7
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
7
8
|
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights
|
|
12
|
+
* in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.
|
|
13
|
+
*
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export declare class AppInsightsTelemetryConsumer implements ITelemetryConsumer {
|
|
17
|
+
private readonly appInsightsClient;
|
|
18
|
+
constructor(appInsightsClient: ApplicationInsights);
|
|
19
|
+
/**
|
|
20
|
+
* Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights
|
|
21
|
+
*/
|
|
22
|
+
consume(event: IFluidTelemetry): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
/**
|
|
10
26
|
* The container "connected" telemetry event.
|
|
11
27
|
* 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.
|
|
@@ -3,9 +3,25 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
6
7
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
7
8
|
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights
|
|
12
|
+
* in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.
|
|
13
|
+
*
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export declare class AppInsightsTelemetryConsumer implements ITelemetryConsumer {
|
|
17
|
+
private readonly appInsightsClient;
|
|
18
|
+
constructor(appInsightsClient: ApplicationInsights);
|
|
19
|
+
/**
|
|
20
|
+
* Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights
|
|
21
|
+
*/
|
|
22
|
+
consume(event: IFluidTelemetry): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
/**
|
|
10
26
|
* The container "connected" telemetry event.
|
|
11
27
|
* 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.
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
6
7
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
7
8
|
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
8
9
|
|
|
10
|
+
/* Excluded from this release type: AppInsightsTelemetryConsumer */
|
|
11
|
+
|
|
9
12
|
/* Excluded from this release type: ContainerConnectedTelemetry */
|
|
10
13
|
|
|
11
14
|
/* Excluded from this release type: ContainerDisconnectedTelemetry */
|
|
@@ -3,9 +3,25 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
6
7
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
7
8
|
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights
|
|
12
|
+
* in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.
|
|
13
|
+
*
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export declare class AppInsightsTelemetryConsumer implements ITelemetryConsumer {
|
|
17
|
+
private readonly appInsightsClient;
|
|
18
|
+
constructor(appInsightsClient: ApplicationInsights);
|
|
19
|
+
/**
|
|
20
|
+
* Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights
|
|
21
|
+
*/
|
|
22
|
+
consume(event: IFluidTelemetry): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
/**
|
|
10
26
|
* The container "connected" telemetry event.
|
|
11
27
|
* 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.
|
package/lib/index.d.ts
CHANGED
|
@@ -9,5 +9,6 @@
|
|
|
9
9
|
export { type ICriticalContainerError } from "@fluidframework/container-definitions";
|
|
10
10
|
export { type IFluidTelemetry, type FluidTelemetryEventName, type ITelemetryConsumer, } from "./common/index.js";
|
|
11
11
|
export { type IContainerTelemetry, type ContainerTelemetryEventName, ContainerTelemetryEventNames, type ContainerConnectedTelemetry, type ContainerDisconnectedTelemetry, type ContainerDisposedTelemetry, } from "./container/index.js";
|
|
12
|
+
export { AppInsightsTelemetryConsumer } from "./app-insights/index.js";
|
|
12
13
|
export { startTelemetry, type TelemetryConfig } from "./factory/index.js";
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,4BAA4B,EAC5B,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,4BAA4B,EAC5B,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { ContainerTelemetryEventNames, } from "./container/index.js";
|
|
6
|
+
export { AppInsightsTelemetryConsumer } from "./app-insights/index.js";
|
|
6
7
|
export { startTelemetry } from "./factory/index.js";
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,EAGN,4BAA4B,GAI5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAwB,MAAM,oBAAoB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This package provides an implementation and types for producing and consuming telemetry for Fluid Framework applications\n * @packageDocumentation\n */\nexport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nexport {\n\ttype IFluidTelemetry,\n\ttype FluidTelemetryEventName,\n\ttype ITelemetryConsumer,\n} from \"./common/index.js\";\nexport {\n\ttype IContainerTelemetry,\n\ttype ContainerTelemetryEventName,\n\tContainerTelemetryEventNames,\n\ttype ContainerConnectedTelemetry,\n\ttype ContainerDisconnectedTelemetry,\n\ttype ContainerDisposedTelemetry,\n} from \"./container/index.js\";\nexport { startTelemetry, type TelemetryConfig } from \"./factory/index.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,EAGN,4BAA4B,GAI5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAwB,MAAM,oBAAoB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This package provides an implementation and types for producing and consuming telemetry for Fluid Framework applications\n * @packageDocumentation\n */\nexport { type ICriticalContainerError } from \"@fluidframework/container-definitions\";\nexport {\n\ttype IFluidTelemetry,\n\ttype FluidTelemetryEventName,\n\ttype ITelemetryConsumer,\n} from \"./common/index.js\";\nexport {\n\ttype IContainerTelemetry,\n\ttype ContainerTelemetryEventName,\n\tContainerTelemetryEventNames,\n\ttype ContainerConnectedTelemetry,\n\ttype ContainerDisconnectedTelemetry,\n\ttype ContainerDisposedTelemetry,\n} from \"./container/index.js\";\nexport { AppInsightsTelemetryConsumer } from \"./app-insights/index.js\";\nexport { startTelemetry, type TelemetryConfig } from \"./factory/index.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerTelemetry.spec.d.ts","sourceRoot":"","sources":["../../src/test/containerTelemetry.spec.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"containerTelemetry.spec.d.ts","sourceRoot":"","sources":["../../src/test/containerTelemetry.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerTelemetry.spec.js","sourceRoot":"","sources":["../../src/test/containerTelemetry.spec.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,MAAM,EAA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,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 */\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;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,CAAC;YAC3C,MAAM,E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B,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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/fluid-telemetry",
|
|
3
|
-
"version": "2.0.0-dev-rc.3.0.0.
|
|
3
|
+
"version": "2.0.0-dev-rc.3.0.0.254513",
|
|
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": {
|
|
@@ -52,33 +52,23 @@
|
|
|
52
52
|
"types": "./dist/index.d.ts",
|
|
53
53
|
"default": "./dist/index.js"
|
|
54
54
|
}
|
|
55
|
-
},
|
|
56
|
-
"./app-insights": {
|
|
57
|
-
"import": {
|
|
58
|
-
"types": "./lib/app-insights/index.d.ts",
|
|
59
|
-
"default": "./lib/app-insights/index.js"
|
|
60
|
-
},
|
|
61
|
-
"require": {
|
|
62
|
-
"types": "./dist/app-insights/index.d.ts",
|
|
63
|
-
"default": "./dist/app-insights/index.js"
|
|
64
|
-
}
|
|
65
55
|
}
|
|
66
56
|
},
|
|
67
57
|
"main": "dist/index.js",
|
|
68
58
|
"types": "dist/index.d.ts",
|
|
69
59
|
"dependencies": {
|
|
70
|
-
"@fluidframework/container-definitions": "2.0.0-dev-rc.3.0.0.
|
|
71
|
-
"@fluidframework/container-loader": "2.0.0-dev-rc.3.0.0.
|
|
72
|
-
"@fluidframework/fluid-static": "2.0.0-dev-rc.3.0.0.
|
|
60
|
+
"@fluidframework/container-definitions": "2.0.0-dev-rc.3.0.0.254513",
|
|
61
|
+
"@fluidframework/container-loader": "2.0.0-dev-rc.3.0.0.254513",
|
|
62
|
+
"@fluidframework/fluid-static": "2.0.0-dev-rc.3.0.0.254513",
|
|
73
63
|
"@microsoft/applicationinsights-web": "^2.8.11",
|
|
74
64
|
"uuid": "^9.0.0"
|
|
75
65
|
},
|
|
76
66
|
"devDependencies": {
|
|
77
67
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
78
|
-
"@fluid-internal/client-utils": "2.0.0-dev-rc.3.0.0.
|
|
79
|
-
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.3.0.0.
|
|
80
|
-
"@fluid-tools/build-cli": "^0.
|
|
81
|
-
"@fluidframework/build-tools": "^0.
|
|
68
|
+
"@fluid-internal/client-utils": "2.0.0-dev-rc.3.0.0.254513",
|
|
69
|
+
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.3.0.0.254513",
|
|
70
|
+
"@fluid-tools/build-cli": "^0.35.0",
|
|
71
|
+
"@fluidframework/build-tools": "^0.35.0",
|
|
82
72
|
"@microsoft/api-extractor": "^7.42.3",
|
|
83
73
|
"@types/chai": "^4.0.0",
|
|
84
74
|
"@types/mocha": "^9.1.1",
|
|
@@ -9,10 +9,15 @@ import type { IFluidTelemetry, ITelemetryConsumer } from "../common/index.js";
|
|
|
9
9
|
/**
|
|
10
10
|
* An implementation of {@link ITelemetryConsumer} that routes {@link IFluidTelemetry} to Azure App Insights
|
|
11
11
|
* in a format that is supported by Fluid Framework service offerings such as Cloud dashboards and alarms.
|
|
12
|
+
*
|
|
13
|
+
* @beta
|
|
12
14
|
*/
|
|
13
15
|
export class AppInsightsTelemetryConsumer implements ITelemetryConsumer {
|
|
14
16
|
public constructor(private readonly appInsightsClient: ApplicationInsights) {}
|
|
15
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Takes the incoming {@link IFluidTelemetry} and sends it to Azure App Insights
|
|
20
|
+
*/
|
|
16
21
|
public consume(event: IFluidTelemetry): void {
|
|
17
22
|
this.appInsightsClient.trackEvent({
|
|
18
23
|
name: event.eventName,
|
package/src/index.ts
CHANGED
|
@@ -21,4 +21,5 @@ export {
|
|
|
21
21
|
type ContainerDisconnectedTelemetry,
|
|
22
22
|
type ContainerDisposedTelemetry,
|
|
23
23
|
} from "./container/index.js";
|
|
24
|
+
export { AppInsightsTelemetryConsumer } from "./app-insights/index.js";
|
|
24
25
|
export { startTelemetry, type TelemetryConfig } from "./factory/index.js";
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
## API Report File for "@fluidframework/external-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 { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
8
|
-
import type { IFluidContainer } from '@fluidframework/fluid-static';
|
|
9
|
-
|
|
10
|
-
// @beta
|
|
11
|
-
export interface ContainerConnectedTelemetry extends IContainerTelemetry {
|
|
12
|
-
eventName: "fluidframework.container.connected";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// @beta
|
|
16
|
-
export interface ContainerDisconnectedTelemetry extends IContainerTelemetry {
|
|
17
|
-
eventName: "fluidframework.container.disconnected";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// @beta
|
|
21
|
-
export interface ContainerDisposedTelemetry extends IContainerTelemetry {
|
|
22
|
-
error?: ICriticalContainerError;
|
|
23
|
-
eventName: "fluidframework.container.disposed";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// @beta
|
|
27
|
-
export type ContainerTelemetryEventName = (typeof ContainerTelemetryEventNames)[keyof typeof ContainerTelemetryEventNames];
|
|
28
|
-
|
|
29
|
-
// @beta
|
|
30
|
-
export const ContainerTelemetryEventNames: {
|
|
31
|
-
readonly CONNECTED: "fluidframework.container.connected";
|
|
32
|
-
readonly DISCONNECTED: "fluidframework.container.disconnected";
|
|
33
|
-
readonly DISPOSED: "fluidframework.container.disposed";
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// @beta
|
|
37
|
-
export type FluidTelemetryEventName = ContainerTelemetryEventName;
|
|
38
|
-
|
|
39
|
-
// @beta
|
|
40
|
-
export interface IContainerTelemetry extends IFluidTelemetry {
|
|
41
|
-
containerId?: string;
|
|
42
|
-
containerInstanceId: string;
|
|
43
|
-
eventName: ContainerTelemetryEventName;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// @beta
|
|
47
|
-
export interface IFluidTelemetry {
|
|
48
|
-
eventName: FluidTelemetryEventName;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// @beta
|
|
52
|
-
export interface ITelemetryConsumer {
|
|
53
|
-
consume(event: IFluidTelemetry): any;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// @beta
|
|
57
|
-
export const startTelemetry: (config: TelemetryConfig) => void;
|
|
58
|
-
|
|
59
|
-
// @beta
|
|
60
|
-
export interface TelemetryConfig {
|
|
61
|
-
consumers: ITelemetryConsumer[];
|
|
62
|
-
container: IFluidContainer;
|
|
63
|
-
containerId: string;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// (No @packageDocumentation comment for this package)
|
|
67
|
-
|
|
68
|
-
```
|