private async Task <ICollection <MetricValueSet> > Fetch(FetchData data) { CloudException thrown = null; try { var values = await MetricsClientFacade.ListValuesAsync( _credentials, data.ResourceId, data.MetricNames, "", data.TimeGrain, data.From, data.Till); return(values.MetricValueSetCollection.Value); } catch (CloudException e) { thrown = e; } if (thrown.Response.StatusCode == System.Net.HttpStatusCode.BadRequest && thrown.Message.Contains(TooManyValuesErrorMessage)) { if (!data.PartitionTresholdReached()) { return(await PartitionAndFetch(data)); } } throw thrown; }
private async Task<ICollection<MetricValueSet>> Fetch(FetchData data) { CloudException thrown = null; try { var values = await MetricsClientFacade.ListValuesAsync( _credentials, data.ResourceId, data.MetricNames, "", data.TimeGrain, data.From, data.Till); return values.MetricValueSetCollection.Value; } catch(CloudException e) { thrown = e; } if(thrown.Response.StatusCode == System.Net.HttpStatusCode.BadRequest && thrown.Message.Contains(TooManyValuesErrorMessage)) { if(!data.PartitionTresholdReached()) { return await PartitionAndFetch(data); } } throw thrown; }