Forward integration master to master2 (#335)

* Handle the case where Kusto cluster is already follower in region mappings (#312)

Updated the Kusto Query to remove follower from the returned data. We add it manually and store it in respective dictionaries.

* Create Nuget Packages (#317)

* Increment package versions

* Directory "build" was being created two parent directories above, instead of inside the repo

* Fix unnecessary recurring refresh of models (#320)

* Geomaster and AppLens both sending slightly different hostnames in th… (#318)

* Geomaster and AppLens both sending slightly different hostnames in the requets headers. Uri.TryCreate is failing to create URI due to hostname from geomaster missing the HTTP(S) scheme.

* Fix NullReferenceException

* Sync Repo With Corext Current Versions (#322)

* Increment package versions

* Directory "build" was being created two parent directories above, instead of inside the repo

* Increased versions over current corext.config versions

* Revert build script to the original release paths. Seems to be a disrecpancy between dotnet CLI version 3.0 and 2.1

* Update nuget version

* Prevent RuntimeHost From Creating Non-Existent Observer Routes (#324)

* Point diag role to liberated search service (#330)

* Runtime host in diag role should use liberation search service

* Search config changes for diag role

* Publishing AI projects not required for diag role

* Update master branch with latest search code (#331)

* Update master branch with latest search code

* Put appsettings to gitignore

* Remove faulty change from integration

* Remove faulty change from integration
This commit is contained in:
SharmaAjay19 2019-11-15 17:38:49 -08:00 коммит произвёл GitHub
Родитель 7004b6b6b2
Коммит e3ff4ebe32
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 103 добавлений и 153 удалений

Просмотреть файл

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>antares.external.diagnostics.compilerhost</id>
<version>1.0.22</version>
<version>1.0.24</version>
<authors>Ajay Sharma</authors>
<owners>ajsharm</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>

Просмотреть файл

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>antares.external.diagnostics.runtimehost</id>
<version>1.0.23</version>
<version>1.0.25</version>
<authors>Ajay Sharma</authors>
<owners>ajsharm</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>

Просмотреть файл

@ -16,7 +16,7 @@ echo\
echo\
echo "------------------- Publishing Compiler Host to build directory -------------------"
echo\
dotnet publish src\\Diagnostics.CompilerHost\\Diagnostics.CompilerHost.csproj -c Release -o build\\antares.external.diagnostics.compilerhost.1.0.0
dotnet publish src\\Diagnostics.CompilerHost\\Diagnostics.CompilerHost.csproj -c Release -o ..\\..\\build\\antares.external.diagnostics.compilerhost.1.0.0
IF %ERRORLEVEL% NEQ 0 (
echo "Diagnostics.CompilerHost Publish Failed."
@ -28,12 +28,8 @@ echo\
echo\
echo "------------------- Publishing Runtime Host to build directory -------------------"
echo\
dotnet publish src\\Diagnostics.RuntimeHost\\Diagnostics.RuntimeHost.csproj -c Release -o build\\antares.external.diagnostics.runtimehost.1.0.0
dotnet publish src\\Diagnostics.RuntimeHost\\Diagnostics.RuntimeHost.csproj -c Release -o ..\\..\\build\\antares.external.diagnostics.runtimehost.1.0.0
echo\
echo "------------------- Publishing AI Projects to build directory --------------------"
echo\
echo D | xcopy /E /Y /exclude:src\\Diagnostics.AIProjects\\excludeFromPublish.txt src\\Diagnostics.AIProjects build\\antares.external.diagnostics.aiprojects.1.0.0
IF %ERRORLEVEL% NEQ 0 (
echo "Diagnostics.RuntimeHost Publish Failed."

Просмотреть файл

@ -0,0 +1,10 @@
{
"debug": true,
"STORAGE_ACCOUNT_NAME": "__STORAGE_ACCOUNT_NAME__",
"STORAGE_ACCOUNT_KEY": "__STORAGE_ACCOUNT_KEY__",
"STORAGE_ACCOUNT_CONTAINER_NAME": "__STORAGE_ACCOUNT_CONTAINER_NAME__",
"DETECTORS_URL": "__RUNTIMEHOST_URL__/internal/detectors",
"DETECTORS_CLIENT_ID": "__DETECTORS_CLIENT_ID__",
"DETECTORS_CLIENT_SECRET": "__DETECTORS_CLIENT_SECRET__",
"DETECTORS_APP_RESOURCE": "__DETECTORS_APP_RESOURCE__"
}

Просмотреть файл

@ -220,18 +220,8 @@ namespace Diagnostics.DataProviders
public abstract Task<dynamic> GetSitesInServerFarmAsync(string subscriptionId, string serverFarmName);
public abstract Task<JObject> GetAppServiceEnvironmentDetailsAsync(string hostingEnvironmentName);
public abstract Task<IEnumerable<object>> GetAppServiceEnvironmentDeploymentsAsync(string hostingEnvironmentName);
public abstract Task<JObject> GetAdminSitesBySiteNameAsync(string stampName, string siteName);
public abstract Task<JObject> GetAdminSitesByHostNameAsync(string stampName, string[] hostNames);
public abstract Task<JArray> GetAdminSitesAsync(string siteName);
public abstract Task<string> GetStorageVolumeForSiteAsync(string stampName, string siteName);
public abstract Task<Dictionary<string, List<RuntimeSitenameTimeRange>>> GetRuntimeSiteSlotMap(string stampName, string siteName);
public abstract Task<Dictionary<string, List<RuntimeSitenameTimeRange>>> GetRuntimeSiteSlotMap(string stampName, string siteName, string slotName);

Просмотреть файл

@ -36,7 +36,7 @@ namespace Diagnostics.DataProviders
_geoMasterHostName = string.IsNullOrWhiteSpace(context.GeomasterHostName) ? context.Configuration.GeoMasterConfiguration.GeoEndpointAddress : context.GeomasterHostName;
_configuration = context.Configuration.GeoMasterConfiguration;
_geoMasterClient = InitClient();
GeoMasterName = string.IsNullOrWhiteSpace(context.GeomasterName) ? ParseGeoMasterName(_geoMasterHostName) : null;
GeoMasterName = string.IsNullOrWhiteSpace(context.GeomasterName) ? ParseGeoMasterName(_geoMasterHostName) : context.GeomasterName;
}
private IGeoMasterClient InitClient()
@ -659,6 +659,11 @@ namespace Diagnostics.DataProviders
{
string geoMasterName = null;
if (!string.IsNullOrWhiteSpace(geomasterHostName) && !geomasterHostName.StartsWith(Uri.UriSchemeHttp, StringComparison.CurrentCultureIgnoreCase))
{
geomasterHostName = $"{Uri.UriSchemeHttps}://{geomasterHostName}";
}
if (Uri.TryCreate(geomasterHostName, UriKind.Absolute, out Uri geomasterHostNameUri))
{
geoMasterName = geomasterHostNameUri.Host.Split(new char[] { '.' }).First();

Просмотреть файл

@ -30,24 +30,14 @@ namespace Diagnostics.DataProviders
Task<dynamic> GetSitesInServerFarmAsync(string subscriptionId, string serverFarmName);
Task<JObject> GetAppServiceEnvironmentDetailsAsync(string hostingEnvironmentName);
Task<dynamic> GetHostingEnvironmentPostBody(string hostingEnvironmentName);
Task<IEnumerable<object>> GetAppServiceEnvironmentDeploymentsAsync(string hostingEnvironmentName);
Task<string> GetStampName(string subscriptionId, string resourceGroupName, string siteName);
Task<dynamic> GetHostNames(string stampName, string siteName);
Task<dynamic> GetSitePostBody(string stampName, string siteName);
Task<JObject> GetAdminSitesBySiteNameAsync(string stampName, string siteName);
Task<JObject> GetAdminSitesByHostNameAsync(string stampName, string[] hostNames);
Task<string> GetStorageVolumeForSiteAsync(string stampName, string siteName);
Task<Dictionary<string, List<RuntimeSitenameTimeRange>>> GetRuntimeSiteSlotMap(string stampName, string siteName);
Task<Dictionary<string, List<RuntimeSitenameTimeRange>>> GetRuntimeSiteSlotMap(string stampName, string siteName, string slotName);

Просмотреть файл

@ -157,31 +157,6 @@ namespace Diagnostics.DataProviders
throw new NotImplementedException();
}
public override Task<JObject> GetAppServiceEnvironmentDetailsAsync(string hostingEnvironmentName)
{
throw new NotImplementedException();
}
public override Task<IEnumerable<object>> GetAppServiceEnvironmentDeploymentsAsync(string hostingEnvironmentName)
{
throw new NotImplementedException();
}
public override Task<JObject> GetAdminSitesBySiteNameAsync(string stampName, string siteName)
{
throw new NotImplementedException();
}
public override Task<JObject> GetAdminSitesByHostNameAsync(string stampName, string[] hostNames)
{
throw new NotImplementedException();
}
public override Task<string> GetStorageVolumeForSiteAsync(string stampName, string siteName)
{
throw new NotImplementedException();
}
public override HttpClient GetObserverClient()
{
return new MockHttpClient();

Просмотреть файл

@ -19,22 +19,10 @@ namespace Diagnostics.DataProviders
{
}
public override Task<JObject> GetAdminSitesByHostNameAsync(string stampName, string[] hostNames)
{
throw new NotImplementedException();
}
public override Task<JObject> GetAdminSitesBySiteNameAsync(string stampName, string siteName)
{
throw new NotImplementedException();
}
public override async Task<JArray> GetAdminSitesAsync(string siteName)
{
if (string.IsNullOrWhiteSpace(siteName))
{
throw new ArgumentNullException(nameof(siteName));
}
var path = $"sites/{siteName}/adminsites";
@ -48,18 +36,13 @@ namespace Diagnostics.DataProviders
return siteObject;
}
public override Task<IEnumerable<object>> GetAppServiceEnvironmentDeploymentsAsync(string hostingEnvironmentName)
{
throw new NotImplementedException();
}
public override Task<JObject> GetAppServiceEnvironmentDetailsAsync(string hostingEnvironmentName)
{
throw new NotImplementedException();
}
public override async Task<dynamic> GetCertificatesInResourceGroupAsync(string subscriptionName, string resourceGroupName)
{
if (string.IsNullOrWhiteSpace(subscriptionName))
throw new ArgumentNullException(nameof(subscriptionName));
if (string.IsNullOrWhiteSpace(resourceGroupName))
throw new ArgumentNullException(nameof(resourceGroupName));
var result = await Get($"subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/certificates");
return JsonConvert.DeserializeObject(result);
}
@ -71,21 +54,16 @@ namespace Diagnostics.DataProviders
public override async Task<Dictionary<string, List<RuntimeSitenameTimeRange>>> GetRuntimeSiteSlotMap(string stampName, string siteName, string slotName = null)
{
if (string.IsNullOrWhiteSpace(stampName))
{
throw new ArgumentNullException(nameof(stampName));
}
if (string.IsNullOrWhiteSpace(siteName))
{
throw new ArgumentNullException(nameof(siteName));
}
return await GetRuntimeSiteSlotMapInternal(stampName, siteName, slotName);
}
private async Task<Dictionary<string, List<RuntimeSitenameTimeRange>>> GetRuntimeSiteSlotMapInternal(string stampName, string siteName, string slotName)
{
if (string.IsNullOrWhiteSpace(stampName))
throw new ArgumentNullException(nameof(stampName));
if (string.IsNullOrWhiteSpace(siteName))
throw new ArgumentNullException(nameof(siteName));
var result = await GetObserverResource($"stamps/{stampName}/sites/{siteName}/runtimesiteslotmap");
var slotTimeRangeCaseSensitiveDictionary = JsonConvert.DeserializeObject<Dictionary<string, List<RuntimeSitenameTimeRange>>>(result);
var slotTimeRange = new Dictionary<string, List<RuntimeSitenameTimeRange>>(slotTimeRangeCaseSensitiveDictionary, StringComparer.CurrentCultureIgnoreCase);
@ -115,44 +93,72 @@ namespace Diagnostics.DataProviders
public override async Task<dynamic> GetServerFarmsInResourceGroupAsync(string subscriptionName, string resourceGroupName)
{
if (string.IsNullOrWhiteSpace(subscriptionName))
throw new ArgumentNullException(nameof(subscriptionName));
if (string.IsNullOrWhiteSpace(resourceGroupName))
throw new ArgumentNullException(nameof(resourceGroupName));
var result = await Get($"subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/serverfarms");
return JsonConvert.DeserializeObject(result);
}
public override async Task<string> GetServerFarmWebspaceName(string subscriptionId, string serverFarm)
{
if (string.IsNullOrWhiteSpace(subscriptionId))
throw new ArgumentNullException(nameof(subscriptionId));
if (string.IsNullOrWhiteSpace(serverFarm))
throw new ArgumentNullException(nameof(serverFarm));
return await Get($"subscriptionid/{subscriptionId}/serverfarm/{serverFarm}/webspacename");
}
public override async Task<string> GetSiteResourceGroupNameAsync(string siteName)
{
if (string.IsNullOrWhiteSpace(siteName))
throw new ArgumentNullException(nameof(siteName));
return await Get($"sites/{siteName}/resourcegroupname");
}
public override async Task<dynamic> GetSitesInResourceGroupAsync(string subscriptionName, string resourceGroupName)
{
if (string.IsNullOrWhiteSpace(subscriptionName))
throw new ArgumentNullException(nameof(subscriptionName));
if (string.IsNullOrWhiteSpace(resourceGroupName))
throw new ArgumentNullException(nameof(resourceGroupName));
var sitesResult = await Get($"subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/sites");
return JsonConvert.DeserializeObject(sitesResult);
}
public override async Task<dynamic> GetSitesInServerFarmAsync(string subscriptionId, string serverFarmName)
{
if (string.IsNullOrWhiteSpace(subscriptionId))
throw new ArgumentNullException(nameof(subscriptionId));
if (string.IsNullOrWhiteSpace(serverFarmName))
throw new ArgumentNullException(nameof(serverFarmName));
var sitesResult = await Get($"subscriptionid/{subscriptionId}/serverfarm/{serverFarmName}/sites");
return JsonConvert.DeserializeObject(sitesResult);
}
public override async Task<string> GetSiteWebSpaceNameAsync(string subscriptionId, string siteName)
{
return await Get($"subscriptionid/{subscriptionId}/sitename/{siteName}/webspacename");
}
if (string.IsNullOrWhiteSpace(subscriptionId))
throw new ArgumentNullException(nameof(subscriptionId));
if (string.IsNullOrWhiteSpace(siteName))
throw new ArgumentNullException(nameof(siteName));
public override Task<string> GetStorageVolumeForSiteAsync(string stampName, string siteName)
{
throw new NotImplementedException();
return await Get($"subscriptionid/{subscriptionId}/sitename/{siteName}/webspacename");
}
public override async Task<string> GetWebspaceResourceGroupName(string subscriptionId, string webSpaceName)
{
if (string.IsNullOrWhiteSpace(subscriptionId))
throw new ArgumentNullException(nameof(subscriptionId));
if (string.IsNullOrWhiteSpace(webSpaceName))
throw new ArgumentNullException(nameof(webSpaceName));
return await Get($"subscriptionid/{subscriptionId}/webspacename/{webSpaceName}/resourcegroupname");
}
@ -173,6 +179,9 @@ namespace Diagnostics.DataProviders
private async Task<dynamic> GetSiteInternal(string stampName, string siteName, string slotName)
{
if (string.IsNullOrWhiteSpace(siteName))
throw new ArgumentNullException(nameof(siteName));
string path = "";
if (!string.IsNullOrWhiteSpace(stampName))
@ -204,6 +213,11 @@ namespace Diagnostics.DataProviders
public override async Task<dynamic> GetHostNames(string stampName, string siteName)
{
if (string.IsNullOrWhiteSpace(stampName))
throw new ArgumentNullException(nameof(stampName));
if (string.IsNullOrWhiteSpace(siteName))
throw new ArgumentNullException(nameof(siteName));
var response = await Get($"stamps/{stampName}/sites/{siteName}/hostnames");
var hostNames = JsonConvert.DeserializeObject(response);
return hostNames;
@ -212,14 +226,9 @@ namespace Diagnostics.DataProviders
public override async Task<dynamic> GetSitePostBody(string stampName, string siteName)
{
if (string.IsNullOrWhiteSpace(stampName))
{
throw new ArgumentNullException(nameof(stampName));
}
if (string.IsNullOrWhiteSpace(siteName))
{
throw new ArgumentNullException(nameof(siteName));
}
var response = await GetObserverResource($"stamps/{stampName}/sites/{siteName}/postbody");
dynamic sitePostBody = JsonConvert.DeserializeObject(response);
@ -228,6 +237,9 @@ namespace Diagnostics.DataProviders
public override async Task<dynamic> GetHostingEnvironmentPostBody(string hostingEnvironmentName)
{
if (string.IsNullOrWhiteSpace(hostingEnvironmentName))
throw new ArgumentNullException(nameof(hostingEnvironmentName));
var response = await GetObserverResource($"hostingEnvironments/{hostingEnvironmentName}/postbody");
var hostingEnvironmentPostBody = JsonConvert.DeserializeObject(response);
return hostingEnvironmentPostBody;
@ -235,6 +247,11 @@ namespace Diagnostics.DataProviders
public override async Task<DataTable> ExecuteSqlQueryAsync(string cloudServiceName, string query)
{
if (string.IsNullOrWhiteSpace(cloudServiceName))
throw new ArgumentNullException(nameof(cloudServiceName));
if (string.IsNullOrWhiteSpace(query))
throw new ArgumentNullException(nameof(query));
if (!query.StartsWith("\""))
{
// BUG: Passing as JSON requires query to be wrapped in quotes, fix API expected content type
@ -299,6 +316,9 @@ namespace Diagnostics.DataProviders
/// </summary>
private async Task<string> Get(string path)
{
if (string.IsNullOrWhiteSpace(path))
throw new ArgumentNullException(nameof(path));
var request = new HttpRequestMessage(HttpMethod.Get, $"https://support-bay-api.azurewebsites.net/observer/{path}?api-version=2.0");
request.Headers.TryAddWithoutValidation("Authorization", await DataProviderContext.SupportBayApiObserverTokenService.GetAuthorizationTokenAsync());
var response = await GetObserverClient().SendAsync(request);

Просмотреть файл

@ -16,26 +16,6 @@ namespace Diagnostics.DataProviders
DataProvider = dataProvider;
}
public Task<JObject> GetAdminSitesByHostNameAsync(string stampName, string[] hostNames)
{
return MakeDependencyCall(DataProvider.GetAdminSitesByHostNameAsync(stampName, hostNames));
}
public Task<JObject> GetAdminSitesBySiteNameAsync(string stampName, string siteName)
{
return MakeDependencyCall(DataProvider.GetAdminSitesBySiteNameAsync(stampName, siteName));
}
public Task<IEnumerable<object>> GetAppServiceEnvironmentDeploymentsAsync(string hostingEnvironmentName)
{
return MakeDependencyCall(DataProvider.GetAppServiceEnvironmentDeploymentsAsync(hostingEnvironmentName));
}
public Task<JObject> GetAppServiceEnvironmentDetailsAsync(string hostingEnvironmentName)
{
return MakeDependencyCall(DataProvider.GetAppServiceEnvironmentDetailsAsync(hostingEnvironmentName));
}
public Task<dynamic> GetCertificatesInResourceGroupAsync(string subscriptionName, string resourceGroupName)
{
return MakeDependencyCall(DataProvider.GetCertificatesInResourceGroupAsync(subscriptionName, resourceGroupName));
@ -121,11 +101,6 @@ namespace Diagnostics.DataProviders
return MakeDependencyCall(DataProvider.GetSiteWebSpaceNameAsync(subscriptionId, siteName));
}
public Task<string> GetStorageVolumeForSiteAsync(string stampName, string siteName)
{
return MakeDependencyCall(DataProvider.GetStorageVolumeForSiteAsync(stampName, siteName));
}
public Task<string> GetWebspaceResourceGroupName(string subscriptionId, string webSpaceName)
{
return MakeDependencyCall(DataProvider.GetWebspaceResourceGroupName(subscriptionId, webSpaceName));

Просмотреть файл

@ -110,20 +110,11 @@ namespace Diagnostics.RuntimeHost
});
services.AddSingleton<IAssemblyCacheService, AssemblyCacheService>();
bool searchIsEnabled = Convert.ToBoolean(Configuration[$"SearchAPI:{RegistryConstants.SearchAPIEnabledKey}"]);
if (searchIsEnabled)
{
services.AddSingleton<ISearchService, SearchService>();
}
else
{
services.AddSingleton<ISearchService, SearchServiceDisabled>();
}
var servicesProvider = services.BuildServiceProvider();
var dataSourcesConfigService = servicesProvider.GetService<IDataSourcesConfigurationService>();
var observerConfiguration = dataSourcesConfigService.Config.SupportObserverConfiguration;
var kustoConfiguration = dataSourcesConfigService.Config.KustoConfiguration;
var searchApiConfiguration = dataSourcesConfigService.Config.SearchServiceProviderConfiguration;
services.AddSingleton<IKustoHeartBeatService>(new KustoHeartBeatService(kustoConfiguration));
@ -135,12 +126,16 @@ namespace Diagnostics.RuntimeHost
ChangeAnalysisTokenService.Instance.Initialize(dataSourcesConfigService.Config.ChangeAnalysisDataProviderConfiguration);
AscTokenService.Instance.Initialize(dataSourcesConfigService.Config.AscDataProviderConfiguration);
if (searchIsEnabled)
CompilerHostTokenService.Instance.Initialize(Configuration);
if (searchApiConfiguration.SearchAPIEnabled)
{
services.AddSingleton<ISearchService, SearchService>();
SearchServiceTokenService.Instance.Initialize(dataSourcesConfigService.Config.SearchServiceProviderConfiguration);
}
CompilerHostTokenService.Instance.Initialize(Configuration);
else
{
services.AddSingleton<ISearchService, SearchServiceDisabled>();
}
// Initialize on startup
servicesProvider.GetService<ISourceWatcherService>();
}

Просмотреть файл

@ -38,9 +38,5 @@
internal const string GithubRepoNameKey = "RepoName";
internal const string GithubBranchKey = "Branch";
internal const string DestinationScriptsPathKey = "DestinationScriptsPath";
// Search API Registry Settings
internal const string SearchAPIRegistryPath = RegistryRootPath + @"\SearchAPI";
internal const string SearchAPIEnabledKey = "SearchAPIEnabled";
}
}

Просмотреть файл

@ -93,7 +93,7 @@ namespace Diagnostics.RuntimeHost.Utilities
result &= ParseDateTimeParameter("startTime", startTime, currentUtcTime.AddDays(-1), out startTimeUtc);
}
if (result == false)
if (!result)
{
errorMessage = "Cannot parse invalid date time. Valid Time format is yyyy-mm-ddThh:mm";
return false;

Просмотреть файл

@ -56,11 +56,9 @@ namespace Diagnostics.RuntimeHost.Utilities
}
using (FileStream SourceStream = File.Open(fileInfo.FullName, FileMode.Open))
using (FileStream DestinationStream = File.Create(Path.Combine(destinationDirInfo.FullName, desiredFileName)))
{
using (FileStream DestinationStream = File.Create(Path.Combine(destinationDirInfo.FullName, desiredFileName)))
{
await SourceStream.CopyToAsync(DestinationStream);
}
await SourceStream.CopyToAsync(DestinationStream);
}
}
}