mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Add Azure Monitor Extension (#15397)
* Added Azure Log Analytics resource for generating AAD Token. * Fixed AzureResource * Removed debug code from connectionManagementService * Moved AzureLogAnalytics from AzureResource enum in azdata.d.ts to azdata.proposed.d.ts. Added azureLogAnalyticsResource to all azureSettings in providerSettings.ts * Updated endpoint for generating AAD Token for LogAnalytics for UsGov, UsNat, and China * Initial Commit of Azure Monitor Extension * Added extension name to azuremonitor package strings * Removed azureMonitor resource from germanyCloud in providerSettings * Added logic to exclude menuItems in object explorer for LogAnalytics * Changed exe from AzureMonitor to Kusto * Added if clause for queryName for new queries * Changed queryWindow name from KustoQuery to KQLQuery for Kusto and LogAnalytics. * Added LogAnalytics for setTaskBarContent * Added serialization and telemetry feature classes to AzureMonitor. Added references for azdata and vscode. * Added azure monitor light and dark icons * Added config for Dashboard in package.json * Added workspace information to dashboard * Added language support for LogAnalytics * Added Notebook support * Added Hide flag to package.json for databaseName * Changed providerId from LogAnalytics to LOGANALYTICS * Changed Workspace to Workspace ID in package.nls.json * Added support for Azure Widget browser * Changed fullName to use workspaceId when connecting * Changed providerId from alertsManagement to azureMonitor * Added .gitignore and *.vsix to vscodeignore. * Removed unused devDependencies * Code Review Feedback * Changed tsconfig.json to match Kusto and Sql * Changed package.json to match kusto package. * Changed tsconfig to validate unused params and implictAny. Changed existing code to satisfy build. * Fixed tsconfig to use the correct base class. * Added objectExplorerNodeProvider and all related classes. * Removed unused tmLanguage file * Added logic to to download extension from toolservice * Fixed launchArgs. Removed commented code from extension.ts. Changed config.json to use net5.0 * Added displayName to package.nls.json. Removed hide flag from databaseName. Other code review feedback. * Added readme info to AzureMonitor * Removed unused client-error-handler and ui-references files. Combined outputChannel in azuremonitorServer. Removed TODO from contextProvider. Renamed function in extension.ts. Removed unneeded 'use strict' from cancelableStream.ts. Removed second outputChannel from objectExplorerNodeProvider. * Removed unused files
This commit is contained in:
@@ -283,6 +283,11 @@
|
||||
"when": "viewItem == azure.resource.itemType.azureDataExplorer",
|
||||
"group": "inline"
|
||||
},
|
||||
{
|
||||
"command": "azure.resource.connectsqlserver",
|
||||
"when": "viewItem == azure.resource.itemType.azureMonitor",
|
||||
"group": "inline"
|
||||
},
|
||||
{
|
||||
"command": "azure.resource.startterminal",
|
||||
"when": "viewItem == azure.resource.itemType.account",
|
||||
|
||||
10
extensions/azurecore/resources/dark/azure_monitor_dark.svg
Normal file
10
extensions/azurecore/resources/dark/azure_monitor_dark.svg
Normal file
@@ -0,0 +1,10 @@
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6.16207 4.40796H5.45432V6.53124H6.16207V4.40796Z" fill="white"/>
|
||||
<path d="M7.5776 5.11572H6.86984V6.53124H7.5776V5.11572Z" fill="white"/>
|
||||
<path d="M8.9931 2.99243H8.28534V6.53123H8.9931V2.99243Z" fill="white"/>
|
||||
<path d="M3.68494 4.42278C3.6848 3.64991 3.91385 2.89435 4.34313 2.25167C4.77241 1.60899 5.38264 1.10804 6.09664 0.812175C6.81063 0.516314 7.59633 0.438831 8.35437 0.589524C9.1124 0.740218 9.80872 1.11232 10.3553 1.65877C10.9018 2.20522 11.2741 2.90148 11.4249 3.65948C11.5757 4.41749 11.4984 5.2032 11.2026 5.91726C10.9069 6.63131 10.4061 7.24162 9.76346 7.67102C9.12086 8.10042 8.36535 8.32961 7.59248 8.32961" stroke="white" stroke-miterlimit="10"/>
|
||||
<path d="M7.59248 8.32956H3.68494V4.42273" stroke="white" stroke-miterlimit="10"/>
|
||||
<path d="M2.62328 6.53125H0.5V8.65453H2.62328V6.53125Z" fill="white"/>
|
||||
<path d="M2.62328 9.36218H0.5V11.4855H2.62328V9.36218Z" fill="white"/>
|
||||
<path d="M5.45433 9.36218H3.33105V11.4855H5.45433V9.36218Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
10
extensions/azurecore/resources/light/azure_monitor_light.svg
Normal file
10
extensions/azurecore/resources/light/azure_monitor_light.svg
Normal file
@@ -0,0 +1,10 @@
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6.16207 4.40796H5.45432V6.53124H6.16207V4.40796Z" fill="#323130"/>
|
||||
<path d="M7.5776 5.11572H6.86984V6.53124H7.5776V5.11572Z" fill="#323130"/>
|
||||
<path d="M8.9931 2.99243H8.28534V6.53123H8.9931V2.99243Z" fill="#323130"/>
|
||||
<path d="M3.68494 4.42278C3.6848 3.64991 3.91385 2.89435 4.34313 2.25167C4.77241 1.60899 5.38264 1.10804 6.09664 0.812175C6.81063 0.516314 7.59633 0.438831 8.35437 0.589524C9.1124 0.740218 9.80872 1.11232 10.3553 1.65877C10.9018 2.20522 11.2741 2.90148 11.4249 3.65948C11.5757 4.41749 11.4984 5.2032 11.2026 5.91726C10.9069 6.63131 10.4061 7.24162 9.76346 7.67102C9.12086 8.10042 8.36535 8.32961 7.59248 8.32961" stroke="#323130" stroke-miterlimit="10"/>
|
||||
<path d="M7.59248 8.32956H3.68494V4.42273" stroke="#323130" stroke-miterlimit="10"/>
|
||||
<path d="M2.62328 6.53125H0.5V8.65453H2.62328V6.53125Z" fill="#323130"/>
|
||||
<path d="M2.62328 9.36218H0.5V11.4855H2.62328V9.36218Z" fill="#323130"/>
|
||||
<path d="M5.45433 9.36218H3.33105V11.4855H5.45433V9.36218Z" fill="#323130"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -24,6 +24,7 @@ declare module 'azureResource' {
|
||||
postgresServer = 'microsoft.dbforpostgresql/servers',
|
||||
azureArcService = 'microsoft.azuredata/datacontrollers',
|
||||
storageAccount = 'microsoft.storage/storageaccounts',
|
||||
logAnalytics = 'microsoft.operationalinsights/workspaces'
|
||||
}
|
||||
|
||||
export interface IAzureResourceProvider extends DataProvider {
|
||||
@@ -121,7 +122,7 @@ declare module 'azureResource' {
|
||||
proxyOverride: string,
|
||||
vCores: number,
|
||||
dnsZone: string,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ export enum AzureResourceItemType {
|
||||
azureDataExplorerContainer = 'azure.resource.itemType.azureDataExplorerContainer',
|
||||
azureDataExplorer = 'azure.resource.itemType.azureDataExplorer',
|
||||
sqlInstance = 'azure.resource.itemType.sqlInstance',
|
||||
message = 'azure.resource.itemType.message'
|
||||
message = 'azure.resource.itemType.message',
|
||||
azureMonitor = 'azure.resource.itemType.azureMonitor',
|
||||
azureMonitorContainer = 'azure.resource.itemType.azureMonitorContainer',
|
||||
}
|
||||
|
||||
export enum AzureResourceServiceNames {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ExtensionContext } from 'vscode';
|
||||
|
||||
import { azureResource } from 'azureResource';
|
||||
import { IAzureResourceService } from '../../interfaces';
|
||||
import { AzureMonitorTreeDataProvider as AzureMonitorTreeDataProvider } from './azuremonitorTreeDataProvider';
|
||||
|
||||
export class AzureMonitorProvider implements azureResource.IAzureResourceProvider {
|
||||
public constructor(
|
||||
private _service: IAzureResourceService<azureResource.AzureResourceDatabaseServer>,
|
||||
private _extensionContext: ExtensionContext
|
||||
) {
|
||||
}
|
||||
|
||||
public getTreeDataProvider(): azureResource.IAzureResourceTreeDataProvider {
|
||||
return new AzureMonitorTreeDataProvider(this._service, this._extensionContext);
|
||||
}
|
||||
|
||||
public get providerId(): string {
|
||||
return 'azure.resource.providers.azureMonitor';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { azureResource } from 'azureResource';
|
||||
import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase';
|
||||
|
||||
export interface AzureMonitorGraphData extends GraphData {
|
||||
properties: {
|
||||
fullyQualifiedDomainName: string;
|
||||
administratorLogin: string;
|
||||
uri: string;
|
||||
customerId: string
|
||||
};
|
||||
}
|
||||
|
||||
const instanceQuery = `where type == "${azureResource.AzureResourceType.logAnalytics}"`;
|
||||
|
||||
export class AzureMonitorResourceService extends ResourceServiceBase<AzureMonitorGraphData, azureResource.AzureResourceDatabaseServer> {
|
||||
|
||||
protected get query(): string {
|
||||
return instanceQuery;
|
||||
}
|
||||
|
||||
protected convertResource(resource: AzureMonitorGraphData): azureResource.AzureResourceDatabaseServer {
|
||||
return {
|
||||
id: resource.id,
|
||||
name: resource.name,
|
||||
fullName: resource.properties.customerId,
|
||||
loginName: '',
|
||||
defaultDatabaseName: '',
|
||||
subscription: {
|
||||
id: resource.subscriptionId,
|
||||
name: resource.subscriptionName
|
||||
},
|
||||
tenant: resource.tenantId,
|
||||
resourceGroup: resource.resourceGroup
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
|
||||
import { TreeItemCollapsibleState, ExtensionContext } from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
import { AzureResourceItemType } from '../../constants';
|
||||
import { generateGuid } from '../../utils';
|
||||
import { IAzureResourceService } from '../../interfaces';
|
||||
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
|
||||
import { azureResource } from 'azureResource';
|
||||
|
||||
export class AzureMonitorTreeDataProvider extends ResourceTreeDataProviderBase<azureResource.AzureResourceDatabaseServer> {
|
||||
private static readonly containerId = 'azure.resource.providers.AzureMonitorContainer';
|
||||
private static readonly containerLabel = localize('azure.resource.providers.AzureMonitorContainerLabel', "Azure Monitor Workspace");
|
||||
|
||||
public constructor(
|
||||
databaseServerService: IAzureResourceService<azureResource.AzureResourceDatabaseServer>,
|
||||
private _extensionContext: ExtensionContext
|
||||
) {
|
||||
super(databaseServerService);
|
||||
}
|
||||
|
||||
|
||||
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
|
||||
return {
|
||||
id: `LogAnalytics_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
|
||||
label: this.browseConnectionMode ? `${databaseServer.name} (${AzureMonitorTreeDataProvider.containerLabel}, ${databaseServer.subscription.name})` : databaseServer.name,
|
||||
iconPath: {
|
||||
dark: this._extensionContext.asAbsolutePath('resources/dark/azure_monitor_dark.svg'),
|
||||
light: this._extensionContext.asAbsolutePath('resources/light/azure_monitor_light.svg')
|
||||
},
|
||||
collapsibleState: this.browseConnectionMode ? TreeItemCollapsibleState.None : TreeItemCollapsibleState.Collapsed,
|
||||
contextValue: AzureResourceItemType.azureMonitor,
|
||||
payload: {
|
||||
id: generateGuid(),
|
||||
connectionName: undefined,
|
||||
serverName: databaseServer.fullName,
|
||||
databaseName: databaseServer.defaultDatabaseName,
|
||||
userName: databaseServer.loginName,
|
||||
password: '',
|
||||
authenticationType: 'AzureMFA',
|
||||
savePassword: true,
|
||||
groupFullName: '',
|
||||
groupId: '',
|
||||
providerName: 'LOGANALYTICS',
|
||||
saveProfile: false,
|
||||
options: {},
|
||||
azureAccount: account.key.accountId
|
||||
},
|
||||
childProvider: 'LOGANALYTICS',
|
||||
type: ExtensionNodeType.Server
|
||||
};
|
||||
}
|
||||
|
||||
protected createContainerNode(): azureResource.IAzureResourceNode {
|
||||
return {
|
||||
account: undefined,
|
||||
subscription: undefined,
|
||||
tenantId: undefined,
|
||||
treeItem: {
|
||||
id: AzureMonitorTreeDataProvider.containerId,
|
||||
label: AzureMonitorTreeDataProvider.containerLabel,
|
||||
iconPath: {
|
||||
dark: this._extensionContext.asAbsolutePath('resources/dark/folder_inverse.svg'),
|
||||
light: this._extensionContext.asAbsolutePath('resources/light/folder.svg')
|
||||
},
|
||||
collapsibleState: TreeItemCollapsibleState.Collapsed,
|
||||
contextValue: AzureResourceItemType.databaseServerContainer
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,8 @@ import { SqlInstanceResourceService } from './azureResource/providers/sqlinstanc
|
||||
import { SqlInstanceProvider } from './azureResource/providers/sqlinstance/sqlInstanceProvider';
|
||||
import { KustoResourceService } from './azureResource/providers/kusto/kustoService';
|
||||
import { KustoProvider } from './azureResource/providers/kusto/kustoProvider';
|
||||
import { AzureMonitorResourceService } from './azureResource/providers/azuremonitor/azuremonitorService';
|
||||
import { AzureMonitorProvider } from './azureResource/providers/azuremonitor/azuremonitorProvider';
|
||||
import { PostgresServerProvider } from './azureResource/providers/postgresServer/postgresServerProvider';
|
||||
import { PostgresServerService } from './azureResource/providers/postgresServer/postgresServerService';
|
||||
import { AzureTerminalService } from './azureResource/services/terminalService';
|
||||
@@ -156,6 +158,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<azurec
|
||||
const arcFeaturedEnabled = vscode.workspace.getConfiguration(constants.extensionConfigSectionName).get('enableArcFeatures');
|
||||
const providers: azureResource.IAzureResourceProvider[] = [
|
||||
new KustoProvider(new KustoResourceService(), extensionContext),
|
||||
new AzureMonitorProvider(new AzureMonitorResourceService(), extensionContext),
|
||||
new AzureResourceDatabaseServerProvider(new AzureResourceDatabaseServerService(), extensionContext),
|
||||
new AzureResourceDatabaseProvider(new AzureResourceDatabaseService(), extensionContext),
|
||||
new SqlInstanceProvider(new SqlInstanceResourceService(), extensionContext),
|
||||
|
||||
Reference in New Issue
Block a user