Skip to content

Move Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes to stable#7253

Open
amadeuszl wants to merge 5 commits intodotnet:mainfrom
amadeuszl:users/alechniak/move-k8s-package-to-stable
Open

Move Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes to stable#7253
amadeuszl wants to merge 5 commits intodotnet:mainfrom
amadeuszl:users/alechniak/move-k8s-package-to-stable

Conversation

@amadeuszl
Copy link
Contributor

@amadeuszl amadeuszl commented Feb 2, 2026

Microsoft Reviewers: Open in CodeFlow

@amadeuszl
Copy link
Contributor Author

@evgenyfedorov2 We probably should drop reading requests in Linux due to change in formula for weights from #7239.
Here's proposal.

internal sealed class KubernetesResourceQuotaProvider : ResourceQuotaProvider
{
 public override ResourceQuota GetResourceQuota()
 {
     ResourceQuota quota = new()
     {
         BaselineCpuInCores = ConvertMillicoreToCpuUnit(_kubernetesMetadata.RequestsCpu),
         MaxCpuInCores = ConvertMillicoreToCpuUnit(_kubernetesMetadata.LimitsCpu),
         BaselineMemoryInBytes = _kubernetesMetadata.RequestsMemory,
         MaxMemoryInBytes = _kubernetesMetadata.LimitsMemory,
     };

     // On Linux, CPU requests are determined with weights, where eg. 1 CPUs' weight is equal to 1.02539062
     // If we decide to read from K8s metadata it will have different results.
     if (OperatingSystem.IsLinux())
     {
         if (_useLinuxCalculationV2)
         {
             quota.BaselineCpuInCores = _parser.GetCgroupRequestCpuV2();
         }
         else
         {
             quota.BaselineCpuInCores = _parser.GetCgroupRequestCpu();
         }
     }

     if (quota.BaselineCpuInCores <= 0.0)
     {
         quota.BaselineCpuInCores = quota.MaxCpuInCores;
     }

     if (quota.BaselineMemoryInBytes == 0)
     {
         quota.BaselineMemoryInBytes = quota.MaxMemoryInBytes;
     }

     return quota;
 }
}

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR transitions the Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes library from experimental/dev stage to stable by removing experimental attributes and increasing quality thresholds. However, there is a critical issue with an invalid Stage value that must be corrected.

Changes:

  • Removes experimental attribute injection and dev stage diagnostic ID (EXTEXP0016)
  • Changes Stage from "dev" to "stable" (invalid - should be "normal")
  • Increases MinMutationScore requirement from 90 to 95

amadeuszl and others added 3 commits February 2, 2026 12:36
…ing.Kubernetes/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes.csproj

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need this file? I don't remember having to generate it here https://github.com/dotnet/extensions/pull/7161/changes, for instance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting failures in the build because of lack of the experimental flag for new API. I though it will disable it but it didn't, the <EnablePackageValidation>false</EnablePackageValidation> is not fixing that either.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amadeuszl amadeuszl requested a review from a team as a code owner February 4, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants