Skip to content

Commit

Permalink
Merge pull request #296 from microsoft/develop
Browse files Browse the repository at this point in the history
FO 3.2.15
  • Loading branch information
sidhant012 authored Mar 20, 2024
2 parents 4b9e786 + 9b58772 commit 1e27edd
Show file tree
Hide file tree
Showing 35 changed files with 337 additions and 525 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.2.14" "$scriptPath\bin\release\FabricObserver\linux-x64\self-contained\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Linux.FrameworkDependent.3.2.14" "$scriptPath\bin\release\FabricObserver\linux-x64\framework-dependent\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Linux.SelfContained.3.2.15" "$scriptPath\bin\release\FabricObserver\linux-x64\self-contained\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Linux.FrameworkDependent.3.2.15" "$scriptPath\bin\release\FabricObserver\linux-x64\framework-dependent\FabricObserverType"

Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Windows.SelfContained.3.2.14" "$scriptPath\bin\release\FabricObserver\win-x64\self-contained\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Windows.FrameworkDependent.3.2.14" "$scriptPath\bin\release\FabricObserver\win-x64\framework-dependent\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Windows.SelfContained.3.2.15" "$scriptPath\bin\release\FabricObserver\win-x64\self-contained\FabricObserverType"
Build-SFPkg "Microsoft.ServiceFabricApps.FabricObserver.Windows.FrameworkDependent.3.2.15" "$scriptPath\bin\release\FabricObserver\win-x64\framework-dependent\FabricObserverType"
}
finally {
Pop-Location
Expand Down
2 changes: 1 addition & 1 deletion ClusterObserver.nuspec.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<dependencies>
<group targetFramework="net6.0">
<dependency id="Microsoft.ServiceFabric.Services" version="6.0.1017" />
<dependency id="Microsoft.ServiceFabricApps.FabricObserver.Extensibility" version="3.2.9" />
<dependency id="Microsoft.ServiceFabricApps.FabricObserver.Extensibility" version="3.2.15" />
</group>
</dependencies>
<projectUrl>https://aka.ms/sf/FabricObserver</projectUrl>
Expand Down
8 changes: 4 additions & 4 deletions ClusterObserver/PackageRoot/Config/Settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
<Parameter Name="EnableOperationalTelemetry" Value="" MustOverride="true" />
<Parameter Name="MaxArchivedLogFileLifetimeDays" Value="" MustOverride="true" />

<!-- Telemetry - ApplicationInsights/LogAnalytics. NOTE: Values must now be set in ApplicationManifest.xml. This is a *breaking change* in version 3.2.14. -->
<!-- Telemetry - ApplicationInsights/LogAnalytics. NOTE: Values must now be set in ApplicationManifest.xml. This is a *breaking change* in version 3.2.15. -->

<!-- Required - Telemetry Provider. Supported values are AzureApplicationInsights or AzureLogAnalytics.
NOTE: Value must now be set in ApplicationManifest.xml. This is a *breaking change* in version 3.2.14. -->
NOTE: Value must now be set in ApplicationManifest.xml. This is a *breaking change* in version 3.2.15. -->
<Parameter Name="TelemetryProvider" Value="" MustOverride="true" />

<!-- Application Insights -->
<!-- Required-If TelemetryProvider is AzureApplicationInsights. Your AppInsights Connection String.
NOTE: Value must now be set in ApplicationManifest.xml. This is a *breaking change* in version 3.2.14.-->
NOTE: Value must now be set in ApplicationManifest.xml. This is a *breaking change* in version 3.2.15.-->
<Parameter Name="AppInsightsConnectionString" Value="" MustOverride="true" />
<!-- OBSOLETE. DO NOT USE. Use AppInsightsConnectionString instead. InstrumentationKey is no longer recommended for ApplicationInsights ingestion.
NOTE: Specifying this has no effect as ClusterObserver requires a ConnectionString for ApplicationInsights. -->
<Parameter Name="AppInsightsInstrumentationKey" Value="" />

<!-- LogAnalytics -->
<!-- Required-If TelemetryProvider is AzureLogAnalytics. Your Workspace Id.
NOTE: Values must now be set in ApplicationManifest.xml. This is a *breaking change* in version 3.2.14. -->
NOTE: Values must now be set in ApplicationManifest.xml. This is a *breaking change* in version 3.2.15. -->
<Parameter Name="LogAnalyticsWorkspaceId" Value="" MustOverride="true" />
<!-- Required-If TelemetryProvider is AzureLogAnalytics. Your Shared Key. -->
<Parameter Name="LogAnalyticsSharedKey" Value="" MustOverride="true" />
Expand Down
2 changes: 1 addition & 1 deletion ClusterObserver/PackageRoot/Data/Plugins/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ cd C:\Users\me\source\repos\service-fabric-observer
./Build-FabricObserver
./Build-NugetPackages

The output from the above commands, FabricObserver platform-specific nupkgs and a package you have to use for plugin authoring named Microsoft.ServiceFabricApps.FabricObserver.Extensibility.3.2.14.nupkg, would be located in
The output from the above commands, FabricObserver platform-specific nupkgs and a package you have to use for plugin authoring named Microsoft.ServiceFabricApps.FabricObserver.Extensibility.3.2.15.nupkg, would be located in
C:\Users\me\source\repos\service-fabric-observer\bin\release\FabricObserver\Nugets.
6 changes: 3 additions & 3 deletions Documentation/Deployment/service-fabric-observer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
},
"applicationTypeVersionFabricObserver": {
"type": "string",
"defaultValue": "3.2.14",
"defaultValue": "3.2.15",
"metadata": {
"description": "Provide the app version number of FabricObserver. This must be identical to the version, 3.2.14, in the referenced sfpkg specified in packageUrlFabricObserver."
"description": "Provide the app version number of FabricObserver. This must be identical to the version, 3.2.15, in the referenced sfpkg specified in packageUrlFabricObserver."
}
},
"packageUrlFabricObserver": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "This has to be a public accessible URL for the sfpkg file which contains the FabricObserver app package. Example: https://github.com/microsoft/service-fabric-observer/releases/download/[xxxxxxxx]/Microsoft.ServiceFabricApps.FabricObserver.Windows.SelfContained.3.2.14.sfpkg"
"description": "This has to be a public accessible URL for the sfpkg file which contains the FabricObserver app package. Example: https://github.com/microsoft/service-fabric-observer/releases/download/[xxxxxxxx]/Microsoft.ServiceFabricApps.FabricObserver.Windows.SelfContained.3.2.15.sfpkg"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"value": "<YOUR-CLUSTER-RESOURCE-NAME>"
},
"applicationTypeVersionFabricObserver": {
"value": "3.2.14"
"value": "3.2.15"
},
"packageUrlFabricObserver": {
"value": "<PUBLIC-ACCESSIBLE-URL-FOR-FABRICOBSERVER-SFPKG>"
Expand Down
4 changes: 2 additions & 2 deletions Documentation/OperationalTelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ As with most of FabricObserver's application settings, you can also do this with
Connect-ServiceFabricCluster ...
$appParams = @{ "ObserverManagerEnableOperationalFOTelemetry" = "false"; }
Start-ServiceFabricApplicationUpgrade -ApplicationName fabric:/FabricObserver -ApplicationParameter $appParams -ApplicationTypeVersion 3.2.14 -UnMonitoredAuto
Start-ServiceFabricApplicationUpgrade -ApplicationName fabric:/FabricObserver -ApplicationParameter $appParams -ApplicationTypeVersion 3.2.15 -UnMonitoredAuto
```

Expand All @@ -44,7 +44,7 @@ Here is a full example of exactly what is sent in one of these telemetry events,
"ClusterId": "00000000-1111-1111-0000-00f00d000d",
"ClusterType": "SFRP",
"NodeNameHash": "3e83569d4c6aad78083cd081215dafc81e5218556b6a46cb8dd2b183ed0095ad",
"FOVersion": "3.2.14",
"FOVersion": "3.2.15",
"HasPlugins": "False",
"SFRuntimeVersion":"9.0.1028.9590"
"UpTime": "1.00:30:18.8058379",
Expand Down
2 changes: 1 addition & 1 deletion Documentation/Plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ cd C:\Users\me\source\repos\service-fabric-observer
./Build-FabricObserver
./Build-NugetPackages
```
The output from the above commands contains FabricObserver platform-specific nupkgs and a nupkg you have to use for plugin authoring named Microsoft.ServiceFabricApps.FabricObserver.Extensibility.3.2.14.nupkg. Nuget packages will be located in
The output from the above commands contains FabricObserver platform-specific nupkgs and a nupkg you have to use for plugin authoring named Microsoft.ServiceFabricApps.FabricObserver.Extensibility.3.2.15.nupkg. Nuget packages will be located in
C:\Users\me\source\repos\service-fabric-observer\bin\release\FabricObserver\Nugets.
4 changes: 2 additions & 2 deletions Documentation/Using.md
Original file line number Diff line number Diff line change
Expand Up @@ -710,15 +710,15 @@ $appParams = @{ "FabricSystemObserverEnabled" = "true"; "FabricSystemObserverMem
Then execute the application upgrade with

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

**Important**: This action will overwrite previous app paramemter changes that were made in an earlier application upgrade, for example. If you want to preserve any earlier changes, then you will need to
supply those parameter values again along with the new ones. You do this in the following, simple way:

```PowerShell
$appName = "fabric:/FabricObserver"
$appVersion = "3.2.14"
$appVersion = "3.2.15"
$application = Get-ServiceFabricApplication -ApplicationName $appName
$appParamCollection = $application.ApplicationParameters
$applicationParameterMap = @{}
Expand Down
27 changes: 11 additions & 16 deletions FabricObserver.Extensibility.nuspec.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="3.3.0">
<id>%PACKAGE_ID%</id>
<version>3.2.14</version>
<version>3.2.15</version>
<releaseNotes>
This is version is required for observer plugins that target FabricObserver 3.2.14 or ClusterObserver 2.2.8.
#### Changes
- Updated Logger implementatio to fix app param update bug related to log path and max archive lifetime settings not being honored.
- Updated ObserverBase to include guard rails to prevent high CPU consumption if an observer's MonitorDuration or MonitorSleepTimeMilliseconds settings are misconfigured (to high or too low, respectively).
- Performance improvements.
- Updated nuget package dependencies to latest versions.

</releaseNotes>
<authors>Microsoft</authors>
<license type="expression">MIT</license>
Expand All @@ -18,21 +13,21 @@ This is version is required for observer plugins that target FabricObserver 3.2.
<icon>icon.png</icon>
<readme>foextlib.md</readme>
<language>en-US</language>
<description>This package contains the FabricObserver Extensibility library (.NET 6) for use in building FabricObserver and ClusterObserver observers and observer plugins. You need to ensure you use the same versions of this library and CO/FO if you are building observer plugins.</description>
<description>This package contains the FabricObserver Extensibility library (.NET 6) for use in building FabricObserver and ClusterObserver observer plugins in Visual Studio. Each time a new version of FabricObserver is released, a new version of this library (same as FabricObserver's version) will be released to the nuget.org gallery. Unless specified as part of a release with breaking changes that would impact building a plugin (exceedingly rare), you can use earlier versions of this library to build your plugins and they will successfully work with higher versions of FabricObserver/ClusterObserver. In other words, you do not need to rebuild your plugins each time a new version of FabricObserver or ClusterObserver is released unless you are required to, which will be made clear.</description>
<contentFiles>
<files include="**" buildAction="None" copyToOutput="true" />
</contentFiles>
<dependencies>
<group targetFramework="net6.0">
<dependency id="Microsoft.ServiceFabric.Services" version="6.0.1017" />
<dependency id="Microsoft.ApplicationInsights" version="2.21.0" />
<dependency id="Microsoft.ApplicationInsights.NLogTarget" version="2.21.0" />
<dependency id="Microsoft.Extensions.DependencyInjection" version="7.0.0" />
<dependency id="Microsoft.Extensions.DependencyInjection.Abstractions" version="7.0.0" />
<dependency id="Newtonsoft.Json" version="13.0.2" />
<dependency id="NLog" version="5.1.0" />
<dependency id="System.Diagnostics.PerformanceCounter" version="7.0.0" />
<dependency id="System.Management" version="7.0.0" />
<dependency id="Microsoft.ApplicationInsights" version="2.22.0" />
<dependency id="Microsoft.ApplicationInsights.NLogTarget" version="2.22.0" />
<dependency id="Microsoft.Extensions.DependencyInjection" version="8.0.0" />
<dependency id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.0" />
<dependency id="Newtonsoft.Json" version="13.0.3" />
<dependency id="NLog" version="5.2.8" />
<dependency id="System.Diagnostics.PerformanceCounter" version="8.0.0" />
<dependency id="System.Management" version="8.0.0" />
</group>
</dependencies>
<projectUrl>https://aka.ms/sf/FabricObserver</projectUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<RootNamespace>FabricObserver</RootNamespace>
<Copyright>Copyright © 2023</Copyright>
<Product>FabricObserver</Product>
<Version>3.2.14</Version>
<FileVersion>3.2.14</FileVersion>
<Version>3.2.15</Version>
<FileVersion>3.2.15</FileVersion>
<NoWarn>CA1416</NoWarn>
</PropertyGroup>
<ItemGroup>
Expand Down
22 changes: 12 additions & 10 deletions FabricObserver.Extensibility/ObserverBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ public CsvFileWriteFormat CsvWriteFormat
get; set;
}

public bool EmitRawMetricTelemetry => ConfigurationSettings?.EmitRawMetricTelemetry ?? false;

/// <summary>
/// Base type constructor for all observers (both built-in and plugin impls).
/// </summary>
Expand Down Expand Up @@ -576,11 +578,11 @@ public bool DumpWindowsServiceProcess(int processId, string procName, string met
if (Directory.Exists(DumpsPath) && Directory.GetFiles(DumpsPath, $"{dumpKey}*.dmp", SearchOption.AllDirectories).Length >= MaxDumps)
{
ObserverLogger.LogWarning($"Reached maximum number({MaxDumps}) of {dumpKey} dmp files stored on local disk. Will not create dmp file. " +
$"If enabled, please make sure that AzureStorageObserver is configured correctly. " +
$"Will attempt to delete old (>= 1 day) local files now.");
$"If enabled, please make sure that AzureStorageUploadObserver is configured correctly. " +
$"Will attempt to delete old (>= 1 day) local {dumpKey} files now.");

// Clean out old dmp files, if any. Generally, there will only be some dmp files remaining on disk if customer has not configured
// AzureStorageObserver correctly or some error occurred during some stage of the upload process.
// AzureStorageUploadObserver correctly or some error occurred during some stage of the upload process.
Logger.TryCleanFolder(DumpsPath, $"{dumpKey}*.dmp", TimeSpan.FromDays(1));
return false;
}
Expand Down Expand Up @@ -656,7 +658,7 @@ public bool DumpWindowsServiceProcess(int processId, string procName, string met
dumpFileName += $"_{DateTime.Now:ddMMyyyyHHmmssFFF}.dmp";

// Check disk space availability before writing dump file.
string driveName = DumpsPath.Substring(0, 2);
string driveName = DumpsPath[..2];

if (DiskUsage.GetCurrentDiskSpaceUsedPercent(driveName) > 90)
{
Expand Down Expand Up @@ -909,7 +911,7 @@ public void ProcessResourceDataReportHealth<T>(
// Telemetry - This is informational, per reading telemetry, healthstate is irrelevant here. If the process has children, then don't emit this raw data since it will already
// be contained in the ChildProcessTelemetry data instances and AppObserver will have already emitted it.
// Enable this for your observer if you want to send data to ApplicationInsights or LogAnalytics for each resource usage observation it makes per specified metric.
if (IsTelemetryEnabled && replicaOrInstance?.ChildProcesses == null)
if (IsTelemetryEnabled && replicaOrInstance?.ChildProcesses == null && EmitRawMetricTelemetry)
{
_ = TelemetryClient?.ReportMetricAsync(telemetryData, Token);
}
Expand Down Expand Up @@ -960,14 +962,14 @@ public void ProcessResourceDataReportHealth<T>(
};
}

if (IsTelemetryEnabled)
if (IsEtwEnabled)
{
_ = TelemetryClient?.ReportMetricAsync(telemetryData, Token);
ObserverLogger.LogEtw(ObserverConstants.FabricObserverETWEventName, telemetryData);
}

if (IsEtwEnabled)
if (IsTelemetryEnabled && EmitRawMetricTelemetry)
{
ObserverLogger.LogEtw(ObserverConstants.FabricObserverETWEventName, telemetryData);
_ = TelemetryClient?.ReportMetricAsync(telemetryData, Token);
}
}

Expand Down Expand Up @@ -1453,7 +1455,7 @@ public DateTime GetProcessStartTime(int processId)
}
catch (Exception e) when (e is Win32Exception or ArgumentException or InvalidOperationException)
{
ObserverLogger.LogInfo($"Unable to get process start time: {e.Message}. This means process {processId} is no longer running or FO can't access it due to access rights.");
ObserverLogger.LogInfo($"Unable to get start time for process {processId}: {e.Message}.");
}

return DateTime.MinValue;
Expand Down
14 changes: 14 additions & 0 deletions FabricObserver.Extensibility/Utilities/ConfigSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public bool IsObserverTelemetryEnabled
get; set;
}

public bool EmitRawMetricTelemetry
{
get; set;
}

public TimeSpan AsyncTimeout
{
get;
Expand Down Expand Up @@ -109,6 +114,15 @@ private void SetConfigSettings()
IsObserverTelemetryEnabled = telemetryEnabled;
}

// Emit raw metric telemetry per run?
if (bool.TryParse(
GetConfigSettingValue(
ObserverConstants.EmitRawMetricTelemetry),
out bool emitRawObserverTelemetry))
{
EmitRawMetricTelemetry = emitRawObserverTelemetry;
}

// Observer etw enabled?
if (bool.TryParse(
GetConfigSettingValue(
Expand Down
Loading

0 comments on commit 1e27edd

Please sign in to comment.