use of com.creditease.uav.feature.healthmanager.datastore.adaptors.NodeInfoDataAdapter in project uavstack by uavorg.
the class HealthManager method buildDataStores.
private void buildDataStores(IConfigurationManager icm) {
// log
String logKey = MonitorDataFrame.MessageType.Log.toString();
// monitor
String monitorKey = MonitorDataFrame.MessageType.Monitor.toString();
// profile
String profileKey = MonitorDataFrame.MessageType.Profile.toString();
// notification
String notifyKey = MonitorDataFrame.MessageType.Notification.toString();
// nodeinfo
String nodeinfoKey = MonitorDataFrame.MessageType.NodeInfo.toString();
String caching = icm.getFeatureConfiguration(this.feature, logKey + ".ds.cache");
String maxResultSize = icm.getFeatureConfiguration(this.feature, logKey + ".ds.maxResultSize");
String reverse = icm.getFeatureConfiguration(this.feature, logKey + ".ds.reverse");
String psize = icm.getFeatureConfiguration(this.feature, logKey + ".ds.pagesize");
Map<String, Object> lctx = new HashMap<String, Object>();
lctx.put(DataStoreProtocol.HBASE_QUERY_CACHING, caching);
lctx.put(DataStoreProtocol.HBASE_QUERY_MAXRESULTSIZE, maxResultSize);
lctx.put(DataStoreProtocol.HBASE_QUERY_REVERSE, DataConvertHelper.toBoolean(Boolean.valueOf(reverse), true));
lctx.put(DataStoreProtocol.HBASE_QUERY_PAGESIZE, DataConvertHelper.toLong(Long.valueOf(psize), 3000));
// build log ds
buildDataStore(icm, logKey, DataStoreType.HBASE, new LogDataAdapter(), lctx);
Map<String, Object> mctx = new HashMap<String, Object>();
mctx.put(DataStoreProtocol.OPENTSDB_CLIENT_MAXPERROUTE, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, monitorKey + ".ds.maxPerRoute"), 10));
mctx.put(DataStoreProtocol.OPENTSDB_CLIENT_MAXROUTE, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, monitorKey + ".ds.maxRoute"), 50));
mctx.put(DataStoreProtocol.OPENTSDB_CLIENT_SOTIMEOUT, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, monitorKey + ".ds.soTimeout"), 5000));
mctx.put(DataStoreProtocol.OPENTSDB_CLIENT_CONNTIMEOUT, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, monitorKey + ".ds.connTimeout"), 5000));
mctx.put(DataStoreProtocol.OPENTSDB_CLIENT_REQTIMEOUT, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, monitorKey + ".ds.reqTimeout"), 5000));
// build monitor ds
buildDataStore(icm, monitorKey, DataStoreType.OPENTSDB, new MonitorDataAdapter(), mctx);
// build profile ds
buildDataStore(icm, profileKey, DataStoreType.MONGODB, new ProfileDataAdpater(), null);
// build notify ds
buildDataStore(icm, notifyKey, DataStoreType.MONGODB, new NotifyDataAdpater(), null);
Map<String, Object> nctx = new HashMap<String, Object>();
nctx.put(DataStoreProtocol.OPENTSDB_CLIENT_MAXPERROUTE, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, nodeinfoKey + ".ds.maxPerRoute"), 10));
nctx.put(DataStoreProtocol.OPENTSDB_CLIENT_MAXROUTE, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, nodeinfoKey + ".ds.maxRoute"), 50));
nctx.put(DataStoreProtocol.OPENTSDB_CLIENT_SOTIMEOUT, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, nodeinfoKey + ".ds.soTimeout"), 5000));
nctx.put(DataStoreProtocol.OPENTSDB_CLIENT_CONNTIMEOUT, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, nodeinfoKey + ".ds.connTimeout"), 5000));
nctx.put(DataStoreProtocol.OPENTSDB_CLIENT_REQTIMEOUT, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, nodeinfoKey + ".ds.reqTimeout"), 5000));
// build nodeinfo ds
buildDataStore(icm, nodeinfoKey, DataStoreType.OPENTSDB, new NodeInfoDataAdapter(), nctx);
}
Aggregations