use of io.opencensus.stats.MeasureMap in project instrumentation-java by census-instrumentation.
the class RecordMultipleViewsBenchmark method record.
private static MeasureMap record(Data data, Measure.MeasureLong measure, int value) {
MeasureMap map = data.recorder.newMeasureMap();
map.put(measure, value).record(data.tagContext);
return map;
}
use of io.opencensus.stats.MeasureMap in project instrumentation-java by census-instrumentation.
the class RecordMultipleViewsBenchmark method record.
private static MeasureMap record(Data data, Measure.MeasureDouble measure, double value) {
MeasureMap map = data.recorder.newMeasureMap();
map.put(measure, value).record(data.tagContext);
return map;
}
use of io.opencensus.stats.MeasureMap in project instrumentation-java by census-instrumentation.
the class RecordDifferentTagValuesBenchmark method record.
private static MeasureMap record(Data data, Measure.MeasureLong measure, int value) {
MeasureMap map = data.recorder.newMeasureMap();
map.put(measure, value);
for (TagContext tags : data.contexts) {
map.record(tags);
}
return map;
}
use of io.opencensus.stats.MeasureMap in project instrumentation-java by census-instrumentation.
the class StatsRecorderImplTest method record_MapDeprecatedRpcConstants.
@Test
public void record_MapDeprecatedRpcConstants() {
View view = View.create(VIEW_NAME, "description", MEASURE_DOUBLE, Sum.create(), Arrays.asList(RecordUtils.RPC_METHOD));
viewManager.registerView(view);
MeasureMap statsRecord = statsRecorder.newMeasureMap().put(MEASURE_DOUBLE, 1.0);
statsRecord.record(new SimpleTagContext(Tag.create(RecordUtils.GRPC_CLIENT_METHOD, VALUE)));
ViewData viewData = viewManager.getView(VIEW_NAME);
// There should be two entries.
StatsTestUtil.assertAggregationMapEquals(viewData.getAggregationMap(), ImmutableMap.of(Arrays.asList(VALUE), StatsTestUtil.createAggregationData(Sum.create(), MEASURE_DOUBLE, 1.0)), 1e-6);
}
use of io.opencensus.stats.MeasureMap in project instrumentation-java by census-instrumentation.
the class StatsRecorderImplTest method recordTwice.
@Test
public void recordTwice() {
View view = View.create(VIEW_NAME, "description", MEASURE_DOUBLE, Sum.create(), Arrays.asList(KEY), Cumulative.create());
viewManager.registerView(view);
MeasureMap statsRecord = statsRecorder.newMeasureMap().put(MEASURE_DOUBLE, 1.0);
statsRecord.record(new SimpleTagContext(Tag.create(KEY, VALUE)));
statsRecord.record(new SimpleTagContext(Tag.create(KEY, VALUE_2)));
ViewData viewData = viewManager.getView(VIEW_NAME);
// There should be two entries.
StatsTestUtil.assertAggregationMapEquals(viewData.getAggregationMap(), ImmutableMap.of(Arrays.asList(VALUE), StatsTestUtil.createAggregationData(Sum.create(), MEASURE_DOUBLE, 1.0), Arrays.asList(VALUE_2), StatsTestUtil.createAggregationData(Sum.create(), MEASURE_DOUBLE, 1.0)), 1e-6);
}
Aggregations