Search in sources :

Example 1 with ExposedMetricCounterLong

use of org.apache.hadoop.metrics2.impl.ExposedMetricCounterLong in project phoenix by apache.

the class BaseTracingTestIT method createRecord.

public static MetricsRecord createRecord(long traceid, long parentid, long spanid, String desc, long startTime, long endTime, String hostname, String... tags) {
    List<AbstractMetric> metrics = new ArrayList<AbstractMetric>();
    AbstractMetric span = new ExposedMetricCounterLong(asInfo(MetricInfo.SPAN.traceName), spanid);
    metrics.add(span);
    AbstractMetric parent = new ExposedMetricCounterLong(asInfo(MetricInfo.PARENT.traceName), parentid);
    metrics.add(parent);
    AbstractMetric start = new ExposedMetricCounterLong(asInfo(MetricInfo.START.traceName), startTime);
    metrics.add(start);
    AbstractMetric end = new ExposedMetricCounterLong(asInfo(MetricInfo.END.traceName), endTime);
    metrics.add(end);
    List<MetricsTag> tagsList = new ArrayList<MetricsTag>();
    int tagCount = 0;
    for (String annotation : tags) {
        MetricsTag tag = new PhoenixTagImpl(MetricInfo.ANNOTATION.traceName, Integer.toString(tagCount++), annotation);
        tagsList.add(tag);
    }
    String hostnameValue = "host-name.value";
    MetricsTag hostnameTag = new PhoenixTagImpl(MetricInfo.HOSTNAME.traceName, "", hostnameValue);
    tagsList.add(hostnameTag);
    MetricsRecord record = new ExposedMetricsRecordImpl(new ExposedMetricsInfoImpl(TracingUtils.getTraceMetricName(traceid), desc), System.currentTimeMillis(), tagsList, metrics);
    return record;
}
Also used : ExposedMetricsInfoImpl(org.apache.hadoop.metrics2.lib.ExposedMetricsInfoImpl) ExposedMetricCounterLong(org.apache.hadoop.metrics2.impl.ExposedMetricCounterLong) MetricsRecord(org.apache.hadoop.metrics2.MetricsRecord) ExposedMetricsRecordImpl(org.apache.hadoop.metrics2.impl.ExposedMetricsRecordImpl) ArrayList(java.util.ArrayList) AbstractMetric(org.apache.hadoop.metrics2.AbstractMetric) MetricsTag(org.apache.hadoop.metrics2.MetricsTag)

Aggregations

ArrayList (java.util.ArrayList)1 AbstractMetric (org.apache.hadoop.metrics2.AbstractMetric)1 MetricsRecord (org.apache.hadoop.metrics2.MetricsRecord)1 MetricsTag (org.apache.hadoop.metrics2.MetricsTag)1 ExposedMetricCounterLong (org.apache.hadoop.metrics2.impl.ExposedMetricCounterLong)1 ExposedMetricsRecordImpl (org.apache.hadoop.metrics2.impl.ExposedMetricsRecordImpl)1 ExposedMetricsInfoImpl (org.apache.hadoop.metrics2.lib.ExposedMetricsInfoImpl)1