use of co.cask.cdap.data2.dataset2.lib.table.MetricsTable in project cdap by caskdata.
the class HBaseMetricsTableTest method getTable.
@Override
protected MetricsTable getTable(String name) throws Exception {
DatasetId metricsDatasetInstanceId = NamespaceId.SYSTEM.dataset(name);
DatasetProperties props = TableProperties.builder().setReadlessIncrementSupport(true).build();
return DatasetsUtil.getOrCreateDataset(dsFramework, metricsDatasetInstanceId, MetricsTable.class.getName(), props, null);
}
use of co.cask.cdap.data2.dataset2.lib.table.MetricsTable in project cdap by caskdata.
the class DataMigration method createRegisteredDatasetFramework.
/**
* Sets up a {@link DatasetFramework} instance for standalone usage. NOTE: should NOT be used by applications!!!
*/
public static DatasetFramework createRegisteredDatasetFramework(Injector injector) throws DatasetManagementException, IOException {
DatasetDefinitionRegistryFactory registryFactory = injector.getInstance(DatasetDefinitionRegistryFactory.class);
DatasetFramework datasetFramework = new InMemoryDatasetFramework(registryFactory);
// TODO: this doesn't sound right. find out why its needed.
datasetFramework.addModule(NamespaceId.SYSTEM.datasetModule("table"), new HBaseTableModule());
datasetFramework.addModule(NamespaceId.SYSTEM.datasetModule("metricsTable"), new HBaseMetricsTableModule());
datasetFramework.addModule(NamespaceId.SYSTEM.datasetModule("core"), new CoreDatasetsModule());
datasetFramework.addModule(NamespaceId.SYSTEM.datasetModule("fileSet"), new FileSetModule());
return datasetFramework;
}
use of co.cask.cdap.data2.dataset2.lib.table.MetricsTable in project cdap by caskdata.
the class DefaultMetricDatasetFactory method getOrCreateMetricsTable.
private MetricsTable getOrCreateMetricsTable(String tableName, DatasetProperties props) {
// metrics tables are in the system namespace
DatasetId metricsDatasetInstanceId = NamespaceId.SYSTEM.dataset(tableName);
MetricsTable table = null;
try {
table = DatasetsUtil.getOrCreateDataset(dsFramework, metricsDatasetInstanceId, MetricsTable.class.getName(), props, null);
} catch (Exception e) {
Throwables.propagate(e);
}
return table;
}
use of co.cask.cdap.data2.dataset2.lib.table.MetricsTable in project cdap by caskdata.
the class MetricsDataMigrator method migrateMetricsTableFromVersion27.
private void migrateMetricsTableFromVersion27(Version version) throws DataMigrationException {
EntityTable entityTable = new EntityTable(getOrCreateMetricsTable(entityTableName, DatasetProperties.EMPTY));
MetricsTable metricsTable = getOrCreateMetricsTable(metricsTableName, DatasetProperties.EMPTY);
System.out.println("Migrating Metrics Data from table : " + metricsTableName);
migrateMetricsData(entityTable, metricsTable, null, version);
}
use of co.cask.cdap.data2.dataset2.lib.table.MetricsTable in project cdap by caskdata.
the class DefaultMetricDatasetFactory method getOrCreateFactTable.
// todo: figure out roll time based on resolution from config? See DefaultMetricsTableFactory for example
@Override
public FactTable getOrCreateFactTable(int resolution) {
String tableName = cConf.get(Constants.Metrics.METRICS_TABLE_PREFIX, Constants.Metrics.DEFAULT_METRIC_TABLE_PREFIX) + ".ts." + resolution;
int ttl = cConf.getInt(Constants.Metrics.RETENTION_SECONDS + "." + resolution + ".seconds", -1);
TableProperties.Builder props = TableProperties.builder();
// don't add TTL for MAX_RESOLUTION table. CDAP-1626
if (ttl > 0 && resolution != Integer.MAX_VALUE) {
props.setTTL(ttl);
}
// for efficient counters
props.setReadlessIncrementSupport(true);
// configuring pre-splits
props.add(HBaseTableAdmin.PROPERTY_SPLITS, GSON.toJson(FactTable.getSplits(DefaultMetricStore.AGGREGATIONS.size())));
MetricsTable table = getOrCreateMetricsTable(tableName, props.build());
return new FactTable(table, entityTable.get(), resolution, getRollTime(resolution));
}
Aggregations