public DisplayCounterRecords GetLatestCounterRecord(string path, string name, string group = null, int count = 30) { string me = whoami(); if (string.IsNullOrEmpty(group)) { group = MembershipHelper.DefaultGroup(me); } else { MembershipHelper.CheckMembership(group, me); } CounterSet counterSet = _counterManager.GetCounterSet(group, name); if (counterSet == null) { throw new CounterSetNotFoundException(); } int start = counterSet.RecordCount - count > 0 ? counterSet.RecordCount - count : 0; List <DisplayRecord> records = new List <DisplayRecord>(); foreach (var record in _counterManager.GetCounterRecords(name, group, start)) { DisplayRecord rec = new DisplayRecord(record.Key, CounterRecordHelper.GetValue(record, path)); records.Add(rec); } return(new DisplayCounterRecords(name, group, path, start, records)); }
public DisplayCounterRecords GetCounterRecord(string path, string name, string group = null, int start = 0, int end = -1) { string me = whoami(); if (string.IsNullOrEmpty(group)) { group = MembershipHelper.DefaultGroup(me); } else { MembershipHelper.CheckMembership(group, me); } List <DisplayRecord> records = new List <DisplayRecord>(); foreach (var record in _counterManager.GetCounterRecords(name, group, start, end)) { DisplayRecord rec = new DisplayRecord(record.Key, CounterRecordHelper.GetValue(record, path)); records.Add(rec); } return(new DisplayCounterRecords(name, group, path, start, records)); }