Search in sources :

Example 6 with ValueOnlyColumnBuilder

use of org.apache.metron.profiler.hbase.ValueOnlyColumnBuilder in project metron by apache.

the class ProfileWriter method main.

public static void main(String[] args) {
    RowKeyBuilder rowKeyBuilder = new SaltyRowKeyBuilder();
    ColumnBuilder columnBuilder = new ValueOnlyColumnBuilder();
    Configuration config = HBaseConfiguration.create();
    config.set("hbase.master.hostname", "node1");
    config.set("hbase.regionserver.hostname", "node1");
    config.set("hbase.zookeeper.quorum", "node1");
    HTableProvider provider = new HTableProvider();
    String tableName = "profiler";
    long periodDurationMillis = TimeUnit.MINUTES.toMillis(15);
    long when = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(2);
    ProfileMeasurement measure = new ProfileMeasurement().withProfileName("profile1").withEntity("192.168.66.121").withPeriod(when, periodDurationMillis, TimeUnit.MILLISECONDS);
    ProfileWriter writer = new ProfileWriter(rowKeyBuilder, columnBuilder, provider, periodDurationMillis, tableName, config);
    writer.write(measure, 2 * 24 * 4, Collections.emptyList(), val -> new Random().nextInt(10));
}
Also used : SaltyRowKeyBuilder(org.apache.metron.profiler.hbase.SaltyRowKeyBuilder) HTableProvider(org.apache.metron.hbase.HTableProvider) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) Configuration(org.apache.hadoop.conf.Configuration) Random(java.util.Random) ValueOnlyColumnBuilder(org.apache.metron.profiler.hbase.ValueOnlyColumnBuilder) SaltyRowKeyBuilder(org.apache.metron.profiler.hbase.SaltyRowKeyBuilder) RowKeyBuilder(org.apache.metron.profiler.hbase.RowKeyBuilder) ColumnBuilder(org.apache.metron.profiler.hbase.ColumnBuilder) ValueOnlyColumnBuilder(org.apache.metron.profiler.hbase.ValueOnlyColumnBuilder) ProfileMeasurement(org.apache.metron.profiler.ProfileMeasurement)

Aggregations

ValueOnlyColumnBuilder (org.apache.metron.profiler.hbase.ValueOnlyColumnBuilder)6 ColumnBuilder (org.apache.metron.profiler.hbase.ColumnBuilder)5 RowKeyBuilder (org.apache.metron.profiler.hbase.RowKeyBuilder)4 SaltyRowKeyBuilder (org.apache.metron.profiler.hbase.SaltyRowKeyBuilder)4 MockHBaseTableProvider (org.apache.metron.hbase.mock.MockHBaseTableProvider)3 DefaultStellarStatefulExecutor (org.apache.metron.stellar.common.DefaultStellarStatefulExecutor)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 Table (org.apache.hadoop.hbase.client.Table)2 ProfileWriter (org.apache.metron.profiler.client.ProfileWriter)2 SimpleFunctionResolver (org.apache.metron.stellar.dsl.functions.resolver.SimpleFunctionResolver)2 File (java.io.File)1 Properties (java.util.Properties)1 Random (java.util.Random)1 Configuration (org.apache.hadoop.conf.Configuration)1 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)1 HTableProvider (org.apache.metron.hbase.HTableProvider)1 TableProvider (org.apache.metron.hbase.TableProvider)1 ComponentRunner (org.apache.metron.integration.ComponentRunner)1 FluxTopologyComponent (org.apache.metron.integration.components.FluxTopologyComponent)1 KafkaComponent (org.apache.metron.integration.components.KafkaComponent)1