-
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.
[release/8.9] Revert correct Meter name (#5406)
* Revert correct Meter name * Unit tests for ResourceMonitoring meter name * Fixed Windows test on Linuz * Increase patch number --------- Co-authored-by: gitmln <nbaraka@gmail.com> Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
- Loading branch information
1 parent
f5b6188
commit 544b8d5
Showing
10 changed files
with
118 additions
and
5 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
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
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
41 changes: 41 additions & 0 deletions
41
...ies/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Helpers/TestMeterFactory.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,41 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.Metrics; | ||
|
||
namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Test.Helpers; | ||
|
||
internal class TestMeterFactory : IMeterFactory | ||
{ | ||
public List<Meter> Meters { get; } = new List<Meter>(); | ||
|
||
public Meter Create(MeterOptions options) | ||
{ | ||
var meter = new Meter(options.Name, options.Version, Array.Empty<KeyValuePair<string, object?>>(), scope: this); | ||
Meters.Add(meter); | ||
|
||
return meter; | ||
} | ||
|
||
public Meter Create(string name) | ||
{ | ||
return Create(new MeterOptions(name) | ||
{ | ||
Version = null, | ||
Tags = null, | ||
Scope = null | ||
}); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
foreach (var meter in Meters) | ||
{ | ||
meter.Dispose(); | ||
} | ||
|
||
Meters.Clear(); | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
...sions.Diagnostics.ResourceMonitoring.Tests/Linux/Resources/DummyLinuxUtilizationParser.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,18 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux; | ||
|
||
namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test; | ||
|
||
internal class DummyLinuxUtilizationParser : ILinuxUtilizationParser | ||
{ | ||
public ulong GetAvailableMemoryInBytes() => 1; | ||
public long GetCgroupCpuUsageInNanoseconds() => 0; | ||
public float GetCgroupLimitedCpus() => 1; | ||
public float GetCgroupRequestCpu() => 1; | ||
public ulong GetHostAvailableMemory() => 0; | ||
public float GetHostCpuCount() => 1; | ||
public long GetHostCpuUsageInNanoseconds() => 0; | ||
public ulong GetMemoryUsageInBytes() => 0; | ||
} |
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