Skip to content

Commit 2ad7b6e

Browse files
authored
Allow undefined for measurements (#203)
1 parent de8e93a commit 2ad7b6e

File tree

5 files changed

+44
-44
lines changed

5 files changed

+44
-44
lines changed

dist/telemetryReporter.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface TelemetryEventProperties {
77
}
88

99
export interface TelemetryEventMeasurements {
10-
readonly [key: string]: number;
10+
readonly [key: string]: number | undefined;
1111
}
1212

1313
/**

package-lock.json

Lines changed: 31 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@vscode/extension-telemetry",
33
"description": "A module for Visual Studio Code extensions to report consistent telemetry.",
4-
"version": "0.9.3",
4+
"version": "0.9.4",
55
"author": {
66
"name": "Microsoft Corporation"
77
},
@@ -20,9 +20,9 @@
2020
"compile": "tsc -p src/browser/tsconfig.json && tsc -p src/node/tsconfig.json"
2121
},
2222
"dependencies": {
23-
"@microsoft/1ds-core-js": "^4.1.0",
24-
"@microsoft/1ds-post-js": "^4.1.0",
25-
"@microsoft/applicationinsights-web-basic": "^3.1.0"
23+
"@microsoft/1ds-core-js": "^4.1.1",
24+
"@microsoft/1ds-post-js": "^4.1.1",
25+
"@microsoft/applicationinsights-web-basic": "^3.1.1"
2626
},
2727
"devDependencies": {
2828
"@types/mocha": "^10.0.3",

src/common/1dsClientFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const getAICore = async (key: string, vscodeAPI: typeof vscode, xhrOverride?: IX
5252
appInsightsCore.addTelemetryInitializer((envelope: any) => {
5353
envelope["ext"] = envelope["ext"] ?? {};
5454
envelope["ext"]["web"] = envelope["ext"]["web"] ?? {};
55-
envelope["ext"]["web"]["consentDetails"] = '{"GPC_DataSharingOptIn":false}';
55+
envelope["ext"]["web"]["consentDetails"] = "{\"GPC_DataSharingOptIn\":false}";
5656

5757
// Only add the remaining flags when `telemetry.internalTesting` is enabled
5858
if (!internalTesting) {

test/baseTelemetrySender.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,28 +75,28 @@ describe("Base telemetry sender test suite", () => {
7575
assert.strictEqual((telemetryClient.logEvent as sinon.SinonSpy).callCount, 1);
7676
sinon.assert.calledWithMatch(
7777
telemetryClient.logEvent as sinon.SinonSpy, "unhandlederror",
78-
{properties: {name: error.name, message: error.message, stack: error.stack}}
78+
{ properties: { name: error.name, message: error.message, stack: error.stack } }
7979
);
80-
})
80+
});
8181

8282
it("Error properties are correctly created for a data without properties field", () => {
8383
const error = new Error("test");
84-
sender.sendErrorData(error, {prop1: 1, prop2: "two"});
84+
sender.sendErrorData(error, { prop1: 1, prop2: "two" });
8585
assert.strictEqual((telemetryClient.logEvent as sinon.SinonSpy).callCount, 1);
8686
sinon.assert.calledWithMatch(
8787
telemetryClient.logEvent as sinon.SinonSpy, "unhandlederror",
88-
{properties: {prop1: 1, prop2: "two", name: error.name, message: error.message, stack: error.stack}}
88+
{ properties: { prop1: 1, prop2: "two", name: error.name, message: error.message, stack: error.stack } }
8989
);
9090
});
9191

9292
it("Error properties are correctly created for a data with properties field", () => {
9393
const error = new Error("uh oh");
94-
sender.sendErrorData(error, {properties: {prop1: 1, prop2: "two"}});
94+
sender.sendErrorData(error, { properties: { prop1: 1, prop2: "two" } });
9595
assert.strictEqual((telemetryClient.logEvent as sinon.SinonSpy).callCount, 1);
9696
sinon.assert.calledWithMatch(
9797
telemetryClient.logEvent as sinon.SinonSpy, "unhandlederror",
98-
{properties: {prop1: 1, prop2: "two", name: error.name, message: error.message, stack: error.stack}}
98+
{ properties: { prop1: 1, prop2: "two", name: error.name, message: error.message, stack: error.stack } }
9999
);
100100
});
101-
})
101+
});
102102
});

0 commit comments

Comments
 (0)