Add Current Server Role to system information (#12630)
* Add Current Server Rule to system information * Update Unit Tests, Mock IServerRoleAccessor * Add CurrentServerRole to UnitTest * adds trailing commas Co-authored-by: Nathan Woulfe <nathan@nathanw.com.au>
This commit is contained in:
committed by
GitHub
parent
5bb81558f8
commit
173c1c8c8f
@@ -1,8 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Cms.Core;
|
||||
@@ -10,6 +7,7 @@ using Umbraco.Cms.Core.Configuration;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Services;
|
||||
using Umbraco.Cms.Core.Sync;
|
||||
using Umbraco.Cms.Infrastructure.Persistence;
|
||||
using Umbraco.Cms.Infrastructure.Telemetry.Interfaces;
|
||||
using Umbraco.Extensions;
|
||||
@@ -25,6 +23,8 @@ internal class SystemInformationTelemetryProvider : IDetailedTelemetryProvider,
|
||||
private readonly ModelsBuilderSettings _modelsBuilderSettings;
|
||||
private readonly IUmbracoDatabaseFactory _umbracoDatabaseFactory;
|
||||
private readonly IUmbracoVersion _version;
|
||||
private readonly IServerRoleAccessor _serverRoleAccessor;
|
||||
|
||||
|
||||
public SystemInformationTelemetryProvider(
|
||||
IUmbracoVersion version,
|
||||
@@ -33,12 +33,14 @@ internal class SystemInformationTelemetryProvider : IDetailedTelemetryProvider,
|
||||
IOptionsMonitor<HostingSettings> hostingSettings,
|
||||
IOptionsMonitor<GlobalSettings> globalSettings,
|
||||
IHostEnvironment hostEnvironment,
|
||||
IUmbracoDatabaseFactory umbracoDatabaseFactory)
|
||||
IUmbracoDatabaseFactory umbracoDatabaseFactory,
|
||||
IServerRoleAccessor serverRoleAccessor)
|
||||
{
|
||||
_version = version;
|
||||
_localizationService = localizationService;
|
||||
_hostEnvironment = hostEnvironment;
|
||||
_umbracoDatabaseFactory = umbracoDatabaseFactory;
|
||||
_serverRoleAccessor = serverRoleAccessor;
|
||||
|
||||
_globalSettings = globalSettings.CurrentValue;
|
||||
_hostingSettings = hostingSettings.CurrentValue;
|
||||
@@ -63,6 +65,8 @@ internal class SystemInformationTelemetryProvider : IDetailedTelemetryProvider,
|
||||
|
||||
private string DatabaseProvider => _umbracoDatabaseFactory.CreateDatabase().DatabaseType.GetProviderName();
|
||||
|
||||
private string CurrentServerRole => _serverRoleAccessor.CurrentServerRole.ToString();
|
||||
|
||||
public IEnumerable<UsageInformation> GetInformation() =>
|
||||
new UsageInformation[]
|
||||
{
|
||||
@@ -72,7 +76,8 @@ internal class SystemInformationTelemetryProvider : IDetailedTelemetryProvider,
|
||||
new(Constants.Telemetry.ModelsBuilderMode, ModelsBuilderMode),
|
||||
new(Constants.Telemetry.CustomUmbracoPath, UmbracoPathCustomized),
|
||||
new(Constants.Telemetry.AspEnvironment, AspEnvironment), new(Constants.Telemetry.IsDebug, IsDebug),
|
||||
new(Constants.Telemetry.DatabaseProvider, DatabaseProvider)
|
||||
new(Constants.Telemetry.DatabaseProvider, DatabaseProvider),
|
||||
new(Constants.Telemetry.CurrentServerRole, CurrentServerRole),
|
||||
};
|
||||
|
||||
public IEnumerable<UserData> GetUserData() =>
|
||||
@@ -84,7 +89,8 @@ internal class SystemInformationTelemetryProvider : IDetailedTelemetryProvider,
|
||||
new("Current Culture", CurrentCulture),
|
||||
new("Current UI Culture", Thread.CurrentThread.CurrentUICulture.ToString()),
|
||||
new("Current Webserver", CurrentWebServer), new("Models Builder Mode", ModelsBuilderMode),
|
||||
new("Debug Mode", IsDebug.ToString()), new("Database Provider", DatabaseProvider)
|
||||
new("Debug Mode", IsDebug.ToString()), new("Database Provider", DatabaseProvider),
|
||||
new("Current Server Role", CurrentServerRole),
|
||||
};
|
||||
|
||||
private bool IsRunningInProcessIIS()
|
||||
|
||||
Reference in New Issue
Block a user