Skip to content

Commit 342b73d

Browse files
Ilia Shakitkoyadvr
authored andcommitted
CLOUDSTACK-7903: Decreased minimal usage aggregation range value
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> (cherry picked from commit 9b90790) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> Conflicts: server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
1 parent 62b9ae1 commit 342b73d

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@
224224
import com.cloud.offerings.dao.NetworkOfferingDao;
225225
import com.cloud.resource.ResourceManager;
226226
import com.cloud.server.ConfigurationServer;
227+
import com.cloud.server.StatsCollector;
227228
import com.cloud.service.ServiceOfferingVO;
228229
import com.cloud.service.dao.ServiceOfferingDao;
229230
import com.cloud.storage.VMTemplateVO;
@@ -425,8 +426,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
425426
private int _usageAggregationRange = 1440;
426427
private String _usageTimeZone = "GMT";
427428
private final long mgmtSrvrId = MacAddress.getMacAddress().toLong();
428-
private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 5; // 5 seconds
429-
private static final int USAGE_AGGREGATION_RANGE_MIN = 10; // 10 minutes, same as com.cloud.usage.UsageManagerImpl.USAGE_AGGREGATION_RANGE_MIN
429+
private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 5; // 5 seconds
430430
private boolean _dailyOrHourly = false;
431431

432432
ScheduledExecutorService _executor;
@@ -809,9 +809,9 @@ public boolean start() {
809809
_dailyOrHourly = false;
810810
}
811811

812-
if (_usageAggregationRange < USAGE_AGGREGATION_RANGE_MIN) {
813-
s_logger.warn("Usage stats job aggregation range is to small, using the minimum value of " + USAGE_AGGREGATION_RANGE_MIN);
814-
_usageAggregationRange = USAGE_AGGREGATION_RANGE_MIN;
812+
if (_usageAggregationRange < StatsCollector.USAGE_AGGREGATION_RANGE_MIN) {
813+
s_logger.warn("Usage stats job aggregation range is to small, using the minimum value of " + StatsCollector.USAGE_AGGREGATION_RANGE_MIN);
814+
_usageAggregationRange = StatsCollector.USAGE_AGGREGATION_RANGE_MIN;
815815
}
816816

817817
_networkStatsUpdateExecutor.scheduleAtFixedRate(new NetworkStatsUpdateTask(), (endDate - System.currentTimeMillis()), (_usageAggregationRange * 60 * 1000),

‎server/src/com/cloud/server/StatsCollector.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
199199
private String _usageTimeZone = "GMT";
200200
private final long mgmtSrvrId = MacAddress.getMacAddress().toLong();
201201
private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 5; // 5 seconds
202-
private static final int USAGE_AGGREGATION_RANGE_MIN = 10; // 10 minutes, same to com.cloud.usage.UsageManagerImpl.USAGE_AGGREGATION_RANGE_MIN
202+
public static final int USAGE_AGGREGATION_RANGE_MIN = 1;
203203
private boolean _dailyOrHourly = false;
204204

205205
//private final GlobalLock m_capacityCheckLock = GlobalLock.getInternLock("capacity.check");

‎usage/src/com/cloud/usage/UsageManagerImpl.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.apache.cloudstack.usage.UsageTypes;
4343

4444
import com.cloud.alert.AlertManager;
45+
import com.cloud.server.StatsCollector;
4546
import com.cloud.event.EventTypes;
4647
import com.cloud.event.UsageEventVO;
4748
import com.cloud.event.UsageEventDetailsVO;
@@ -100,7 +101,6 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
100101
private static final int HOURLY_TIME = 60;
101102
private static final int DAILY_TIME = 60 * 24;
102103
private static final int THREE_DAYS_IN_MINUTES = 60 * 24 * 3;
103-
private static final int USAGE_AGGREGATION_RANGE_MIN = 10;
104104

105105
@Inject
106106
private AccountDao _accountDao;
@@ -246,9 +246,9 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
246246
s_logger.debug("Current Time: " + currentDate.toString());
247247

248248
_aggregationDuration = Integer.parseInt(aggregationRange);
249-
if (_aggregationDuration < USAGE_AGGREGATION_RANGE_MIN) {
250-
s_logger.warn("Usage stats job aggregation range is to small, using the minimum value of " + USAGE_AGGREGATION_RANGE_MIN);
251-
_aggregationDuration = USAGE_AGGREGATION_RANGE_MIN;
249+
if (_aggregationDuration < StatsCollector.USAGE_AGGREGATION_RANGE_MIN) {
250+
s_logger.warn("Usage stats job aggregation range is to small, using the minimum value of " + StatsCollector.USAGE_AGGREGATION_RANGE_MIN);
251+
_aggregationDuration = StatsCollector.USAGE_AGGREGATION_RANGE_MIN;
252252
}
253253
_hostname = InetAddress.getLocalHost().getHostName() + "/" + InetAddress.getLocalHost().getHostAddress();
254254
} catch (NumberFormatException ex) {

0 commit comments

Comments
 (0)