Examples of PhoenixMetricsRecord


Examples of org.apache.phoenix.metrics.PhoenixMetricsRecord

   * Convert the passed record to a {@link PhoenixMetricsRecord}
   * @param record to convert
   * @return a generic {@link PhoenixMetricsRecord} that delegates to the record in all things
   */
  private PhoenixMetricsRecord wrap(final MetricsRecord record) {
    return new PhoenixMetricsRecord() {

      @Override
      public String name() {
        return record.name();
      }
View Full Code Here

Examples of org.apache.phoenix.metrics.PhoenixMetricsRecord

    // 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

Examples of org.apache.phoenix.metrics.PhoenixMetricsRecord

        Connection conn = DriverManager.getConnection(getUrl(), props);
        sink.initForTesting(conn);

        // create a simple metrics record
        long traceid = 987654;
        PhoenixMetricsRecord record =
                createAndFlush(sink, traceid, Span.ROOT_SPAN_ID, 10, "root", 12, 13,
                    "host-name.value", "test annotation for a span");

        // start a reader
        validateTraces(Collections.singletonList(record), conn, traceid);
View Full Code Here

Examples of org.apache.phoenix.metrics.PhoenixMetricsRecord

    }

    private PhoenixMetricsRecord createAndFlush(PhoenixTableMetricsWriter sink, long traceid,
            long parentid, long spanid, String desc, long startTime, long endTime, String hostname,
            String... tags) {
        PhoenixMetricsRecord record =
                createRecord(traceid, parentid, spanid, desc, startTime, endTime, hostname, tags);
        sink.addMetrics(record);
        sink.flush();
        return record;
    }
View Full Code Here

Examples of org.apache.phoenix.metrics.PhoenixMetricsRecord

        sink.initForTesting(conn);

        // create a simple metrics record
        long traceid = 12345;
        List<PhoenixMetricsRecord> records = new ArrayList<PhoenixMetricsRecord>();
        PhoenixMetricsRecord record =
                createAndFlush(sink, traceid, Span.ROOT_SPAN_ID, 7777, "root", 10, 30,
                    "hostname.value", "root-span tag");
        records.add(record);

        // then create a child record
View Full Code Here

Examples of org.apache.phoenix.metrics.PhoenixMetricsRecord

        long parentid = 11;
        long startTime = 12;
        long endTime = 13;
        String annotation = "test annotation for a span";
        String hostnameValue = "host-name.value";
        PhoenixMetricsRecord record =
                createRecord(traceid, parentid, spanid, description, startTime, endTime,
                    hostnameValue, annotation);

        // actually write the record to the table
        sink.addMetrics(record);
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.