Example usage for org.apache.hadoop.metrics2 MetricsRecord timestamp

List of usage examples for org.apache.hadoop.metrics2 MetricsRecord timestamp

Introduction

In this page you can find the example usage for org.apache.hadoop.metrics2 MetricsRecord timestamp.

Prototype

long timestamp();

Source Link

Document

Get the timestamp of the metrics

Usage

From source file:io.warp10.sensision.hadoop.SensisionSink.java

License:Apache License

@Override
public void putMetrics(MetricsRecord record) {
    Map<String, String> labels = new HashMap<String, String>();
    for (MetricsTag tag : record.tags()) {
        if (null != tag.value()) {
            labels.put(tag.name(), tag.value());
        }//from  w  w w .j av  a2s . co m
    }

    StringBuilder sb = new StringBuilder();

    for (AbstractMetric metric : record.metrics()) {
        sb.setLength(0);
        sb.append(this.prefix);
        sb.append(metric.name());
        String cls = sb.toString();
        Sensision.set(cls, labels, record.timestamp() * Sensision.TIME_UNITS_PER_MS, null, null, null,
                metric.value(), ttl);
    }
}