Search in sources :

Example 1 with Measurement

use of io.opencensus.stats.Measurement in project instrumentation-java by census-instrumentation.

the class MeasureToViewMap method record.

// Records stats with a set of tags.
synchronized void record(TagContext tags, MeasureMapInternal stats, Timestamp timestamp) {
    Iterator<Measurement> iterator = stats.iterator();
    Map<String, AttachmentValue> attachments = stats.getAttachments();
    while (iterator.hasNext()) {
        Measurement measurement = iterator.next();
        Measure measure = measurement.getMeasure();
        if (!measure.equals(registeredMeasures.get(measure.getName()))) {
            // unregistered measures will be ignored.
            continue;
        }
        Collection<MutableViewData> viewDataCollection = mutableMap.get(measure.getName());
        for (MutableViewData viewData : viewDataCollection) {
            viewData.record(tags, RecordUtils.getDoubleValueFromMeasurement(measurement), timestamp, attachments);
        }
    }
}
Also used : Measurement(io.opencensus.stats.Measurement) AttachmentValue(io.opencensus.metrics.data.AttachmentValue) Measure(io.opencensus.stats.Measure)

Aggregations

AttachmentValue (io.opencensus.metrics.data.AttachmentValue)1 Measure (io.opencensus.stats.Measure)1 Measurement (io.opencensus.stats.Measurement)1