mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
no longer filtering to well-known database sources (#22864)
This commit is contained in:
@@ -532,16 +532,6 @@ export const PublishProfileElements = localize('publishProfileElements', "Publis
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Well-known database source values that are allowed to be sent in telemetry.
|
||||
*
|
||||
* 'dsct-oracle-to-ms-sql' is the name of an extension which allows users to migrate from Oracle to Microsoft SQL platform.
|
||||
* When looking at telemetry, we would like to know if a built or deployed database originated from the DSCT extension.
|
||||
*/
|
||||
export const WellKnownDatabaseSources = ['dsct-oracle-to-ms-sql'];
|
||||
|
||||
export function defaultOutputPath(configuration: string) { return path.join('.', 'bin', configuration); }
|
||||
|
||||
/**
|
||||
|
||||
@@ -635,36 +635,6 @@ export function getFoldersAlongPath(startFolder: string, endFolder: string): str
|
||||
return folders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether provided value is a well-known database source and therefore is allowed to be sent in telemetry.
|
||||
*
|
||||
* @param value Value to check if it is a well-known database source
|
||||
* @returns Normalized database source value if it is well-known, otherwise returns undefined
|
||||
*/
|
||||
export function getWellKnownDatabaseSource(value: string): string | undefined {
|
||||
const upperCaseValue = value.toUpperCase();
|
||||
return constants.WellKnownDatabaseSources
|
||||
.find(wellKnownSource => wellKnownSource.toUpperCase() === upperCaseValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters an array of specified database project sources to only those that are well-known.
|
||||
*
|
||||
* @param databaseSourceValues Array of database source values to filter
|
||||
* @returns Array of well-known database sources
|
||||
*/
|
||||
export function getWellKnownDatabaseSources(databaseSourceValues: string[]): string[] {
|
||||
const databaseSourceSet = new Set<string>();
|
||||
for (let databaseSourceValue of databaseSourceValues) {
|
||||
const wellKnownDatabaseSourceValue = getWellKnownDatabaseSource(databaseSourceValue);
|
||||
if (wellKnownDatabaseSourceValue) {
|
||||
databaseSourceSet.add(wellKnownDatabaseSourceValue);
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(databaseSourceSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns SQL version number from docker image name which is in the beginning of the image name
|
||||
* @param imageName docker image name
|
||||
|
||||
@@ -321,7 +321,7 @@ export class ProjectsController {
|
||||
|
||||
TelemetryReporter.createActionEvent(TelemetryViews.ProjectController, TelemetryActions.build)
|
||||
.withAdditionalMeasurements({ duration: timeToBuild })
|
||||
.withAdditionalProperties({ databaseSource: utils.getWellKnownDatabaseSources(project.getDatabaseSourceValues()).join(';') })
|
||||
.withAdditionalProperties({ databaseSource: project.getDatabaseSourceValues().join(';') })
|
||||
.send();
|
||||
|
||||
return project.dacpacOutputPath;
|
||||
@@ -334,7 +334,7 @@ export class ProjectsController {
|
||||
|
||||
TelemetryReporter.createErrorEvent2(TelemetryViews.ProjectController, TelemetryActions.build, err)
|
||||
.withAdditionalMeasurements({ duration: timeToFailureBuild })
|
||||
.withAdditionalProperties({ databaseSource: utils.getWellKnownDatabaseSources(project.getDatabaseSourceValues()).join(';') })
|
||||
.withAdditionalProperties({ databaseSource: project.getDatabaseSourceValues().join(';') })
|
||||
.send();
|
||||
|
||||
const message = utils.getErrorMessage(err);
|
||||
@@ -518,7 +518,7 @@ export class ProjectsController {
|
||||
const buildEndTime = new Date().getTime();
|
||||
telemetryMeasures.buildDuration = buildEndTime - buildStartTime;
|
||||
telemetryProps.buildSucceeded = (dacpacPath !== '').toString();
|
||||
telemetryProps.databaseSource = utils.getWellKnownDatabaseSources(project.getDatabaseSourceValues()).join(';');
|
||||
telemetryProps.databaseSource = project.getDatabaseSourceValues().join(';');
|
||||
|
||||
if (!dacpacPath) {
|
||||
TelemetryReporter.createErrorEvent2(TelemetryViews.ProjectController, TelemetryActions.publishProject)
|
||||
|
||||
@@ -187,6 +187,11 @@ declare module 'sqldbproj' {
|
||||
*/
|
||||
addSqlCmdVariable(name: string, defaultValue: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Gets an array of all database sources specified in the project.
|
||||
*/
|
||||
getDatabaseSourceValues(): string[];
|
||||
|
||||
/**
|
||||
* Appends given database source to the DatabaseSource property element.
|
||||
* If property element does not exist, then new one will be created.
|
||||
|
||||
@@ -141,12 +141,5 @@ describe('Tests to verify utils functions', function (): void {
|
||||
should(utils.findSqlVersionInTargetPlatform('Azure SQL Database')).equals(undefined, 'invalid number returned for Azure SQL Database');
|
||||
should(utils.findSqlVersionInTargetPlatform('Azure Synapse SQL Pool')).equals(undefined, 'invalid number returned for Azure Synapse SQL Pool');
|
||||
});
|
||||
|
||||
it('Should only return well known database strings when getWellKnownDatabaseSources function is called', async function (): Promise<void> {
|
||||
const sources = ['test1', 'test2', 'test3', constants.WellKnownDatabaseSources[0]];
|
||||
|
||||
(utils.getWellKnownDatabaseSources(sources).length).should.equal(1);
|
||||
(utils.getWellKnownDatabaseSources(sources)[0]).should.equal(constants.WellKnownDatabaseSources[0]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user