GetWebsiteMetricsPerInterval() public method

Gets the website metrics in the requested interval backwards from datetime.now
public GetWebsiteMetricsPerInterval ( System.TimeSpan span ) : List
span System.TimeSpan
return List
        /// <summary>
        /// Updates the website based on the scale option 
        /// </summary>
        public WasabiWebState MonitorAndScale()
        {
            _timer.Elapsed += (sender, args) => _stateHistory.Add(DateTime.Now, MonitorAndScale());

            EnsureManagementCertificate();

            // use the certificate to run the client and command
            var client = new WebsiteClient(SubscriptionId, ManagementCertificate, _engine.WebsiteName);
            // get the metrics for the timer time period
            var metrics = client.GetWebsiteMetricsPerInterval(TimeSpan.FromMinutes(_engine.SamplesPeriodInMins));
            if(metrics.Count == 0)
                return WasabiWebState.LeaveUnchanged;

            var scalePotential = _engine.Scale(Operation, metrics);
            // with the scale potential we'll need to increase or decrease the instance count
            if (scalePotential == WasabiWebState.ScaleDown && client.InstanceCount > 1)
                client.InstanceCount -= 1;
            if (scalePotential == WasabiWebState.ScaleUp && client.InstanceCount < 10)
                client.InstanceCount += 1;
            client.Update();
            // raise the event now
            if(ScaleUpdate != null)
                ScaleUpdate(scalePotential, client.InstanceCount);

            return scalePotential;
        }
        /// <summary>
        /// Raises the alert event if any of the metrics have been breached in the time period
        /// </summary>
        public void MonitorAndAlert()
        {
            EnsureManagementCertificate();

            // use the certificate to run the client and command
            var client = new WebsiteClient(SubscriptionId, ManagementCertificate, _engine.WebsiteName);
            // get the metrics for the timer time period
            var metrics = client.GetWebsiteMetricsPerInterval(TimeSpan.FromMinutes(_engine.SamplesPeriodInMins));
            // enumerate the metrics piece by piece
            foreach (var metric in metrics)
            {
                // check for the metric to ensure it's in the collection otherwise discard it
                if (_engine[metric.Name] == null)
                    continue;
                var rule = _engine[metric.Name];
                if ((metric.Total > rule.IsGreaterThan || metric.Total < rule.IsLessThan) && SubscribeAlerts != null)
                {
                    SubscribeAlerts(metric, rule);
                }
            }
        }