Skip to content

Commit

Permalink
Merge pull request #155 from microsoft/develop
Browse files Browse the repository at this point in the history
FO 3.1.15 RTW
  • Loading branch information
GitTorre authored Jul 13, 2021
2 parents 50ae023 + be367d1 commit 41a27ba
Show file tree
Hide file tree
Showing 46 changed files with 1,425 additions and 796 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -336,3 +336,6 @@ ASALocalRun/
/FabricObserver/observer_logs
/FabricObserver/PackageRoot/Data/Plugins/SampleNewObserver.dll
/nuget.exe
/FabricObserver/PackageRoot/Data/Plugins/ContainerObserver
/FabricObserver/PackageRoot/Data/Plugins/FabricObserverMdm
/FabricObserver/PackageRoot/Config/containerobserver.config.json
8 changes: 4 additions & 4 deletions Build-COSFPkgs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ function Build-SFPkg {
try {
Push-Location $scriptPath

Build-SFPkg "Microsoft.ServiceFabricApps.ClusterObserver.Linux.SelfContained.2.1.9" "$scriptPath\bin\release\ClusterObserver\linux-x64\self-contained\ClusterObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.ClusterObserver.Linux.FrameworkDependent.2.1.9" "$scriptPath\bin\release\ClusterObserver\linux-x64\framework-dependent\ClusterObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.ClusterObserver.Linux.SelfContained.2.1.10" "$scriptPath\bin\release\ClusterObserver\linux-x64\self-contained\ClusterObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.ClusterObserver.Linux.FrameworkDependent.2.1.10" "$scriptPath\bin\release\ClusterObserver\linux-x64\framework-dependent\ClusterObserverType"

Build-SFPkg "Microsoft.ServiceFabricApps.ClusterObserver.Windows.SelfContained.2.1.9" "$scriptPath\bin\release\ClusterObserver\win-x64\self-contained\ClusterObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.ClusterObserver.Windows.FrameworkDependent.2.1.9" "$scriptPath\bin\release\ClusterObserver\win-x64\framework-dependent\ClusterObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.ClusterObserver.Windows.SelfContained.2.1.10" "$scriptPath\bin\release\ClusterObserver\win-x64\self-contained\ClusterObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.ClusterObserver.Windows.FrameworkDependent.2.1.10" "$scriptPath\bin\release\ClusterObserver\win-x64\framework-dependent\ClusterObserverType"
}
finally {
Pop-Location
Expand Down
8 changes: 4 additions & 4 deletions Build-SFPkgs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ function Build-SFPkg {
try {
Push-Location $scriptPath

Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Linux.SelfContained.3.1.14" "$scriptPath\bin\release\FabricObserver\linux-x64\self-contained\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Linux.FrameworkDependent.3.1.14" "$scriptPath\bin\release\FabricObserver\linux-x64\framework-dependent\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Linux.SelfContained.3.1.15" "$scriptPath\bin\release\FabricObserver\linux-x64\self-contained\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Linux.FrameworkDependent.3.1.15" "$scriptPath\bin\release\FabricObserver\linux-x64\framework-dependent\FabricObserverType"

Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Windows.SelfContained.3.1.14" "$scriptPath\bin\release\FabricObserver\win-x64\self-contained\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Windows.FrameworkDependent.3.1.14" "$scriptPath\bin\release\FabricObserver\win-x64\framework-dependent\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Windows.SelfContained.3.1.15" "$scriptPath\bin\release\FabricObserver\win-x64\self-contained\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Windows.FrameworkDependent.3.1.15" "$scriptPath\bin\release\FabricObserver\win-x64\framework-dependent\FabricObserverType"
}
finally {
Pop-Location
Expand Down
4 changes: 2 additions & 2 deletions ClusterObserver.nuspec.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="3.3.0">
<id>%PACKAGE_ID%</id>
<version>2.1.9</version>
<version>2.1.10</version>
<releaseNotes>
Code improvements.
Updated TelemetryData and ApplicationInsights impl to match FO 3.1.15's impls.
</releaseNotes>
<authors>Microsoft</authors>
<license type="expression">MIT</license>
Expand Down
22 changes: 7 additions & 15 deletions ClusterObserver/ClusterObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ private async Task ProcessApplicationHealthAsync(IList<ApplicationHealthState> a
udText = $"in UD {udsInAppUpgrade.First(ud => ud > -1 && ud < int.MaxValue)}";
}

telemetryDescription += $"{appName} is upgrading {udText}.{Environment.NewLine}";
telemetryDescription += $" Note: {appName} is upgrading {udText}.{Environment.NewLine}";
}
}

Expand All @@ -390,17 +390,18 @@ private async Task ProcessApplicationHealthAsync(IList<ApplicationHealthState> a
// From FabricObserver?
if (foTelemetryData != null)
{
foTelemetryData.Description += telemetryDescription;

// Telemetry.
if (TelemetryEnabled && ObserverTelemetryClient != null)
{

await ObserverTelemetryClient.ReportHealthAsync(foTelemetryData, token);
}

// ETW.
if (EtwEnabled)
{
double value = double.TryParse(foTelemetryData.Value?.ToString(), out double val) ? val : -1;

Logger.EtwLogger?.Write(
ObserverConstants.ClusterObserverETWEventName,
new
Expand All @@ -417,7 +418,7 @@ private async Task ProcessApplicationHealthAsync(IList<ApplicationHealthState> a
foTelemetryData.ProcessId,
foTelemetryData.ReplicaId,
foTelemetryData.SystemServiceProcessName,
Value = value
foTelemetryData.Value
});
}

Expand Down Expand Up @@ -541,7 +542,7 @@ private async Task ProcessNodeHealthAsync(IEnumerable<NodeHealthState> nodeHealt
Metric = metric ?? "AggregatedClusterHealth",
ObserverName = sourceObserver ?? string.Empty,
Source = foStats != null ? foStats.Source : ObserverName,
Value = foStats != null ? foStats.Value : string.Empty
Value = foStats != null ? foStats.Value : 0
};

// Telemetry.
Expand All @@ -554,13 +555,6 @@ private async Task ProcessNodeHealthAsync(IEnumerable<NodeHealthState> nodeHealt
continue;
}

double value = 0;

if (foStats != null)
{
value = double.TryParse(foStats.Value?.ToString(), out double val) ? val : -1;
}

Logger.EtwLogger?.Write(
ObserverConstants.ClusterObserverETWEventName,
new
Expand All @@ -573,7 +567,7 @@ private async Task ProcessNodeHealthAsync(IEnumerable<NodeHealthState> nodeHealt
Metric = metric ?? "AggregatedClusterHealth",
ObserverName = sourceObserver ?? string.Empty,
Source = foStats != null ? foStats.Source : ObserverName,
Value = value
Value = foStats != null ? foStats.Value : 0
});
}
}
Expand Down Expand Up @@ -639,7 +633,6 @@ private async Task MonitorNodeStatusAsync(CancellationToken token)
Description = $"{nodeDictItem.Key} is now Up.",
Metric = "NodeStatus",
NodeName = nodeDictItem.Key,
Value = "Up",
Source = ObserverName
};

Expand Down Expand Up @@ -713,7 +706,6 @@ private async Task MonitorNodeStatusAsync(CancellationToken token)
Description = message,
Metric = "NodeStatus",
NodeName = kvp.Key,
Value = $"{kvp.Value.NodeStatus}",
Source = ObserverName
};

Expand Down
6 changes: 3 additions & 3 deletions ClusterObserver/PackageRoot/ServiceManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="ClusterObserverPkg"
Version="2.1.9"
Version="2.1.10"
xmlns="http://schemas.microsoft.com/2011/01/fabric"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Expand All @@ -11,7 +11,7 @@
</ServiceTypes>

<!-- Code package is your service executable. -->
<CodePackage Name="Code" Version="2.1.9">
<CodePackage Name="Code" Version="2.1.10">
<EntryPoint>
<ExeHost>
<Program>ClusterObserver</Program>
Expand All @@ -21,7 +21,7 @@

<!-- Config package is the contents of the Config directory under PackageRoot that contains an
independently-updateable and versioned set of custom configuration settings for your service. -->
<ConfigPackage Name="Config" Version="2.1.9" />
<ConfigPackage Name="Config" Version="2.1.10" />

<Resources>
<Endpoints>
Expand Down
13 changes: 3 additions & 10 deletions ClusterObserver/Utilities/Telemetry/AppInsightsTelemetry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,20 @@ public Task ReportHealthAsync(TelemetryData telemetryData, CancellationToken can
{
cancellationToken.ThrowIfCancellationRequested();

string value = null;

if (telemetryData.Value != null)
{
value = telemetryData.Value.ToString();
}

Dictionary<string, string> properties = new Dictionary<string, string>
{
{ "ClusterId", telemetryData.ClusterId ?? string.Empty },
{ "HealthState", telemetryData.HealthState ?? string.Empty },
{ "Application", telemetryData.ApplicationName ?? string.Empty },
{ "Service", telemetryData.ServiceName ?? string.Empty },
{ "SystemServiceProcessName", telemetryData.SystemServiceProcessName ?? string.Empty },
{ "ProcessId", telemetryData.ProcessId ?? string.Empty },
{ "ProcessId", telemetryData.ProcessId.ToString() },
{ "ErrorCode", telemetryData.Code ?? string.Empty },
{ "Description", telemetryData.Description ?? string.Empty },
{ "Metric", telemetryData.Metric ?? string.Empty },
{ "Value", value ?? string.Empty },
{ "Value", telemetryData.Value.ToString() },
{ "Partition", telemetryData.PartitionId },
{ "Replica", telemetryData.ReplicaId },
{ "Replica", telemetryData.ReplicaId.ToString() },
{ "Source", telemetryData.ObserverName },
{ "NodeName", telemetryData.NodeName ?? string.Empty },
{ "OS", telemetryData.OS ?? string.Empty }
Expand Down
9 changes: 5 additions & 4 deletions ClusterObserver/Utilities/Telemetry/TelemetryData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ public string PartitionId
get; set;
}

public string ProcessId
public int ProcessId
{
get; set;
}

public string ReplicaId
public long ReplicaId
{
get; set;
}
Expand All @@ -92,17 +92,18 @@ public string SystemServiceProcessName
get; set;
}

public object Value
public double Value
{
get; set;
}

[JsonConstructor]
public TelemetryData()
{

}

public TelemetryData( FabricClient fabricClient, CancellationToken cancellationToken)
public TelemetryData(FabricClient fabricClient, CancellationToken cancellationToken)
{
var (clusterId, _) = ClusterIdentificationUtility.TupleGetClusterIdAndTypeAsync(fabricClient, cancellationToken).Result;
ClusterId = clusterId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="ClusterObserverType" ApplicationTypeVersion="2.1.9" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="ClusterObserverType" ApplicationTypeVersion="2.1.10" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Parameters>
<!-- ClusterObserver settings. -->
<Parameter Name="ClusterObserver_InstanceCount" DefaultValue="1" />
Expand All @@ -15,7 +15,7 @@
should match the Name and Version attributes of the ServiceManifest element defined in the
ServiceManifest.xml file. -->
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="ClusterObserverPkg" ServiceManifestVersion="2.1.9" />
<ServiceManifestRef ServiceManifestName="ClusterObserverPkg" ServiceManifestVersion="2.1.10" />
<ConfigOverrides>
<ConfigOverride Name="Config">
<Settings>
Expand Down
Loading

0 comments on commit 41a27ba

Please sign in to comment.