// LIMIT ////////////////////////////////////////////////////////////////////// //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testMeterQueryLimit() public virtual void testMeterQueryLimit() { //since generating test data of 200 metrics will take a long time we check if the default values are set of the query //given metric query MetricsQueryImpl query = (MetricsQueryImpl)managementService.createMetricsQuery(); //when no changes are made //then max results are 200, lastRow 201, offset 0, firstRow 1 assertEquals(1, query.FirstRow); assertEquals(0, query.FirstResult); assertEquals(200, query.MaxResults); assertEquals(201, query.LastRow); }
public virtual long?executeSelectSum(MetricsQueryImpl query) { long?result = (long?)DbEntityManager.selectOne(SELECT_METER_SUM, query); result = result != null ? result : 0; if (shouldAddCurrentUnloggedCount(query)) { // add current unlogged count Meter meter = Context.ProcessEngineConfiguration.MetricsRegistry.getMeterByName(query.Name); if (meter != null) { result += meter.get(); } } return(result); }
public virtual long?ExecuteSelectSum(MetricsQueryImpl query) { throw new NotImplementedException(); //long? result = (long?)DbEntityManager.SelectOne(SelectMeterSum, query); //result = result != null ? result : 0; //if (ShouldAddCurrentUnloggedCount(query)) //{ // // add current unlogged count // Meter meter = context.Impl.Context.ProcessEngineConfiguration.MetricsRegistry.GetMeterByName(query.Name); // if (meter != null) // { // result += meter.get(); // } //} //return result; }
public virtual IList <MetricIntervalValue> executeSelectInterval(MetricsQueryImpl query) { IList <MetricIntervalValue> intervalResult = DbEntityManager.selectList(SELECT_METER_INTERVAL, query); intervalResult = intervalResult != null ? intervalResult : new List <MetricIntervalValue>(); string reporterId = Context.ProcessEngineConfiguration.DbMetricsReporter.MetricsCollectionTask.Reporter; if (intervalResult.Count > 0 && isEndTimeAfterLastReportInterval(query) && !string.ReferenceEquals(reporterId, null)) { IDictionary <string, Meter> metrics = Context.ProcessEngineConfiguration.MetricsRegistry.Meters; string queryName = query.Name; //we have to add all unlogged metrics to last interval if (!string.ReferenceEquals(queryName, null)) { MetricIntervalEntity intervalEntity = (MetricIntervalEntity)intervalResult[0]; long entityValue = intervalEntity.Value; if (metrics[queryName] != null) { entityValue += metrics[queryName].get(); } intervalEntity.Value = entityValue; } else { ISet <string> metricNames = metrics.Keys; DateTime lastIntervalTimestamp = intervalResult[0].Timestamp; foreach (string metricName in metricNames) { MetricIntervalEntity entity = new MetricIntervalEntity(lastIntervalTimestamp, metricName, reporterId); int idx = intervalResult.IndexOf(entity); if (idx >= 0) { MetricIntervalEntity intervalValue = (MetricIntervalEntity)intervalResult[idx]; intervalValue.Value = intervalValue.Value + metrics[metricName].get(); } } } } return(intervalResult); }
protected internal virtual bool shouldAddCurrentUnloggedCount(MetricsQueryImpl query) { return(!string.ReferenceEquals(query.Name, null) && isEndTimeAfterLastReportInterval(query)); }
protected internal virtual bool isEndTimeAfterLastReportInterval(MetricsQueryImpl query) { long reportingIntervalInSeconds = Context.ProcessEngineConfiguration.DbMetricsReporter.ReportingIntervalInSeconds; return(query.EndDate == null || query.EndDateMilliseconds >= ClockUtil.CurrentTime.Ticks - (1000 * reportingIntervalInSeconds)); }