use of org.apache.hadoop.metrics2.impl.ExposedMetricsRecordImpl 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;
}
Aggregations