Search in sources :

Example 6 with Registry

use of org.apache.hudi.common.metrics.Registry in project hudi by apache.

the class FlinkHoodieBackedTableMetadataWriter method initRegistry.

@Override
protected void initRegistry() {
    if (metadataWriteConfig.isMetricsOn()) {
        // should support executor metrics
        Registry registry = Registry.getRegistry("HoodieMetadata");
        this.metrics = Option.of(new HoodieMetadataMetrics(registry));
    } else {
        this.metrics = Option.empty();
    }
}
Also used : Registry(org.apache.hudi.common.metrics.Registry)

Example 7 with Registry

use of org.apache.hudi.common.metrics.Registry in project hudi by apache.

the class TestRegistry method testGetAllMetrics.

@Test
public void testGetAllMetrics() throws Exception {
    String registryName = "testGetAllMetrics";
    Registry r = Registry.getRegistry(registryName);
    Map<String, Long> countsMap = new HashMap<>();
    countsMap.put("one", 1L);
    registerMetrics(countsMap, r);
    Map<String, Long> allMetrics1 = Registry.getAllMetrics(false, true);
    assertTrue(allMetrics1.containsKey(registryName + ".one"));
    countsMap.remove("one");
    countsMap.put("two", 2L);
    registerMetrics(countsMap, r);
    Map<String, Long> allMetrics2 = Registry.getAllMetrics(true, true);
    assertTrue(allMetrics2.containsKey(registryName + ".one"));
    assertTrue(allMetrics2.containsKey(registryName + ".two"));
    Map<String, Long> allMetrics3 = Registry.getAllMetrics(false, true);
    assertTrue(allMetrics3.isEmpty());
}
Also used : HashMap(java.util.HashMap) Registry(org.apache.hudi.common.metrics.Registry) Test(org.junit.jupiter.api.Test)

Example 8 with Registry

use of org.apache.hudi.common.metrics.Registry in project hudi by apache.

the class SparkRDDWriteClient method initWrapperFSMetrics.

@Override
protected void initWrapperFSMetrics() {
    if (config.isMetricsOn()) {
        Registry registry;
        Registry registryMeta;
        JavaSparkContext jsc = ((HoodieSparkEngineContext) context).getJavaSparkContext();
        if (config.isExecutorMetricsEnabled()) {
            // Create a distributed registry for HoodieWrapperFileSystem
            registry = Registry.getRegistry(HoodieWrapperFileSystem.class.getSimpleName(), DistributedRegistry.class.getName());
            ((DistributedRegistry) registry).register(jsc);
            registryMeta = Registry.getRegistry(HoodieWrapperFileSystem.class.getSimpleName() + "MetaFolder", DistributedRegistry.class.getName());
            ((DistributedRegistry) registryMeta).register(jsc);
        } else {
            registry = Registry.getRegistry(HoodieWrapperFileSystem.class.getSimpleName());
            registryMeta = Registry.getRegistry(HoodieWrapperFileSystem.class.getSimpleName() + "MetaFolder");
        }
        HoodieWrapperFileSystem.setMetricsRegistry(registry, registryMeta);
    }
}
Also used : HoodieSparkEngineContext(org.apache.hudi.client.common.HoodieSparkEngineContext) DistributedRegistry(org.apache.hudi.metrics.DistributedRegistry) HoodieWrapperFileSystem(org.apache.hudi.common.fs.HoodieWrapperFileSystem) DistributedRegistry(org.apache.hudi.metrics.DistributedRegistry) Registry(org.apache.hudi.common.metrics.Registry) JavaSparkContext(org.apache.spark.api.java.JavaSparkContext)

Aggregations

Registry (org.apache.hudi.common.metrics.Registry)8 Test (org.junit.jupiter.api.Test)4 HashMap (java.util.HashMap)2 HoodieSparkEngineContext (org.apache.hudi.client.common.HoodieSparkEngineContext)2 DistributedRegistry (org.apache.hudi.metrics.DistributedRegistry)2 SparkRDDWriteClient (org.apache.hudi.client.SparkRDDWriteClient)1 WriteStatus (org.apache.hudi.client.WriteStatus)1 HoodieWrapperFileSystem (org.apache.hudi.common.fs.HoodieWrapperFileSystem)1 HoodieRecord (org.apache.hudi.common.model.HoodieRecord)1 HoodieTimer (org.apache.hudi.common.util.HoodieTimer)1 MetadataMergeWriteStatus (org.apache.hudi.testutils.MetadataMergeWriteStatus)1 JavaSparkContext (org.apache.spark.api.java.JavaSparkContext)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1