rafaelweingartner commented on a change in pull request #3078: Add influxdb to 
statscollector
URL: https://github.com/apache/cloudstack/pull/3078#discussion_r239602770
 
 

 ##########
 File path: server/src/main/java/com/cloud/server/StatsCollector.java
 ##########
 @@ -288,24 +336,25 @@ private void init(Map<String, String> configs) {
         volumeStatsInterval = 
NumbersUtil.parseLong(configs.get("volume.stats.interval"), 600000L);
         autoScaleStatsInterval = 
NumbersUtil.parseLong(configs.get("autoscale.stats.interval"), 60000L);
 
-        /* URI to send statistics to. Currently only Graphite is supported */
-        String externalStatsUri = configs.get("stats.output.uri");
-        if (externalStatsUri != null && !externalStatsUri.equals("")) {
+        String statsUri = statsOutputUri.value();
+        if (StringUtils.isNotBlank(statsUri)) {
             try {
-                URI uri = new URI(externalStatsUri);
-                String scheme = uri.getScheme();
+                URI uri = new URI(statsUri);
+                externalStatsScheme = uri.getScheme();
 
                 try {
-                    externalStatsType = 
ExternalStatsProtocol.valueOf(scheme.toUpperCase());
+                    externalStatsType = 
ExternalStatsProtocol.valueOf(externalStatsScheme.toUpperCase());
                 } catch (IllegalArgumentException e) {
-                    s_logger.info(scheme + " is not a valid protocol for 
external statistics. No statistics will be send.");
+                    s_logger.error(externalStatsScheme + " is not a valid 
protocol for external statistics. No statistics will be send.");
                 }
 
                 if (!StringUtils.isEmpty(uri.getHost())) {
 
 Review comment:
   what about using `StringUtils.isNotEmpty` instead?
   Also, if it is empty, should not you throw an exception then?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to