public async Task <IReadOnlyList <CounterSummary> > GetCountersByPrefix(string groupName, string counterNamePrefix = null, int skip = 0, int take = 1024, CancellationToken token = default(CancellationToken)) { if (string.IsNullOrWhiteSpace(groupName)) { throw new ArgumentNullException(nameof(groupName)); } parent.AssertInitialized(); await parent.ReplicationInformer.UpdateReplicationInformationIfNeededAsync().ConfigureAwait(false); var summaries = await parent.ReplicationInformer.ExecuteWithReplicationAsync(parent.Url, HttpMethods.Get, async (url, counterStoreName) => { var requestUriString = $"{url}/cs/{counterStoreName}/by-prefix?skip={skip}&take={take}&groupName={groupName}"; if (!string.IsNullOrWhiteSpace(counterNamePrefix)) { requestUriString += $"&counterNamePrefix={counterNamePrefix}"; } using (var request = parent.CreateHttpJsonRequest(requestUriString, HttpMethods.Get)) { var response = await request.ReadResponseJsonAsync().WithCancellation(token).ConfigureAwait(false); return(response.ToObject <List <CounterSummary> >()); } }, token).ConfigureAwait(false); return(summaries); }
public async Task <IReadOnlyList <CounterNameGroupPair> > GetCounterStorageNameAndGroups(string counterStorageName = null, CancellationToken token = default(CancellationToken), int skip = 0, int take = 1024) { parent.AssertInitialized(); var requestUriString = $"{parent.Url}/admin/cs/{counterStorageName ?? parent.Name}?op=groups-names&skip={skip}&take={take}"; using (var request = parent.CreateHttpJsonRequest(requestUriString, HttpMethods.Get)) { var response = await request.ReadResponseJsonAsync().WithCancellation(token).ConfigureAwait(false); return(response.ToObject <List <CounterNameGroupPair> >(parent.JsonSerializer)); } }