diff --git a/packages/cli/src/userInteraction.ts b/packages/cli/src/userInteraction.ts index cfecb4e033..5a25bc2952 100644 --- a/packages/cli/src/userInteraction.ts +++ b/packages/cli/src/userInteraction.ts @@ -474,7 +474,7 @@ class CLIUserInteraction implements UserInteraction { const newConfig: InputTextConfig = { name: config.name, title: config.title, - default: (config.default as string) || "./", + default: config.default as string, validation: config.validation || pathValidation, }; return this.inputText(newConfig); diff --git a/packages/fx-core/src/component/utils/envFunctionUtils.ts b/packages/fx-core/src/component/utils/envFunctionUtils.ts index d06e231553..cadf18d179 100644 --- a/packages/fx-core/src/component/utils/envFunctionUtils.ts +++ b/packages/fx-core/src/component/utils/envFunctionUtils.ts @@ -20,7 +20,7 @@ import { DriverContext } from "../driver/interface/commonArgs"; const source = "ResolveManifestFunction"; const telemetryEvent = "manifest-with-function"; -const helpLink = undefined; // TODO: update link +const helpLink = "https://aka.ms/teamsfx-customize-manifest"; enum TelemetryPropertyKey { manifestType = "manifest-type", diff --git a/packages/fx-core/src/core/FxCore.ts b/packages/fx-core/src/core/FxCore.ts index 1c6cab1977..78b3062433 100644 --- a/packages/fx-core/src/core/FxCore.ts +++ b/packages/fx-core/src/core/FxCore.ts @@ -19,9 +19,6 @@ import { CreateProjectResult, CryptoProvider, DefaultApiSpecFolderName, - DefaultApiSpecJsonFileName, - DefaultApiSpecYamlFileName, - DefaultPluginManifestFileName, Func, FxError, IGenerator, @@ -42,7 +39,6 @@ import { import { DotenvParseOutput } from "dotenv"; import fs from "fs-extra"; import * as jsonschema from "jsonschema"; -import { OpenAPIV3 } from "openapi-types"; import * as os from "os"; import * as path from "path"; import "reflect-metadata"; @@ -64,7 +60,7 @@ import { isValidProjectV3, } from "../common/projectSettingsHelper"; import { ProjectTypeResult, projectTypeChecker } from "../common/projectTypeChecker"; -import { TelemetryEvent, TelemetryProperty, telemetryUtils } from "../common/telemetry"; +import { TelemetryEvent, telemetryUtils } from "../common/telemetry"; import { MetadataV3, VersionSource, VersionState } from "../common/versionMetadata"; import { ActionInjector } from "../component/configManager/actionInjector"; import { ILifecycle, LifecycleName } from "../component/configManager/interface"; @@ -1741,7 +1737,7 @@ export class FxCore { manifestPath, inputs, context, - CoreTelemetryComponentName, + "copilotPluginAddAPI", isPlugin ? ProjectType.Copilot : ProjectType.SME, { destinationApiSpecFilePath: outputApiSpecPath, @@ -1943,7 +1939,7 @@ export class FxCore { teamsManifestPath, inputs, context, - CoreTelemetryComponentName, + Stage.addPlugin, ProjectType.Copilot, { destinationApiSpecFilePath: destinationApiSpecPath, diff --git a/packages/vscode-extension/src/telemetry/vscodeTelemetryReporter.ts b/packages/vscode-extension/src/telemetry/vscodeTelemetryReporter.ts index 8f28453463..ee1e4d5d1e 100644 --- a/packages/vscode-extension/src/telemetry/vscodeTelemetryReporter.ts +++ b/packages/vscode-extension/src/telemetry/vscodeTelemetryReporter.ts @@ -94,7 +94,9 @@ export class VSCodeTelemetryReporter extends vscode.Disposable implements Teleme } this.checkAndOverwriteSharedProperty(properties); - properties[TelemetryProperty.CorrelationId] = Correlator.getId(); + if (properties[TelemetryProperty.CorrelationId] == undefined) { + properties[TelemetryProperty.CorrelationId] = Correlator.getId(); + } const featureFlags = featureFlagManager.listEnabled(); properties[TelemetryProperty.FeatureFlags] = featureFlags ? featureFlags.join(";") : ""; diff --git a/packages/vscode-extension/test/extTelemetry/vscodeTelemetryReporter.test.ts b/packages/vscode-extension/test/extTelemetry/vscodeTelemetryReporter.test.ts index ffda3af7f0..cd55bd1d80 100644 --- a/packages/vscode-extension/test/extTelemetry/vscodeTelemetryReporter.test.ts +++ b/packages/vscode-extension/test/extTelemetry/vscodeTelemetryReporter.test.ts @@ -17,11 +17,11 @@ describe("vscodeTelemetryReporter", () => { let tester: VSCodeTelemetryReporter; const sandbox = sinon.createSandbox(); const reporterStub = new MockTelemetryReporter(); - const sendTelemetryErrorEventSpy = sandbox.spy(reporterStub, "sendTelemetryErrorEvent"); - const sendTelemetryEventSpy = sandbox.spy(reporterStub, "sendTelemetryEvent"); - const sendTelemetryExceptionSpy = sandbox.spy(reporterStub, "sendTelemetryException"); + let sendTelemetryEventSpy: sinon.SinonSpy; + let sendTelemetryExceptionSpy: sinon.SinonSpy; + let sendTelemetryErrorEventSpy: sinon.SinonSpy; - before(() => { + beforeEach(() => { tester = new VSCodeTelemetryReporter( "test", "1.0.0-rc.1", @@ -32,9 +32,13 @@ describe("vscodeTelemetryReporter", () => { tester.addSharedProperty("programming-language", ""); tester.addSharedProperty("host-type", ""); tester.addSharedProperty("is-from-sample", ""); + + sendTelemetryEventSpy = sandbox.spy(reporterStub, "sendTelemetryEvent"); + sendTelemetryExceptionSpy = sandbox.spy(reporterStub, "sendTelemetryException"); + sendTelemetryErrorEventSpy = sandbox.spy(reporterStub, "sendTelemetryErrorEvent"); }); - after(() => { + afterEach(() => { tester.dispose(); sandbox.restore(); }); @@ -90,6 +94,35 @@ describe("vscodeTelemetryReporter", () => { ); }); + it("sendTelemetryErrorEvent: not overwrite correlationId if existing", () => { + tester.sendTelemetryErrorEvent( + "sampleErrorEvent", + { + stringProp: "some string", + "error-stack": "some user stack trace at (C:/fake_path/fake_file:1:1)", + "correlation-id": "fakeId", + }, + { numericMeasure: 123 }, + ["error-stack"] + ); + + sinon.assert.calledOnceWithMatch( + sendTelemetryErrorEventSpy, + "sampleErrorEvent", + { + stringProp: "some string", + "error-stack": "some user stack trace at (/fake_file:1:1)", + "project-id": "", + "correlation-id": "fakeId", + "feature-flags": featureFlags, + "programming-language": "", + "host-type": "", + "is-from-sample": "", + }, + { numericMeasure: 123 } + ); + }); + it("sendTelemetryException", () => { const error = new Error("error for test"); tester.sendTelemetryException(error, { stringProp: "some string" }, { numericMeasure: 123 });