Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Octokit Github Version Check #189

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions FabricHealer/FabricHealerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,17 @@ await TelemetryUtilities.EmitTelemetryEtwHealthEventAsync(
}
}

// Check for new version once a day.
if (DateTime.UtcNow.Subtract(LastVersionCheckDateTime) >= OperationalTelemetryRunInterval)
if (ConfigSettings.CheckGithubVersion)
{
await CheckGithubForNewVersionAsync();
LastVersionCheckDateTime = DateTime.UtcNow;
// Check for new version once a day.
if (DateTime.UtcNow.Subtract(LastVersionCheckDateTime) >= OperationalTelemetryRunInterval)
{
await CheckGithubForNewVersionAsync();
LastVersionCheckDateTime = DateTime.UtcNow;
}
}


await Task.Delay(
TimeSpan.FromSeconds(
ConfigSettings.HealthCheckIntervalInSeconds > 0 ? ConfigSettings.HealthCheckIntervalInSeconds : 10), Token);
Expand Down
1 change: 1 addition & 0 deletions FabricHealer/PackageRoot/Config/Settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Parameter Name="EnableVerboseLogging" Value="" MustOverride="true" />
<Parameter Name="EnableTelemetry" Value="" MustOverride="true" />
<Parameter Name="EnableETW" Value="" MustOverride="true" />
<Parameter Name="CheckGithubVersion" Value="" MustOverride="true"/>
<!-- Big Red Button: You can turn FabricHealer on and off with a versionless parameter-only application upgrade. -->
<Parameter Name="EnableAutoMitigation" Value="" MustOverride="true" />
<Parameter Name="EnableOperationalTelemetry" Value="" MustOverride="true" />
Expand Down
3 changes: 3 additions & 0 deletions FabricHealer/Repair/RepairConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,8 @@ public static class RepairConstants
public const string MaxOutstandingRepairs = "MaxOutstandingRepairs";
public const string NodeProbationPeriod = "NodeProbationPeriod";
public const string MinHealthStateDuration = "MinHealthStateDuration";

// Octokit Github Version Check
public const string CheckGithubVersion = "CheckGithubVersion";
}
}
11 changes: 11 additions & 0 deletions FabricHealer/Utilities/ConfigSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public string AppInsightsConnectionString
private set;
}

public bool CheckGithubVersion
{
get;
private set;
}

// For Azure LogAnalytics Telemetry
public string LogAnalyticsWorkspaceId
{
Expand Down Expand Up @@ -188,6 +194,11 @@ internal void UpdateConfigSettings(ConfigurationSettings settings = null)
EnableCustomRepairPredicateType = enableCustomRepairPredicateType;
}

if(bool.TryParse(GetConfigSettingValue(RepairConstants.RepairManagerConfigurationSectionName, RepairConstants.CheckGithubVersion), out bool checkGithubVersion))
{
CheckGithubVersion = checkGithubVersion;
}

// Logger
if (bool.TryParse(GetConfigSettingValue(RepairConstants.RepairManagerConfigurationSectionName, RepairConstants.EnableVerboseLoggingParameter), out bool enableVerboseLogging))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Parameter Name="AutoMitigationEnabled" DefaultValue="true" />
<Parameter Name="EnableETW" DefaultValue="false" />
<Parameter Name="HealthCheckIntervalInSeconds" DefaultValue="30" />
<Parameter Name="CheckGithubVersion" DefaultValue="true"/>
<!-- If set to true, then FH will emit log events containing the full text of the logic rule with the currently executing external repair predicate.
This is extremely useful for both debugging and auditing repair rules. -->
<Parameter Name="EnableLogicRuleTracing" DefaultValue="true" />
Expand Down Expand Up @@ -60,6 +61,7 @@
<Parameter Name="EnableLogicRuleTracing" Value="[EnableLogicRuleTracing]" />
<Parameter Name="EnableCustomServiceInitializers" Value="[EnableCustomServiceInitializers]" />
<Parameter Name="EnableCustomRepairPredicateType" Value="[EnableCustomRepairPredicateType]" />
<Parameter Name="CheckGithubVersion" Value="[CheckGithubVersion]" />
</Section>
<!-- Repair policies -->
<Section Name="AppRepairPolicy">
Expand Down