upgrade service downloader (#20703)

* use new service downloader

* update other extensions

* fix errors
This commit is contained in:
Alan Ren
2022-10-02 20:30:53 -07:00
committed by GitHub
parent 85dc506a3c
commit 1df976d79d
19 changed files with 88 additions and 70 deletions

View File

@@ -108,7 +108,7 @@
},
"dependencies": {
"@microsoft/ads-extension-telemetry": "^1.2.0",
"@microsoft/ads-service-downloader": "0.2.4",
"@microsoft/ads-service-downloader": "1.0.2",
"vscode-nls": "^4.1.2"
},
"devDependencies": {

View File

@@ -207,10 +207,10 @@
dependencies:
"@vscode/extension-telemetry" "^0.6.2"
"@microsoft/ads-service-downloader@0.2.4":
version "0.2.4"
resolved "https://registry.yarnpkg.com/@microsoft/ads-service-downloader/-/ads-service-downloader-0.2.4.tgz#905a11eb2da19673629852d9764fb9fb94ad81bd"
integrity sha512-3J0YjH29a5pP+5Yu0HF7itRBZpNOgUN34Gh/p0Py/TQr7qUzZSXwOM+fWD1nCea+q9t8mfHr0yuy0aeDX+33vQ==
"@microsoft/ads-service-downloader@1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@microsoft/ads-service-downloader/-/ads-service-downloader-1.0.2.tgz#76cc9a44074525ac65a6ea15f8b5ee7eac87efbe"
integrity sha512-Qpc5HNLywVZbSxeUC4S7d+VRAUddrYjkIfDXl76UwCA0iuwzi71RtciEgWfCWAZMm9CbKTIbtFGh4pYw+h81nQ==
dependencies:
async-retry "^1.2.3"
eventemitter2 "^5.0.1"

View File

@@ -5,14 +5,7 @@
"Windows_86": "win-x86-net5.0.zip",
"Windows_64": "win-x64-net5.0.zip",
"OSX": "osx-x64-net5.0.tar.gz",
"CentOS_7": "rhel-x64-net5.0.tar.gz",
"Debian_8": "rhel-x64-net5.0.tar.gz",
"Fedora_23": "rhel-x64-net5.0.tar.gz",
"OpenSUSE_13_2": "rhel-x64-net5.0.tar.gz",
"RHEL_7": "rhel-x64-net5.0.tar.gz",
"SLES_12_2": "rhel-x64-net5.0.tar.gz",
"Ubuntu_14": "rhel-x64-net5.0.tar.gz",
"Ubuntu_16": "rhel-x64-net5.0.tar.gz"
"Linux": "rhel-x64-net5.0.tar.gz"
},
"installDirectory": "../sqltoolsservice/{#platform#}/{#version#}",
"executableFiles": [

View File

@@ -212,7 +212,7 @@
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.0",
"figures": "^2.0.0",
"find-remove": "1.2.1",
"@microsoft/ads-service-downloader": "0.2.4",
"@microsoft/ads-service-downloader": "1.0.2",
"vscode-extension-telemetry": "0.4.2",
"vscode-languageclient": "5.2.1",
"vscode-nls": "^4.0.0"

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ServerProvider, IConfig, Events } from '@microsoft/ads-service-downloader';
import { ServerProvider, IConfig, Events, LogLevel } from '@microsoft/ads-service-downloader';
import { ServerOptions, TransportKind } from 'vscode-languageclient';
import * as Constants from './constants';
import * as vscode from 'vscode';
@@ -75,7 +75,7 @@ export class AzureMonitorServer {
this.config.strictSSL = vscode.workspace.getConfiguration('http').get('proxyStrictSSL') || true;
const serverdownloader = new ServerProvider(this.config);
serverdownloader.eventEmitter.onAny(() => generateHandleServerProviderEvent());
serverdownloader.eventEmitter.onAny(generateHandleServerProviderEvent());
return serverdownloader.getOrDownloadServer();
}
@@ -94,7 +94,7 @@ function generateServerOptions(logPath: string, executablePath: string): ServerO
function generateHandleServerProviderEvent() {
let dots = 0;
return (e: string, ...args: any[]) => {
return (e: string | string[], ...args: any[]) => {
switch (e) {
case Events.INSTALL_START:
outputChannel.show(true);
@@ -122,6 +122,11 @@ function generateHandleServerProviderEvent() {
outputChannel.appendLine('');
outputChannel.appendLine(localize('downloadServiceDoneChannelMsg', "Downloaded {0}", Constants.serviceName));
break;
case Events.LOG_EMITTED:
if (args[0] >= LogLevel.Warning) {
outputChannel.appendLine(args[1]);
}
break;
default:
console.error(`Unknown event from Server Provider ${e}`);
break;

View File

@@ -2,10 +2,10 @@
# yarn lockfile v1
"@microsoft/ads-service-downloader@0.2.4":
version "0.2.4"
resolved "https://registry.yarnpkg.com/@microsoft/ads-service-downloader/-/ads-service-downloader-0.2.4.tgz#905a11eb2da19673629852d9764fb9fb94ad81bd"
integrity sha512-3J0YjH29a5pP+5Yu0HF7itRBZpNOgUN34Gh/p0Py/TQr7qUzZSXwOM+fWD1nCea+q9t8mfHr0yuy0aeDX+33vQ==
"@microsoft/ads-service-downloader@1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@microsoft/ads-service-downloader/-/ads-service-downloader-1.0.2.tgz#76cc9a44074525ac65a6ea15f8b5ee7eac87efbe"
integrity sha512-Qpc5HNLywVZbSxeUC4S7d+VRAUddrYjkIfDXl76UwCA0iuwzi71RtciEgWfCWAZMm9CbKTIbtFGh4pYw+h81nQ==
dependencies:
async-retry "^1.2.3"
eventemitter2 "^5.0.1"

View File

@@ -6,16 +6,7 @@
"Windows_64": "win-x64.zip",
"Windows_86": "win-x86.zip",
"OSX": "osx.tar.gz",
"Linux_64": "linux-x64.tar.gz",
"CentOS_7": "linux-x64.tar.gz",
"Debian_8": "linux-x64.tar.gz",
"Fedora_23": "linux-x64.tar.gz",
"OpenSUSE_13_2": "linux-x64.tar.gz",
"RHEL_7": "linux-x64.tar.gz",
"SLES_12_2": "linux-x64.tar.gz",
"Ubuntu_14": "linux-x64.tar.gz",
"Ubuntu_16": "linux-x64.tar.gz",
"Ubuntu_18": "linux-x64.tar.gz"
"Linux": "linux-x64.tar.gz"
},
"installDirectory": "flatfileimportservice/{#platform#}/{#version#}",
"executableFiles": [

View File

@@ -79,7 +79,7 @@
"dependencies": {
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#0.3.0",
"htmlparser2": "^3.10.1",
"@microsoft/ads-service-downloader": "0.2.4",
"@microsoft/ads-service-downloader": "1.0.2",
"vscode-extension-telemetry": "0.4.2",
"vscode-nls": "^3.2.1"
},

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { SqlOpsDataClient, ClientOptions } from 'dataprotocol-client';
import { ServerProvider, Events } from '@microsoft/ads-service-downloader';
import { ServerProvider, Events, LogLevel } from '@microsoft/ads-service-downloader';
import { ServerOptions, TransportKind } from 'vscode-languageclient';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
@@ -137,6 +137,13 @@ export class ServiceClient {
case Events.ENTRY_EXTRACTED:
this.outputChannel.appendLine(localize('entryExtractedChannelMsg', "Extracted {0} ({1}/{2})", args[0], args[1], args[2]));
break;
case Events.LOG_EMITTED:
if (args[0] >= LogLevel.Warning) {
this.outputChannel.appendLine(args[1]);
}
break;
default:
break;
}
};
}

View File

@@ -182,10 +182,10 @@
resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd"
integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==
"@microsoft/ads-service-downloader@0.2.4":
version "0.2.4"
resolved "https://registry.yarnpkg.com/@microsoft/ads-service-downloader/-/ads-service-downloader-0.2.4.tgz#905a11eb2da19673629852d9764fb9fb94ad81bd"
integrity sha512-3J0YjH29a5pP+5Yu0HF7itRBZpNOgUN34Gh/p0Py/TQr7qUzZSXwOM+fWD1nCea+q9t8mfHr0yuy0aeDX+33vQ==
"@microsoft/ads-service-downloader@1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@microsoft/ads-service-downloader/-/ads-service-downloader-1.0.2.tgz#76cc9a44074525ac65a6ea15f8b5ee7eac87efbe"
integrity sha512-Qpc5HNLywVZbSxeUC4S7d+VRAUddrYjkIfDXl76UwCA0iuwzi71RtciEgWfCWAZMm9CbKTIbtFGh4pYw+h81nQ==
dependencies:
async-retry "^1.2.3"
eventemitter2 "^5.0.1"

View File

@@ -5,14 +5,7 @@
"Windows_86": "win-x86-net5.0.zip",
"Windows_64": "win-x64-net5.0.zip",
"OSX": "osx-x64-net5.0.tar.gz",
"CentOS_7": "rhel-x64-net5.0.tar.gz",
"Debian_8": "rhel-x64-net5.0.tar.gz",
"Fedora_23": "rhel-x64-net5.0.tar.gz",
"OpenSUSE_13_2": "rhel-x64-net5.0.tar.gz",
"RHEL_7": "rhel-x64-net5.0.tar.gz",
"SLES_12_2": "rhel-x64-net5.0.tar.gz",
"Ubuntu_14": "rhel-x64-net5.0.tar.gz",
"Ubuntu_16": "rhel-x64-net5.0.tar.gz"
"Linux": "rhel-x64-net5.0.tar.gz"
},
"installDirectory": "../sqltoolsservice/{#platform#}/{#version#}",
"executableFiles": [

View File

@@ -430,7 +430,7 @@
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.0",
"figures": "^2.0.0",
"find-remove": "1.2.1",
"@microsoft/ads-service-downloader": "0.2.4",
"@microsoft/ads-service-downloader": "1.0.2",
"vscode-extension-telemetry": "0.4.2",
"vscode-languageclient": "5.2.1",
"vscode-nls": "^4.0.0"

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ServerProvider, IConfig, Events } from '@microsoft/ads-service-downloader';
import { ServerProvider, IConfig, Events, LogLevel } from '@microsoft/ads-service-downloader';
import { ServerOptions, TransportKind } from 'vscode-languageclient';
import * as Constants from './constants';
import * as vscode from 'vscode';
@@ -73,7 +73,7 @@ export class KustoServer {
this.config.strictSSL = vscode.workspace.getConfiguration('http').get('proxyStrictSSL') || true;
const serverdownloader = new ServerProvider(this.config);
serverdownloader.eventEmitter.onAny(() => generateHandleServerProviderEvent());
serverdownloader.eventEmitter.onAny(generateHandleServerProviderEvent());
return serverdownloader.getOrDownloadServer();
}
@@ -92,7 +92,7 @@ function generateServerOptions(logPath: string, executablePath: string): ServerO
function generateHandleServerProviderEvent() {
let dots = 0;
return (e: string, ...args: any[]) => {
return (e: string | string[], ...args: any[]) => {
switch (e) {
case Events.INSTALL_START:
outputChannel.show(true);
@@ -120,6 +120,11 @@ function generateHandleServerProviderEvent() {
outputChannel.appendLine('');
outputChannel.appendLine(localize('downloadServiceDoneChannelMsg', "Downloaded {0}", Constants.serviceName));
break;
case Events.LOG_EMITTED:
if (args[0] >= LogLevel.Warning) {
outputChannel.appendLine(args[1]);
}
break;
default:
console.error(`Unknown event from Server Provider ${e}`);
break;

View File

@@ -2,10 +2,10 @@
# yarn lockfile v1
"@microsoft/ads-service-downloader@0.2.4":
version "0.2.4"
resolved "https://registry.yarnpkg.com/@microsoft/ads-service-downloader/-/ads-service-downloader-0.2.4.tgz#905a11eb2da19673629852d9764fb9fb94ad81bd"
integrity sha512-3J0YjH29a5pP+5Yu0HF7itRBZpNOgUN34Gh/p0Py/TQr7qUzZSXwOM+fWD1nCea+q9t8mfHr0yuy0aeDX+33vQ==
"@microsoft/ads-service-downloader@1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@microsoft/ads-service-downloader/-/ads-service-downloader-1.0.2.tgz#76cc9a44074525ac65a6ea15f8b5ee7eac87efbe"
integrity sha512-Qpc5HNLywVZbSxeUC4S7d+VRAUddrYjkIfDXl76UwCA0iuwzi71RtciEgWfCWAZMm9CbKTIbtFGh4pYw+h81nQ==
dependencies:
async-retry "^1.2.3"
eventemitter2 "^5.0.1"

View File

@@ -5,14 +5,7 @@
"Windows_86": "win-x86-net6.0.zip",
"Windows_64": "win-x64-net6.0.zip",
"OSX": "osx-x64-net6.0.tar.gz",
"CentOS_7": "rhel-x64-net6.0.tar.gz",
"Debian_8": "rhel-x64-net6.0.tar.gz",
"Fedora_23": "rhel-x64-net6.0.tar.gz",
"OpenSUSE_13_2": "rhel-x64-net6.0.tar.gz",
"RHEL_7": "rhel-x64-net6.0.tar.gz",
"SLES_12_2": "rhel-x64-net6.0.tar.gz",
"Ubuntu_14": "rhel-x64-net6.0.tar.gz",
"Ubuntu_16": "rhel-x64-net6.0.tar.gz"
"Linux": "rhel-x64-net6.0.tar.gz"
},
"installDirectory": "./sqltoolsservice/{#platform#}/{#version#}",
"executableFiles": ["MicrosoftSqlToolsServiceLayer.exe", "MicrosoftSqlToolsServiceLayer"],

View File

@@ -1332,7 +1332,7 @@
"find-remove": "1.2.1",
"request": "^2.88.0",
"request-light": "^0.3.0",
"@microsoft/ads-service-downloader": "0.2.4",
"@microsoft/ads-service-downloader": "1.0.2",
"stream-meter": "^1.0.4",
"through2": "^3.0.1",
"tough-cookie": "^3.0.1",

View File

@@ -3,12 +3,12 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IConfig, Events } from '@microsoft/ads-service-downloader';
import { IConfig, Events, LogLevel } from '@microsoft/ads-service-downloader';
import { ServerOptions, TransportKind } from 'vscode-languageclient';
import * as Constants from './constants';
import * as vscode from 'vscode';
import * as path from 'path';
import { getCommonLaunchArgsAndCleanupOldLogFiles, getOrDownloadServer, getParallelMessageProcessingConfig } from './utils';
import { getCommonLaunchArgsAndCleanupOldLogFiles, getConfigTracingLevel, getOrDownloadServer, getParallelMessageProcessingConfig, TracingLevel } from './utils';
import { Telemetry, LanguageClientErrorHandler } from './telemetry';
import { SqlOpsDataClient, ClientOptions } from 'dataprotocol-client';
import { TelemetryFeature, AgentServicesFeature, SerializationFeature, AccountFeature, SqlAssessmentServicesFeature, ProfilerFeature, TableDesignerFeature, ExecutionPlanServiceFeature } from './features';
@@ -32,6 +32,16 @@ const localize = nls.loadMessageBundle();
const outputChannel = vscode.window.createOutputChannel(Constants.serviceName);
const statusView = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
// The mapping between MSSQL log level and the service downloader log level.
const LogLevelMapping: { [key: string]: number } = {
[TracingLevel.All]: LogLevel.Verbose,
[TracingLevel.Critical]: LogLevel.Critical,
[TracingLevel.Error]: LogLevel.Error,
[TracingLevel.Information]: LogLevel.Information,
[TracingLevel.Verbose]: LogLevel.Verbose,
[TracingLevel.Warning]: LogLevel.Warning
};
export class SqlToolsServer {
private client: SqlOpsDataClient;
@@ -145,6 +155,14 @@ function handleServerProviderEvent(e: string, ...args: any[]): void {
case Events.ENTRY_EXTRACTED:
outputChannel.appendLine(localize('entryExtractedChannelMsg', "Extracted {0} ({1}/{2})", args[0], args[1], args[2]));
break;
case Events.LOG_EMITTED:
const configuredLevel: number | undefined = LogLevelMapping[getConfigTracingLevel()];
const logLevel = args[0] as LogLevel;
const message = args[1] as string;
if (configuredLevel !== undefined && logLevel >= configuredLevel) {
outputChannel.appendLine(message);
}
break;
}
}

View File

@@ -85,12 +85,25 @@ export function getConfigLogRetentionSeconds(): number {
}
}
export function getConfigTracingLevel(): string {
/**
* The tracing level defined in the package.json
*/
export enum TracingLevel {
All = 'All',
Off = 'Off',
Critical = 'Critical',
Error = 'Error',
Warning = 'Warning',
Information = 'Information',
Verbose = 'Verbose'
}
export function getConfigTracingLevel(): TracingLevel {
let config = getConfiguration();
if (config) {
return config[configTracingLevel];
} else {
return undefined;
return TracingLevel.Critical;
}
}

View File

@@ -189,10 +189,10 @@
dependencies:
nan "^2.14.0"
"@microsoft/ads-service-downloader@0.2.4":
version "0.2.4"
resolved "https://registry.yarnpkg.com/@microsoft/ads-service-downloader/-/ads-service-downloader-0.2.4.tgz#905a11eb2da19673629852d9764fb9fb94ad81bd"
integrity sha512-3J0YjH29a5pP+5Yu0HF7itRBZpNOgUN34Gh/p0Py/TQr7qUzZSXwOM+fWD1nCea+q9t8mfHr0yuy0aeDX+33vQ==
"@microsoft/ads-service-downloader@1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@microsoft/ads-service-downloader/-/ads-service-downloader-1.0.2.tgz#76cc9a44074525ac65a6ea15f8b5ee7eac87efbe"
integrity sha512-Qpc5HNLywVZbSxeUC4S7d+VRAUddrYjkIfDXl76UwCA0iuwzi71RtciEgWfCWAZMm9CbKTIbtFGh4pYw+h81nQ==
dependencies:
async-retry "^1.2.3"
eventemitter2 "^5.0.1"