synchronized JvmMetrics init(String processName, String sessionId) { if (impl == null) { impl = create(processName, sessionId, DefaultMetricsSystem.instance()); } return impl; } }
synchronized JvmMetrics init(String processName, String sessionId) { if (impl == null) { impl = create(processName, sessionId, DefaultMetricsSystem.instance()); } return impl; }
public QueryMetrics registerWith(String name) { return DefaultMetricsSystem.instance().register(name, "Query", this); } }
void registerMetrics2Source(String namespace) { final String name = "DecayRpcSchedulerMetrics2." + namespace; DefaultMetricsSystem.instance().register(name, name, this); }
@Override public void run() { if (LOG.isTraceEnabled()) { LOG.trace("Clearing JMX mbean cache."); } // This is pretty extreme but it's the best way that // I could find to get metrics to be removed. try { if (DefaultMetricsSystem.instance() != null) { DefaultMetricsSystem.instance().stop(); // Sleep some time so that the rest of the hadoop metrics // system knows that things are done Thread.sleep(500); DefaultMetricsSystem.instance().start(); } } catch (Exception exception) { LOG.debug("error clearing the jmx it appears the metrics system hasn't been started", exception); } } }
public static RpcMetrics create(Server server, Configuration conf) { RpcMetrics m = new RpcMetrics(server, conf); return DefaultMetricsSystem.instance().register(m.name, null, m); }
public static RpcDetailedMetrics create(int port) { RpcDetailedMetrics m = new RpcDetailedMetrics(port); return DefaultMetricsSystem.instance().register(m.name, null, m); }
void unregisterSource(String namespace) { final String name = "DecayRpcSchedulerMetrics2." + namespace; DefaultMetricsSystem.instance().unregisterSource(name); if (decayRpcSchedulerInfoBeanName != null) { MBeans.unregister(decayRpcSchedulerInfoBeanName); } }
synchronized void shutdown() { DefaultMetricsSystem.instance().unregisterSource(JvmMetrics.name()); impl = null; } }
public static RetryCacheMetrics create(RetryCache cache) { RetryCacheMetrics m = new RetryCacheMetrics(cache); return DefaultMetricsSystem.instance().register(m.name, null, m); }
static UgiMetrics create() { return DefaultMetricsSystem.instance().register(new UgiMetrics()); }
/** * Get a metric by given directory name. * * @param dirName directory name * @return the metric */ public synchronized static ReadWriteDiskValidatorMetrics getMetric( String dirName) { MetricsSystem ms = DefaultMetricsSystem.instance(); ReadWriteDiskValidatorMetrics metrics = DIR_METRICS.get(dirName); if (metrics == null) { metrics = new ReadWriteDiskValidatorMetrics(); // Register with the MetricsSystems if (ms != null) { metrics = ms.register(sourceName(dirName), "Metrics for directory: " + dirName, metrics); } DIR_METRICS.put(dirName, metrics); } return metrics; }
@VisibleForTesting public synchronized void registerIfNeeded(){ // during tests impl might exist, but is not registered MetricsSystem ms = DefaultMetricsSystem.instance(); if (ms.getSource("JvmMetrics") == null) { ms.register(JvmMetrics.name(), JvmMetrics.description(), this); } }
DefaultMetricsSystem.instance().register(info.getMetricsJmxContext(), info.getMetricsDescription(), adapter); registeredSources.put(info, adapter); LOG.debug("Removing adapter for the MetricRegistry: " + info.getMetricsJmxContext()); synchronized(DefaultMetricsSystem.instance()) { DefaultMetricsSystem.instance().unregisterSource(info.getMetricsJmxContext()); helper.removeSourceName(info.getMetricsJmxContext()); helper.removeObjectName(info.getMetricsJmxContext());
metricsSystem = DefaultMetricsSystem.instance(); } else { metricsSystem = null;
/** * Gets the balancer status tag from the Metrics registry */ public String getStatus() throws Exception { MetricsSource source = DefaultMetricsSystem.instance().getSource(MetricsBalancerSource.METRICS_JMX_CONTEXT); if (source instanceof MetricsBalancerSourceImpl) { MetricsTag status = ((MetricsBalancerSourceImpl) source).getMetricsRegistry() .getTag(MetricsBalancerSource.BALANCER_STATUS); return status.value(); } else { LOG.warn("Balancer JMX Metrics not registered"); throw new Exception("MetricsBalancer JMX Context not found"); } }
public BaseSourceImpl( String metricsName, String metricsDescription, String metricsContext, String metricsJmxContext) { this.metricsName = metricsName; this.metricsDescription = metricsDescription; this.metricsContext = metricsContext; this.metricsJmxContext = metricsJmxContext; metricsRegistry = new DynamicMetricsRegistry(metricsName).setContext(metricsContext); DefaultMetricsSystemInitializer.INSTANCE.init(metricsName); //Register this instance. DefaultMetricsSystem.instance().register(metricsJmxContext, metricsDescription, this); // hbase-metrics module based metrics are registered in the hbase MetricsRegistry. registry = MetricRegistries.global().create(this.getMetricRegistryInfo()); metricsAdapter = new HBaseMetrics2HadoopMetricsAdapter(); init(); }
public static void main(String[] args) throws Exception { final MetricRegistry metrics = new MetricRegistry(); final HadoopMetrics2Reporter metrics2Reporter = HadoopMetrics2Reporter.forRegistry(metrics).build( DefaultMetricsSystem.initialize("StandaloneTest"), // The application-level name "Test", // Component name "Test", // Component description "Test"); // Name for each metric record final ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(metrics).build(); MetricsSystem metrics2 = DefaultMetricsSystem.instance(); // Writes to stdout without a filename configuration // Will be invoked every 10seconds by default FileSink sink = new FileSink(); metrics2.register("filesink", "filesink", sink); sink.init(new SubsetConfiguration(null, null) { public String getString(String key) { if (key.equals("filename")) { return null; } return super.getString(key); } }); // How often should the dropwizard reporter be invoked metrics2Reporter.start(500, TimeUnit.MILLISECONDS); // How often will the dropwziard metrics be logged to the console consoleReporter.start(2, TimeUnit.SECONDS); generateMetrics(metrics, 5000, 25, TimeUnit.MILLISECONDS, metrics2Reporter, 10); }
public static DataNodeVolumeMetrics create(final Configuration conf, final String volumeName) { MetricsSystem ms = DefaultMetricsSystem.instance(); String name = "DataNodeVolume-"+ (volumeName.isEmpty() ? "UndefinedDataNodeVolume"+ ThreadLocalRandom.current().nextInt() : volumeName.replace(':', '-')); // Percentile measurement is off by default, by watching no intervals int[] intervals = conf.getInts(DFSConfigKeys.DFS_METRICS_PERCENTILES_INTERVALS_KEY); return ms.register(name, null, new DataNodeVolumeMetrics(ms, name, intervals)); }
public static JournalMetrics create(Journal j) { JournalMetrics m = new JournalMetrics(j); return DefaultMetricsSystem.instance().register( m.getName(), null, m); }