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

The following examples show how to use io.opencensus.stats.Measure#MeasureLong . 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 recordStat(Measure.MeasureLong ml, Long n) {
  TagContext tctx = tagger.emptyBuilder().build();
  try (Scope ss = tagger.withTagContext(tctx)) {
    statsRecorder.newMeasureMap().put(ml, n).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 key, String value, Measure.MeasureLong ml, Long n) {
  TagContext tctx = tagger.emptyBuilder().putLocal(key, TagValue.create(value)).build();
  try (Scope ss = tagger.withTagContext(tctx)) {
    statsRecorder.newMeasureMap().put(ml, n).record();
  }
}
 
Example 3
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.MeasureLong md, Long n) {
  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, n).record();
  }
}
 
Example 4
Source File: StatsBenchmarksUtil.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
private static Measure.MeasureLong[] createMeasureLongs(int size, String name) {
  Measure.MeasureLong[] measures = new Measure.MeasureLong[size];
  for (int i = 0; i < size; i++) {
    measures[i] = Measure.MeasureLong.create(name + "_ML" + i, "", "ns");
  }
  return measures;
}
 
Example 5
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.MeasureLong measure, int value) {
  MeasureMap map = data.recorder.newMeasureMap();
  map.put(measure, value);
  for (TagContext tags : data.contexts) {
    map.record(tags);
  }
  return map;
}
 
Example 6
Source File: StatsTestUtils.java    From grpc-nebula-java with Apache License 2.0 4 votes vote down vote up
@Override
public MeasureMap put(Measure.MeasureLong measure, long value) {
  metrics.put(measure, value);
  return this;
}
 
Example 7
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.MeasureLong measure, int value) {
  MeasureMap map = data.recorder.newMeasureMap();
  map.put(measure, value).record(data.tagContext);
  return map;
}
 
Example 8
Source File: StatsTestUtils.java    From grpc-java with Apache License 2.0 4 votes vote down vote up
@Override
public MeasureMap put(Measure.MeasureLong measure, long value) {
  metrics.put(measure, value);
  return this;
}