internal bool IsHostHealthy(bool throwWhenUnhealthy = false)
        {
            if (!ShouldMonitorHostHealth)
            {
                return(true);
            }

            var exceededCounters = new Collection <string>();

            if (PerformanceManager.IsUnderHighLoad(exceededCounters))
            {
                string formattedCounters = string.Join(", ", exceededCounters);
                if (throwWhenUnhealthy)
                {
                    throw new InvalidOperationException($"Host thresholds exceeded: [{formattedCounters}]. For more information, see https://aka.ms/functions-thresholds.");
                }
                return(false);
            }

            return(true);
        }
        internal bool IsHostHealthy(bool throwWhenUnhealthy = false)
        {
            if (!_config.HostHealthMonitorEnabled || !_settingsManager.IsAzureEnvironment)
            {
                return(true);
            }

            var exceededCounters = new Collection <string>();

            if (PerformanceManager.IsUnderHighLoad(exceededCounters))
            {
                string formattedCounters = string.Join(", ", exceededCounters);
                if (throwWhenUnhealthy)
                {
                    throw new InvalidOperationException($"Host thresholds exceeded: [{formattedCounters}]");
                }
                return(false);
            }

            return(true);
        }