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();
}
}
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());
}
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);
}
}
Aggregations