Examples of ExposedMetricsRecordImpl


Examples of org.apache.hadoop.metrics2.impl.ExposedMetricsRecordImpl

    String hostnameValue = "host-name.value";
    MetricsTag hostname = new MetricsTag(new ExposedMetricsInfoImpl(MetricInfo.HOSTNAME.traceName,
        ""), hostnameValue);
    final List<MetricsTag> tags = Lists.newArrayList(hostname, tag);

    MetricsRecord record = new ExposedMetricsRecordImpl(info, System.currentTimeMillis(), tags,
        metrics);

    // setup the mocking/validation for the sink
    Mockito.doAnswer(new Answer<Void>() {

      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        PhoenixMetricsRecord record = (PhoenixMetricsRecord) invocation.getArguments()[0];
        //validate that we got the right fields in the record
        assertEquals("phoenix.987654", record.name());
        assertEquals("Some generic trace", record.description());
        int count = 0;
        for (PhoenixAbstractMetric metric : record.metrics()) {
          count++;
          //find the matching metric in the list
          boolean found = false;
          for(AbstractMetric expected : metrics){
            if(expected.name().equals(metric.getName())){
              found = true;
              // make sure the rest of the info matches
              assertEquals("Metric value mismatch", expected.value(), metric.value());
            }
          }
          assertTrue("Didn't find an expected metric to match "+metric, found);
        }
        assertEquals("Number of metrics is received is wrong", metrics.size(), count);

        count = 0;
        for (PhoenixMetricTag tag : record.tags()) {
          count++;
          // find the matching metric in the list
          boolean found = false;
          for (MetricsTag expected : tags) {
            if (expected.name().equals(tag.name())) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.