Skip to content

Commit

Permalink
Collect AKS attach rate numerator (Azure#39663)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajkumar-rangaraj authored Nov 1, 2023
1 parent 2ea411a commit d73a82a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ internal static class EnvironmentVariableConstants
/// </summary>
public const string WEBSITE_SITE_NAME = "WEBSITE_SITE_NAME";

/// <summary>
/// INTERNAL ONLY. Used by Statsbeat to get the Kubernetes Service Host.
/// </summary>
public const string KUBERNETES_SERVICE_HOST = "KUBERNETES_SERVICE_HOST";

/// <summary>
/// INTERNAL ONLY. Used by Statsbeat to get the AKS ARM Namespace ID.
/// </summary>
public const string AKS_ARM_NAMESPACE_ID = "AKS_ARM_NAMESPACE_ID";

/// <summary>
/// When set to true, exporter will emit resources as metric telemetry.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ private void SetResourceProviderDetails(IPlatform platform)
return;
}

var kubernetesSrvHost = platform.GetEnvironmentVariable(EnvironmentVariableConstants.KUBERNETES_SERVICE_HOST);
if (kubernetesSrvHost != null)
{
_resourceProvider = "aks";
_resourceProviderId = platform.GetEnvironmentVariable(EnvironmentVariableConstants.AKS_ARM_NAMESPACE_ID) ?? "unknown";

return;
}

_resourceProvider = "unknown";
_resourceProviderId = "unknown";
}
Expand Down

0 comments on commit d73a82a

Please sign in to comment.