Skip to content

Commit

Permalink
Merge pull request #127: Bug fix in AppObserver.
Browse files Browse the repository at this point in the history
3.1.7 - Bug Fix
  • Loading branch information
GitTorre authored Mar 18, 2021
2 parents dd09b5e + f5e3c81 commit 5432fba
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 39 deletions.
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.6" "$scriptPath\bin\release\FabricObserver\linux-x64\self-contained\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Linux.FrameworkDependent.3.1.6" "$scriptPath\bin\release\FabricObserver\linux-x64\framework-dependent\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Linux.SelfContained.3.1.7" "$scriptPath\bin\release\FabricObserver\linux-x64\self-contained\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Linux.FrameworkDependent.3.1.7" "$scriptPath\bin\release\FabricObserver\linux-x64\framework-dependent\FabricObserverType"

Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Windows.SelfContained.3.1.6" "$scriptPath\bin\release\FabricObserver\win-x64\self-contained\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Windows.FrameworkDependent.3.1.6" "$scriptPath\bin\release\FabricObserver\win-x64\framework-dependent\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Windows.SelfContained.3.1.7" "$scriptPath\bin\release\FabricObserver\win-x64\self-contained\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Windows.FrameworkDependent.3.1.7" "$scriptPath\bin\release\FabricObserver\win-x64\framework-dependent\FabricObserverType"
}
finally {
Pop-Location
Expand Down
4 changes: 2 additions & 2 deletions Documentation/Plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Create a new .NET Standard 2.0 library project, install the nupkg you need for y
You can find the Microsoft-signed packages in the nuget.org gallery [here](https://www.nuget.org/profiles/ServiceFabricApps) or just run this in the package manager console:

```
Install-Package Microsoft.ServiceFabricApps.FabricObserver.Windows.SelfContained -Version 3.1.5
Install-Package Microsoft.ServiceFabricApps.FabricObserver.Windows.SelfContained -Version 3.1.7
or for Linux:
Install-Package Microsoft.ServiceFabricApps.FabricObserver.Linux.SelfContained -Version 3.1.5
Install-Package Microsoft.ServiceFabricApps.FabricObserver.Linux.SelfContained -Version 3.1.7
```

Note:
Expand Down
2 changes: 1 addition & 1 deletion Documentation/Using.md
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ $appParams = @{ "FabricSystemObserverEnabled" = "true"; "FabricSystemObserverMem
Then execute the application upgrade with

```Powershell
Start-ServiceFabricApplicationUpgrade -ApplicationName fabric:/FabricObserver -ApplicationTypeVersion 3.1.6 -ApplicationParameter $appParams -Monitored -FailureAction rollback
Start-ServiceFabricApplicationUpgrade -ApplicationName fabric:/FabricObserver -ApplicationTypeVersion 3.1.7 -ApplicationParameter $appParams -Monitored -FailureAction rollback
```

Note: On *Linux*, this will restart FO processes (one at a time, UD Walk with safety checks) due to the way Linux Capabilites work. In a nutshell, for any kind of application upgrade, we have to re-run the FO setup script to get the Capabilities in place. For Windows, FO processes will NOT be restarted.
4 changes: 2 additions & 2 deletions FabricObserver.nuspec.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="3.3.0">
<id>%PACKAGE_ID%</id>
<version>3.1.6</version>
<releaseNotes>A few *important* bug fixes in AppObserver and Observerbase. Changes to Logger (ETW). Naming changes. **Please upgrade as soon as you can**. Changes: AppObserver will now monitor All applications for specified metric thresholds when you supply "All" or "*" for the targetApp setting in AppObserver's configuration file. See project site for details. Fixed minor bug in ObserverManager's StopObserversAsync function. BREAKING CHANGES: You have to now enable/disable ETW on each observer that you want to generate EventSource traces. Also, in your plugins or forked observers, you will need to replace Logger.EtwLogger.Write() calls with ObserverLogger.LogEtw(). ObserverBase's HealthReportProperties and HealthReportSourceIds are gone. Just supply string values for sourceid/property if you generate your own health events.</releaseNotes>
<version>3.1.7</version>
<releaseNotes>Fixed bug in AppObserver related to ServiceIncludeList/ServiceExcludeList functionality.</releaseNotes>
<authors>Microsoft</authors>
<license type="expression">MIT</license>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Expand Down
19 changes: 9 additions & 10 deletions FabricObserver/Observers/AppObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ private async Task<bool> InitializeAsync()
}

existingAppConfig.ServiceExcludeList = string.IsNullOrWhiteSpace(existingAppConfig.ServiceExcludeList) && !string.IsNullOrWhiteSpace(application.ServiceExcludeList) ? application.ServiceExcludeList : existingAppConfig.ServiceExcludeList;
existingAppConfig.ServiceIncludeList = string.IsNullOrWhiteSpace(existingAppConfig.ServiceExcludeList) && !string.IsNullOrWhiteSpace(application.ServiceIncludeList) ? application.ServiceIncludeList : existingAppConfig.ServiceIncludeList;
existingAppConfig.ServiceIncludeList = string.IsNullOrWhiteSpace(existingAppConfig.ServiceIncludeList) && !string.IsNullOrWhiteSpace(application.ServiceIncludeList) ? application.ServiceIncludeList : existingAppConfig.ServiceIncludeList;
existingAppConfig.MemoryWarningLimitMb = existingAppConfig.MemoryWarningLimitMb == 0 && application.MemoryWarningLimitMb > 0 ? application.MemoryWarningLimitMb : existingAppConfig.MemoryWarningLimitMb;
existingAppConfig.MemoryErrorLimitMb = existingAppConfig.MemoryErrorLimitMb == 0 && application.MemoryErrorLimitMb > 0 ? application.MemoryErrorLimitMb : existingAppConfig.MemoryErrorLimitMb;
existingAppConfig.MemoryWarningLimitPercent = existingAppConfig.MemoryWarningLimitPercent == 0 && application.MemoryWarningLimitPercent > 0 ? application.MemoryWarningLimitPercent : existingAppConfig.MemoryWarningLimitPercent;
Expand Down Expand Up @@ -433,7 +433,7 @@ private async Task<bool> InitializeAsync()
}
}

// Remove the All, Any, * config item.
// Remove the All or * config item.
userTargetList.Remove(application);
}

Expand Down Expand Up @@ -465,9 +465,7 @@ private async Task<bool> InitializeAsync()

if (!string.IsNullOrWhiteSpace(application.TargetAppType))
{
await SetDeployedApplicationReplicaOrInstanceListAsync(
null,
application.TargetAppType).ConfigureAwait(false);
await SetDeployedApplicationReplicaOrInstanceListAsync(null, application.TargetAppType).ConfigureAwait(false);
}
else
{
Expand All @@ -479,9 +477,10 @@ await SetDeployedApplicationReplicaOrInstanceListAsync(
{
Token.ThrowIfCancellationRequested();

ObserverLogger.LogInfo(
$"Will observe resource consumption by {app.TargetApp} " +
$"on Node {NodeName}.");
if (ReplicaOrInstanceList.Count > 0 && ReplicaOrInstanceList.Any(r => r.ApplicationName.OriginalString == app.TargetApp))
{
ObserverLogger.LogInfo($"Will observe resource consumption by {app.TargetApp} on Node {NodeName}.");
}
}

return true;
Expand Down Expand Up @@ -775,12 +774,12 @@ private async Task SetDeployedApplicationReplicaOrInstanceListAsync(
{
if (!string.IsNullOrWhiteSpace(serviceFilter.ServiceExcludeList))
{
filteredServiceList = serviceFilter.ServiceExcludeList.Split(',').ToList();
filteredServiceList = serviceFilter.ServiceExcludeList.Replace(" ", string.Empty).Split(',').ToList();
filterType = ServiceFilterType.Exclude;
}
else if (!string.IsNullOrWhiteSpace(serviceFilter.ServiceIncludeList))
{
filteredServiceList = serviceFilter.ServiceIncludeList.Split(',').ToList();
filteredServiceList = serviceFilter.ServiceIncludeList.Replace(" ", string.Empty).Split(',').ToList();
filterType = ServiceFilterType.Include;
}
}
Expand Down
8 changes: 4 additions & 4 deletions FabricObserver/PackageRoot/ServiceManifest._linux.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="FabricObserverPkg"
Version="3.1.6"
Version="3.1.7"
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="3.1.6">
<CodePackage Name="Code" Version="3.1.7">
<SetupEntryPoint>
<ExeHost>
<Program>setcaps.sh</Program>
Expand All @@ -27,11 +27,11 @@

<!-- 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="3.1.6" />
<ConfigPackage Name="Config" Version="3.1.7" />

<!-- Data package is the contents of the Data directory under PackageRoot that contains an
independently-updateable and versioned custom data for your service.
Observer plugin dlls must live in this folder, in a child folder named Plugins. -->
<DataPackage Name="Data" Version="3.1.6" />
<DataPackage Name="Data" Version="3.1.7" />

</ServiceManifest>
8 changes: 4 additions & 4 deletions FabricObserver/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="FabricObserverPkg"
Version="3.1.6"
Version="3.1.7"
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="3.1.6">
<CodePackage Name="Code" Version="3.1.7">
<EntryPoint>
<ExeHost>
<Program>FabricObserver</Program>
Expand All @@ -21,11 +21,11 @@

<!-- 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="3.1.6" />
<ConfigPackage Name="Config" Version="3.1.7" />

<!-- Data package is the contents of the Data directory under PackageRoot that contains an
independently-updateable and versioned custom data for your service.
Observer plugin dlls must live in this folder, in a child folder named Plugins. -->
<DataPackage Name="Data" Version="3.1.6" />
<DataPackage Name="Data" Version="3.1.7" />

</ServiceManifest>
24 changes: 17 additions & 7 deletions FabricObserverApp/ApplicationPackageRoot/ApplicationManifest.xml
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="FabricObserverType" ApplicationTypeVersion="3.1.6" 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="FabricObserverType" ApplicationTypeVersion="3.1.7" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<!-- Note: Add parameters for your Observer plugins here (e.g., [ObserverName]Enabled, etc.) so you can deploy
simple configuration updates for them. By design, any observer you make using our
extensibility model will employ the same basic config parameters as all observers do.
Expand All @@ -17,8 +17,9 @@
<Parameter Name="NodeObserverEnabled" DefaultValue="true" />
<Parameter Name="OSObserverEnabled" DefaultValue="true" />
<Parameter Name="SFConfigurationObserverEnabled" DefaultValue="false" />
<!-- Telemetry - AppInsights or LogAnalytics -->
<!--Parameter Name="SampleNewObserverEnabled" DefaultValue="true" />-->

<!-- Telemetry - AppInsights or LogAnalytics -->
<Parameter Name="AppObserverEnableTelemetry" DefaultValue="false" />
<Parameter Name="CertificateObserverEnableTelemetry" DefaultValue="false" />
<Parameter Name="DiskObserverEnableTelemetry" DefaultValue="false" />
Expand All @@ -27,8 +28,9 @@
<Parameter Name="NodeObserverEnableTelemetry" DefaultValue="false" />
<Parameter Name="OSObserverEnableTelemetry" DefaultValue="false" />
<Parameter Name="SFConfigurationObserverEnableTelemetry" DefaultValue="false" />
<!-- ETW - Custom EventSource Tracing -->
<!--Parameter Name="SampleNewObserverEnableTelemetry" DefaultValue="false" /> -->

<!-- ETW - Custom EventSource Tracing -->
<Parameter Name="AppObserverEnableEtw" DefaultValue="false" />
<Parameter Name="CertificateObserverEnableEtw" DefaultValue="false" />
<Parameter Name="DiskObserverEnableEtw" DefaultValue="false" />
Expand All @@ -37,8 +39,9 @@
<Parameter Name="NodeObserverEnableEtw" DefaultValue="false" />
<Parameter Name="OSObserverEnableEtw" DefaultValue="false" />
<Parameter Name="SFConfigurationObserverEnableEtw" DefaultValue="false" />
<!-- Verbose Logging -->
<!--Parameter Name="SampleNewObserverEnableEtw" DefaultValue="true" /> -->

<!-- Verbose Logging -->
<Parameter Name="AppObserverEnableVerboseLogging" DefaultValue="false" />
<Parameter Name="CertificateObserverEnableVerboseLogging" DefaultValue="false" />
<Parameter Name="DiskObserverEnableVerboseLogging" DefaultValue="false" />
Expand All @@ -47,12 +50,14 @@
<Parameter Name="NodeObserverEnableVerboseLogging" DefaultValue="false" />
<Parameter Name="OSObserverEnableVerboseLogging" DefaultValue="false" />
<Parameter Name="SFConfigurationObserverEnableVerboseLogging" DefaultValue="false" />
<!-- Monitor Durations (TimeSpan format, e.g., 00:00:00) -->
<!--Parameter Name="SampleNewObserverEnableVerboseLogging" DefaultValue="false" /> -->

<!-- Monitor Durations (TimeSpan format, e.g., 00:00:00) -->
<Parameter Name="AppObserverMonitorDuration" DefaultValue="00:00:05" />
<Parameter Name="DiskObserverMonitorDuration" DefaultValue="00:00:05" />
<Parameter Name="FabricSystemObserverMonitorDuration" DefaultValue="00:00:05" />
<Parameter Name="NodeObserverMonitorDuration" DefaultValue="00:00:05" />

<!-- Run Intervals (TimeSpan format, e.g., 0.00:00:00) -->
<Parameter Name="AppObserverRunInterval" DefaultValue="" />
<Parameter Name="CertificateObserverRunInterval" DefaultValue="1.00:00:00" />
Expand All @@ -62,8 +67,9 @@
<Parameter Name="NodeObserverRunInterval" DefaultValue="" />
<Parameter Name="OSObserverRunInterval" DefaultValue="01:00:00" />
<Parameter Name="SFConfigurationObserverRunInterval" DefaultValue="" />
<!-- AppObserver -->
<!--Parameter Name="SampleNewObserverRunInterval" DefaultValue="" /> -->

<!-- AppObserver -->
<Parameter Name="AppObserverClusterOperationTimeoutSeconds" DefaultValue="120" />
<Parameter Name="AppObserverUseCircularBuffer" DefaultValue="false" />
<!-- Required-If UseCircularBuffer = true -->
Expand All @@ -75,11 +81,13 @@
<!-- Required: These are JSON-style lists of strings, empty should be "[]", full should be "['mythumb1', 'mythumb2', etc...] or ['mycommon'1, 'mycommon2', etc...]" -->
<Parameter Name="AppCertThumbprintsToObserve" DefaultValue="[]" />
<Parameter Name="AppCertCommonNamesToObserve" DefaultValue="[]" />

<!-- Disk Observer Warning/Error Thresholds -->
<Parameter Name="DiskSpacePercentUsageWarningThreshold" DefaultValue="85" />
<Parameter Name="DiskSpacePercentUsageErrorThreshold" DefaultValue="" />
<Parameter Name="AverageQueueLengthErrorThreshold" DefaultValue="" />
<Parameter Name="AverageQueueLengthWarningThreshold" DefaultValue="15" />

<!-- FabricSystemObserver -->
<Parameter Name="FabricSystemObserverUseCircularBuffer" DefaultValue="false" />
<!-- Required-If UseCircularBuffer = True -->
Expand All @@ -97,6 +105,7 @@
<Parameter Name="FabricSystemObserverAllocatedHandlesWarningLimit" DefaultValue="5000" />
<!-- Whether to monitor Windows Event Log. -->
<Parameter Name="FabricSystemObserverMonitorWindowsEventLog" DefaultValue="false" />

<!-- NodeObserver -->
<Parameter Name="NodeObserverUseCircularBuffer" DefaultValue="true" />
<!-- Required-If UseCircularBuffer = True -->
Expand All @@ -119,6 +128,7 @@
<Parameter Name="NodeObserverLinuxFileHandlesWarningLimitPercent" DefaultValue="90" />
<Parameter Name="NodeObserverLinuxFileHandlesErrorLimitTotal" DefaultValue="" />
<Parameter Name="NodeObserverLinuxFileHandlesWarningLimitTotal" DefaultValue="" />

<!-- OSObserver Windows AutoUpdate Settings Check -->
<Parameter Name="OSObserverEnableWindowsAutoUpdateCheck" DefaultValue="true" />
<!-- Observers with JSON config - File names.
Expand All @@ -130,7 +140,7 @@
should match the Name and Version attributes of the ServiceManifest element defined in the
ServiceManifest.xml file. -->
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="FabricObserverPkg" ServiceManifestVersion="3.1.6" />
<ServiceManifestRef ServiceManifestName="FabricObserverPkg" ServiceManifestVersion="3.1.7" />
<ConfigOverrides>
<ConfigOverride Name="Config">
<Settings>
Expand Down
3 changes: 2 additions & 1 deletion FabricObserverTests/ObserverTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ public async Task Successful_CertificateObserver_Run_Cancellation_Via_ObserverMa
obsMgr.Dispose();
}

/* NOTE: These can be flaky due to the Test infra. Try running them as a group, after running all the other tests as a group. */
/* NOTE: These test can be flaky due to the Test infra. Try running them as a group, after running all the other tests as a group.
If any fail, then re-run the failed ones.. */

[TestMethod]
public async Task Successful_AppObserver_Run_Cancellation_Via_ObserverManager()
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# FabricObserver 3.1.6
# FabricObserver 3.1.7

[**FabricObserver (FO)**](https://github.com/microsoft/service-fabric-observer/releases) is a complete implementation of a generic resource usage watchdog service written as a stateless, singleton Service Fabric .NET Core 3.1 application that
1. Monitors a broad range of resources that tend to be important to all Service Fabric applications, like disk, CPU, memory, networking, and cluster certificates out-of-the-box.
Expand Down Expand Up @@ -110,15 +110,15 @@ Connect-ServiceFabricCluster -ConnectionEndpoint @('sf-win-cluster.westus2.cloud
#Copy $path contents (FO app package) to server:
Copy-ServiceFabricApplicationPackage -ApplicationPackagePath $path -CompressPackage -ApplicationPackagePathInImageStore FO316 -TimeoutSec 1800
Copy-ServiceFabricApplicationPackage -ApplicationPackagePath $path -CompressPackage -ApplicationPackagePathInImageStore FO317 -TimeoutSec 1800
#Register FO ApplicationType:
Register-ServiceFabricApplicationType -ApplicationPathInImageStore FO316
Register-ServiceFabricApplicationType -ApplicationPathInImageStore FO317
#Create FO application:
New-ServiceFabricApplication -ApplicationName fabric:/FabricObserver -ApplicationTypeName FabricObserverType -ApplicationTypeVersion 3.1.6
New-ServiceFabricApplication -ApplicationName fabric:/FabricObserver -ApplicationTypeName FabricObserverType -ApplicationTypeVersion 3.1.7
```

## Observer Model
Expand Down

0 comments on commit 5432fba

Please sign in to comment.