@Test public void testReportClientMetrics() { String metricName = "Client.TestMetric"; Counter counter = MetricsSystem.counter(metricName); if (!MetricKey.isValid(metricName)) { MetricKey.register(new MetricKey.Builder(metricName) .setMetricType(MetricType.COUNTER).setIsClusterAggregated(true).build()); } counter.inc(5); assertEquals(5.0, MetricsSystem.reportClientMetrics().get(0).getValue(), 0); assertEquals(0, MetricsSystem.reportClientMetrics().size()); counter.inc(2); assertEquals(2.0, MetricsSystem.reportClientMetrics().get(0).getValue(), 0); assertEquals(0, MetricsSystem.reportClientMetrics().size()); }
public static List<alluxio.grpc.Metric> reportClientMetrics() { long start = System.currentTimeMillis(); List<alluxio.grpc.Metric> metricsList = reportMetrics(InstanceType.CLIENT); LOG.debug("Get the client metrics list to report to leading master in {}ms", System.currentTimeMillis() - start); return metricsList; }
MetricsSystem { public static List<alluxio.grpc.Metric> reportClientMetrics() { long start = System.currentTimeMillis(); List<alluxio.grpc.Metric> metricsList = reportMetrics(InstanceType.CLIENT); LOG.debug("Get the client metrics list to report to leading master in {}ms", System.currentTimeMillis() - start); return metricsList; } }
MetricsSystem { public static List<alluxio.grpc.Metric> reportClientMetrics() { long start = System.currentTimeMillis(); List<alluxio.grpc.Metric> metricsList = reportMetrics(InstanceType.CLIENT); LOG.debug("Get the client metrics list to report to leading master in {}ms", System.currentTimeMillis() - start); return metricsList; } private  MetricsSystem(); }
MetricsSystem { public static List<alluxio.grpc.Metric> reportClientMetrics() { long start = System.currentTimeMillis(); List<alluxio.grpc.Metric> metricsList = reportMetrics(InstanceType.CLIENT); LOG.debug("Get the client metrics list to report to leading master in {}ms", System.currentTimeMillis() - start); return metricsList; } private  MetricsSystem(); static void startSinks(String metricsConfFile); static synchronized void startSinksFromConfig(MetricsConfig config); static synchronized void stopSinks(); static synchronized int getNumSinks(); static String getMetricName(String name); static String getMasterMetricName(String name); static String getJobWorkerMetricName(String name); static void checkMinimalPollingPeriod(TimeUnit pollUnit, int pollPeriod); static String stripInstanceAndHost(String metricsName); static String escape(AlluxioURI uri); static String unescape(String uri); static Counter counter(String name); static Counter counterWithTags(String name, boolean shouldReport, String... tags); static Meter meter(String name); static Meter meterWithTags(String name, boolean shouldReport, String... tags); static Timer timer(String name); static synchronized void registerGaugeIfAbsent(String name, Gauge<T> metric); static List<alluxio.grpc.Metric> reportWorkerMetrics(); static List<alluxio.grpc.Metric> reportClientMetrics(); static Map<String, Set<Metric>> getMasterMetrics(Set<String> metricNames); @Nullable static Metric getMetricValue(String fullName); static Map<String, MetricValue> allMetrics(); @VisibleForTesting static void initShouldReportMetrics(InstanceType instanceType); static synchronized void resetAllMetrics(); @VisibleForTesting static void clearAllMetrics(); @VisibleForTesting static void resetCountersAndGauges(); }
MetricsSystem { public static List<alluxio.grpc.Metric> reportClientMetrics() { long start = System.currentTimeMillis(); List<alluxio.grpc.Metric> metricsList = reportMetrics(InstanceType.CLIENT); LOG.debug("Get the client metrics list to report to leading master in {}ms", System.currentTimeMillis() - start); return metricsList; } private  MetricsSystem(); static void startSinks(String metricsConfFile); static synchronized void startSinksFromConfig(MetricsConfig config); static synchronized void stopSinks(); static synchronized int getNumSinks(); static String getMetricName(String name); static String getMasterMetricName(String name); static String getJobWorkerMetricName(String name); static void checkMinimalPollingPeriod(TimeUnit pollUnit, int pollPeriod); static String stripInstanceAndHost(String metricsName); static String escape(AlluxioURI uri); static String unescape(String uri); static Counter counter(String name); static Counter counterWithTags(String name, boolean shouldReport, String... tags); static Meter meter(String name); static Meter meterWithTags(String name, boolean shouldReport, String... tags); static Timer timer(String name); static synchronized void registerGaugeIfAbsent(String name, Gauge<T> metric); static List<alluxio.grpc.Metric> reportWorkerMetrics(); static List<alluxio.grpc.Metric> reportClientMetrics(); static Map<String, Set<Metric>> getMasterMetrics(Set<String> metricNames); @Nullable static Metric getMetricValue(String fullName); static Map<String, MetricValue> allMetrics(); @VisibleForTesting static void initShouldReportMetrics(InstanceType instanceType); static synchronized void resetAllMetrics(); @VisibleForTesting static void clearAllMetrics(); @VisibleForTesting static void resetCountersAndGauges(); static final String CLUSTER; static final MetricRegistry METRIC_REGISTRY; static final String SINK_REGEX; }