Java Code Examples for io.opencensus.stats.Measure#MeasureDouble

The following examples show how to use io.opencensus.stats.Measure#MeasureDouble . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TelemetryUtils.java    From meghanada-server with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("try")
public static void recordTaggedStat(
    TagKey key, String value, Measure.MeasureDouble md, Double d) {
  TagContext tctx = tagger.emptyBuilder().putLocal(key, TagValue.create(value)).build();
  try (Scope ss = tagger.withTagContext(tctx)) {
    statsRecorder.newMeasureMap().put(md, d).record();
  }
}
 
Example 2
Source File: TelemetryUtils.java    From meghanada-server with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("try")
public static void recordTaggedStat(
    TagKey[] keys, String[] values, Measure.MeasureDouble md, Double d) {
  TagContextBuilder builder = tagger.emptyBuilder();
  for (int i = 0; i < keys.length; i++) {
    builder.putLocal(keys[i], TagValue.create(values[i]));
  }
  TagContext tctx = builder.build();
  try (Scope ss = tagger.withTagContext(tctx)) {
    statsRecorder.newMeasureMap().put(md, d).record();
  }
}
 
Example 3
Source File: StatsBenchmarksUtil.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
private static Measure.MeasureDouble[] createMeasureDoubles(int size, String name) {
  Measure.MeasureDouble[] measures = new Measure.MeasureDouble[size];
  for (int i = 0; i < size; i++) {
    measures[i] = Measure.MeasureDouble.create(name + "_MD" + i, "", "ns");
  }
  return measures;
}
 
Example 4
Source File: RecordDifferentTagValuesBenchmark.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
private static MeasureMap record(Data data, Measure.MeasureDouble measure, double value) {
  MeasureMap map = data.recorder.newMeasureMap();
  map.put(measure, value);
  for (TagContext tags : data.contexts) {
    map.record(tags);
  }
  return map;
}
 
Example 5
Source File: StatsTestUtils.java    From grpc-nebula-java with Apache License 2.0 4 votes vote down vote up
@Override
public MeasureMap put(Measure.MeasureDouble measure, double value) {
  metrics.put(measure, value);
  return this;
}
 
Example 6
Source File: RecordMultipleViewsBenchmark.java    From opencensus-java with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example 7
Source File: StatsTestUtils.java    From grpc-java with Apache License 2.0 4 votes vote down vote up
@Override
public MeasureMap put(Measure.MeasureDouble measure, double value) {
  metrics.put(measure, value);
  return this;
}