-
Notifications
You must be signed in to change notification settings - Fork 763
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logging to Resource Monitoring (#5355)
* Initial commit * update * update * Fix tests * PR Comments
- Loading branch information
1 parent
5393aee
commit 487f3d2
Showing
97 changed files
with
545 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/Log.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring; | ||
|
||
[SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "Generators.")] | ||
[SuppressMessage("Major Code Smell", "S109:Magic numbers should not be used", Justification = "Generators.")] | ||
internal static partial class Log | ||
{ | ||
[LoggerMessage(1, LogLevel.Debug, | ||
#pragma warning disable S103 // Lines should not be too long | ||
"Computed CPU usage with CgroupCpuTime = {cgroupCpuTime}, HostCpuTime = {hostCpuTime}, PreviousCgroupCpuTime = {previousCgroupCpuTime}, PreviousHostCpuTime = {previousHostCpuTime}, CpuPercentage = {cpuPercentage}.")] | ||
#pragma warning restore S103 // Lines should not be too long | ||
public static partial void CpuUsageData( | ||
ILogger logger, | ||
long cgroupCpuTime, | ||
long hostCpuTime, | ||
long previousCgroupCpuTime, | ||
long previousHostCpuTime, | ||
double cpuPercentage); | ||
|
||
[LoggerMessage(2, LogLevel.Debug, | ||
"Computed memory usage with MemoryUsedInBytes = {memoryUsed}, MemoryLimit = {memoryLimit}, MemoryPercentage = {memoryPercentage}.")] | ||
public static partial void MemoryUsageData( | ||
ILogger logger, | ||
ulong memoryUsed, | ||
double memoryLimit, | ||
double memoryPercentage); | ||
|
||
[LoggerMessage(3, LogLevel.Debug, | ||
"System resources information: CpuLimit = {cpuLimit}, CpuRequest = {cpuRequest}, MemoryLimit = {memoryLimit}, MemoryRequest = {memoryRequest}.")] | ||
public static partial void SystemResourcesInfo(ILogger logger, double cpuLimit, double cpuRequest, ulong memoryLimit, ulong memoryRequest); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.