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

 ##########
 File path: server/src/main/java/com/cloud/server/StatsCollector.java
 ##########
 @@ -411,7 +461,42 @@ private void init(Map<String, String> configs) {
 
     }
 
-    class HostCollector extends ManagedContextRunnable {
+    /**
+     * Configures the database name according to the URI path. For instance, 
if the URI is as influxdb://address:port/dbname, the database name will be 
'dbname'.
+     */
+    protected String configureDatabaseName(URI uri) {
+        String dbname = StringUtils.removeStart(uri.getPath(), "/");
+        if (StringUtils.isBlank(dbname)) {
+            return DEFAULT_DATABASE_NAME;
+        } else {
+            return dbname;
+        }
+    }
+
+    /**
+     * Configures the port to be used when connecting with the stats collector 
service.
+     * Default values are 8086 for influx DB and 2003 for GraphiteDB.
+     * Throws URISyntaxException in case of non configured port and external 
StatsType
+     */
+    protected int configureExternalStatsPort(URI uri) throws 
URISyntaxException {
 
 Review comment:
   Are you configuring a port? Or, are you retrieving a port? I mean, when you 
configure, I would expect a set something somewhere. Here, I see you checking a 
few things, returning some data according to some conditions, and using some 
defaults.

----------------------------------------------------------------
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