This commit is contained in:
Charles Torre 2022-10-08 14:15:10 -07:00
Родитель 9e5c099fb2
Коммит cf4c7a31d5
7 изменённых файлов: 2194 добавлений и 20 удалений

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

@ -510,7 +510,7 @@ namespace FHTest
var (generatedWarning, data) = await IsEntityInWarningStateAsync(null, RepairFactsServiceTarget.ServiceName);
Assert.IsTrue(generatedWarning);
Assert.IsTrue(data is TelemetryData);
Assert.IsTrue(data != null);
}
[TestMethod]
@ -529,7 +529,7 @@ namespace FHTest
var (generatedWarning, data) = await IsEntityInWarningStateAsync(null, null, NodeName);
Assert.IsTrue(generatedWarning);
Assert.IsTrue(data is TelemetryData);
Assert.IsTrue(data != null);
}
[TestMethod]
@ -624,13 +624,13 @@ namespace FHTest
{
var (generatedWarningService, sdata) = await IsEntityInWarningStateAsync(null, repair.ServiceName);
Assert.IsTrue(generatedWarningService);
Assert.IsTrue(sdata is TelemetryData);
Assert.IsTrue(sdata != null);
}
else if (repair.EntityType == EntityType.Disk || repair.EntityType == EntityType.Machine || repair.EntityType == EntityType.Node)
{
var (generatedWarningNode, ndata) = await IsEntityInWarningStateAsync(null, null, NodeName);
Assert.IsTrue(generatedWarningNode);
Assert.IsTrue(ndata is TelemetryData);
Assert.IsTrue(ndata != null);
}
// FHProxy creates or renames Source with trailing id ("FabricHealerProxy");

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

@ -1430,7 +1430,7 @@ namespace FabricHealer
else
{
// Nothing to do here.
if (repairData.EntityType == EntityType.Invalid)
if (repairData.EntityType == EntityType.Unknown)
{
continue;
}

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

@ -522,7 +522,8 @@ namespace FabricHealer.Repair
Stopwatch stopWatch = Stopwatch.StartNew();
bool isApproved = false;
var repairs = await repairTaskEngine.GetFHRepairTasksCurrentlyProcessingAsync(RepairTaskEngine.FabricHealerExecutorName, cancellationToken);
var repairs =
await repairTaskEngine.GetFHRepairTasksCurrentlyProcessingAsync(RepairTaskEngine.FabricHealerExecutorName, cancellationToken);
if (repairs.All(repair => repair.TaskId != repairTask.TaskId))
{
@ -687,7 +688,7 @@ namespace FabricHealer.Repair
if (repairData.PartitionId == null)
{
success = false;
await FabricHealerManager.TelemetryUtilities.EmitTelemetryEtwHealthEventAsync(
await FabricHealerManager.TelemetryUtilities.EmitTelemetryEtwHealthEventAsync(
LogLevel.Info,
"RepairTaskManager.ExecuteFabricHealerRmRepairTaskAsync::NoPartition",
$"No partition specified.",
@ -707,7 +708,7 @@ namespace FabricHealer.Repair
if (repList.Count == 0)
{
success = false;
await FabricHealerManager.TelemetryUtilities.EmitTelemetryEtwHealthEventAsync(
await FabricHealerManager.TelemetryUtilities.EmitTelemetryEtwHealthEventAsync(
LogLevel.Info,
"RepairTaskManager.ExecuteFabricHealerRmRepairTaskAsync::NoReplica",
$"Stateless Instance {repairData.ReplicaId} not found on partition " +
@ -732,7 +733,7 @@ namespace FabricHealer.Repair
if (repairData.PartitionId == null)
{
success = false;
await FabricHealerManager.TelemetryUtilities.EmitTelemetryEtwHealthEventAsync(
await FabricHealerManager.TelemetryUtilities.EmitTelemetryEtwHealthEventAsync(
LogLevel.Info,
"RepairTaskManager.ExecuteFabricHealerRmRepairTaskAsync::NoPartition",
$"No partition specified.",
@ -818,8 +819,9 @@ namespace FabricHealer.Repair
switch (repairData.EntityType)
{
// Try and handle the case where EntityType is not specified or is set to Invalid for some reason.
case EntityType.Invalid:
// Try and handle the case where EntityType is not specified (facts from FHProxy, for example)
// or is explicitly set to Invalid for some reason.
case EntityType.Unknown:
if (!string.IsNullOrWhiteSpace(repairData.ServiceName))
{
@ -833,7 +835,18 @@ namespace FabricHealer.Repair
{
goto case EntityType.Node;
}
break;
else if (repairData.ReplicaId > 0)
{
goto case EntityType.Replica;
}
else if (!string.IsNullOrWhiteSpace(repairData.ProcessName) || repairData.ProcessId > 0)
{
goto case EntityType.Process;
}
else
{
return false;
}
case EntityType.Application:

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

@ -11,9 +11,9 @@ namespace FabricHealer.Utilities.Telemetry
public enum EntityType
{
/// <summary>
/// Invalid (default value).
/// Unknown (default).
/// </summary>
Invalid,
Unknown,
/// <summary>
/// Application type.
/// </summary>

2161
FabricHealerManager.cs Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -11,9 +11,9 @@ namespace FabricHealer
public enum EntityType
{
/// <summary>
/// Invalid (default value).
/// Unknown (default value).
/// </summary>
Invalid,
Unknown,
/// <summary>
/// Application type.
/// </summary>

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

@ -254,22 +254,22 @@ namespace FabricHealer
ManageRepairDataHistory(cancellationToken);
// Support not specifying EntityType.
if (!string.IsNullOrWhiteSpace(repairData.ServiceName) && repairData.EntityType == EntityType.Invalid)
if (!string.IsNullOrWhiteSpace(repairData.ServiceName) && repairData.EntityType == EntityType.Unknown)
{
repairData.EntityType = EntityType.Service;
}
else if (repairData.ReplicaId > 0 && repairData.EntityType == EntityType.Invalid)
else if (repairData.ReplicaId > 0 && repairData.EntityType == EntityType.Unknown)
{
repairData.EntityType = EntityType.Replica;
}
else if ((repairData.ProcessId > 0 || !string.IsNullOrWhiteSpace(repairData.ProcessName)) && repairData.EntityType == EntityType.Invalid)
else if ((repairData.ProcessId > 0 || !string.IsNullOrWhiteSpace(repairData.ProcessName)) && repairData.EntityType == EntityType.Unknown)
{
repairData.EntityType = EntityType.Process;
}
else if (!string.IsNullOrEmpty(repairData.NodeName) &&
string.IsNullOrWhiteSpace(repairData.ApplicationName) &&
string.IsNullOrWhiteSpace(repairData.ServiceName) &&
repairData.EntityType == EntityType.Invalid || repairData.EntityType == EntityType.Machine)
repairData.EntityType == EntityType.Unknown || repairData.EntityType == EntityType.Machine)
{
repairData.EntityType = repairData.EntityType == EntityType.Machine ? EntityType.Machine : EntityType.Node;