public DataCube(string name, DataStatement statement, string assignTo) { NaDrop = new NaDrop(); ReplaceNull = new NullReplace(); ReplaceString = new StringReplace(); this.StatementType = statement; SchemaName = ""; VariableName = name; AssignTo = assignTo; Distrinct = false; SelectStatement = new Select(); GroupByStatement = new GroupBy(); CubeStatement = new Cube(); ExceptStatement = new Except(); IntersectStatement = new Intersect(); DropStatement = new Drop(); JoinStatement = new List <Join>(); RollupStatement = new Rollup(); SearchStatement = new Search(); SortStatement = new SortBy(); LimitStatement = new Limit(); LoadStatement = new Load(); Fields = new List <IField>(); Drop = false; UnionStatement = new Union(); Declaration = new Declaration(); DataWith = new With(); }
public TimeseriesResult GetTimeSeries(string site, int userId, DateTime? start, DateTime? end, Rollup rollup) { //See if the DB contains the whole TimeseriesResult var result = m_timeseriesPersistRepo.GetTimeSeries(site, userId, start, end, rollup); if(result != null) return result; var tsr = GetDummyTimeSeries(); return tsr; }
public TimeseriesResult GetTimeSeries(string site, int userId, DateTime? start, DateTime? end, Rollup rollup) { //See if the DB contains the whole TimeseriesResult var result = m_timeseriesPersistRepo.GetTimeSeries(site, userId, start, end, rollup); if(result != null) return result; this.GetLogger().Info(m=>m("Requesting timeseries for site {0}, user {1}".FormatString(site, userId))); var tsr = RequestTimeSeries(site, userId, start,end, rollup); m_timeseriesPersistRepo.SaveTimeseries(site, userId, tsr); return tsr; }
public TimeseriesResult GetTimeSeries(string site, int userId, DateTime? start, DateTime? end, Rollup rollup) { IQueryable<TSResult> query = from r in m_Entities.TSResults where r.Site == site && r.UserId == userId select r; var result = (from q in query select new { result = new TimeseriesResult { RollupType = (Rollup)q.Rollup }, dbresult = q }) .FirstOrDefault(); if(result != null) { var tags = result.dbresult.TSPeriods.Select(p=>p.tag).Distinct(); var periods = tags.ToDictionary<string, string, Timeseries>(key => key, value => new Timeseries(rollup, result.dbresult.TSPeriods.Where(p => p.tag == value).ToDictionary<TSPeriod, DateTime, TimeseriesPeriod>(periodKey => periodKey.Date, periodValue => periodValue.ToTimeseriesPeriod()) )); result.result.Timeseries = periods; return result.result; } return null; }
/// <summary> /// Get high level statistics about the number of alerts (SMSes, phone calls and emails) sent for the desired time period, summed daily, weekly or monthly /// </summary> /// <param name="since">The start of the date range over which you want to search. The time element is optional.</param> /// <param name="until">The end of the date range over which you want to search.</param> /// <param name="rollup">Specifies the bucket duration for each summation</param> /// <returns></returns> public AlertReport GetAlertsReport(DateTime?since, DateTime?until, Rollup rollup) { var client = this.GetClient("/v1/reports/alerts_per_time"); var req = this.GetRequest(); if (since != null) { req.AddParameter("since", since.Value.ToString("s")); } if (until != null) { req.AddParameter("until", until.Value.ToString("s")); } req.AddParameter("rollup", rollup.ToString()); var resp = client.Execute <AlertReport>(req); if (resp.Data == null) { throw new PagerDutyAPIException(resp); } return(resp.Data); }
public TimeseriesResult RequestTimeSeries(string site, int userId, DateTime? start, DateTime? end, Rollup rollup) { var timeSeriesResult = new TimeseriesResult(rollup); var questionInfos = m_QuestionRepo.Get(site, userId); m_questionPersitRepo.SaveQuestions(site, questionInfos); var questionPoints = from q in questionInfos select q.ToTimeseriesPoint(); var questionIds = from answer in m_AnswerRepo.Get(site, userId) select new InterestPoint { QuestionId = answer.QuestionId, Date = answer.CreationDate }; var answerPoints = GetInterestPoints(site, questionPoints, questionIds, PointType.Answer); if (answerPoints != null) questionPoints = questionPoints.Concat(answerPoints); var commentIds = from comment in m_commentsProcessor.ConvertAnswersToQuestions(site, m_commentsRepository.Get(site, userId)) select new InterestPoint { QuestionId = comment.Id, Date = comment.CreationDate }; var commentPoints = GetInterestPoints(site, questionPoints, commentIds, PointType.Comment); if(commentPoints != null) questionPoints = questionPoints.Concat(commentPoints); foreach(var dataPoint in questionPoints) { foreach(var tag in dataPoint.Tags) { Timeseries ts; if(!timeSeriesResult.Timeseries.TryGetValue(tag, out ts)) ts = timeSeriesResult.Timeseries[tag] = timeSeriesResult.CreateTimeseries(); ts.Add(dataPoint.Date, dataPoint); } } return Filter(timeSeriesResult); }
/// <summary> /// Get high level statistics about the number of alerts (SMSes, phone calls and emails) sent for the desired time period, summed daily, weekly or monthly /// </summary> /// <param name="since">The start of the date range over which you want to search. The time element is optional.</param> /// <param name="until">The end of the date range over which you want to search.</param> /// <param name="rollup">Specifies the bucket duration for each summation</param> /// <returns></returns> public AlertReport GetAlertsReport(DateTime? since, DateTime? until, Rollup rollup) { var client = this.GetClient("/v1/reports/alerts_per_time"); var req = this.GetRequest(); if(since != null){ req.AddParameter("since", since.Value.ToString("s")); } if (until != null) { req.AddParameter("until", until.Value.ToString("s")); } req.AddParameter("rollup", rollup.ToString()); var resp = client.Execute<AlertReport>(req); if (resp.Data == null) { throw new PagerDutyAPIException(resp); } return resp.Data; }
public TimeseriesResult(Rollup rollup, Dictionary<string, Timeseries> values) : this(rollup) { Timeseries = values; }
public TimeseriesResult(Rollup rollup) : this() { m_Rollup = rollup; }