aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authoreasy <g-easy@users.noreply.github.com>2018-03-15 17:26:26 +1100
committerGitHub <noreply@github.com>2018-03-15 17:26:26 +1100
commite45afa14e204ef3800cf7c89ae91fc23e6ae49ef (patch)
tree550ed3711b2142c39fc6261bc6e40e5f648614bd /examples
parentb40fd021e3f3c2323c157f6a5cf3b5abdbca6bd8 (diff)
downloadopencensus-java-e45afa14e204ef3800cf7c89ae91fc23e6ae49ef.tar.gz
Change MBy to By units. (#1058)
This reflects the default gRPC views which use bytes as units.
Diffstat (limited to 'examples')
-rw-r--r--examples/src/main/java/io/opencensus/examples/helloworld/QuickStart.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/src/main/java/io/opencensus/examples/helloworld/QuickStart.java b/examples/src/main/java/io/opencensus/examples/helloworld/QuickStart.java
index 2ff505ee..5907b6b2 100644
--- a/examples/src/main/java/io/opencensus/examples/helloworld/QuickStart.java
+++ b/examples/src/main/java/io/opencensus/examples/helloworld/QuickStart.java
@@ -52,12 +52,14 @@ public final class QuickStart {
private static final StatsRecorder statsRecorder = Stats.getStatsRecorder();
private static final Tracer tracer = Tracing.getTracer();
- // frontendKey allows us to break down the recorded data
+ // frontendKey allows us to break down the recorded data.
private static final TagKey FRONTEND_KEY = TagKey.create("my.org/keys/frontend");
// videoSize will measure the size of processed videos.
private static final MeasureLong VIDEO_SIZE =
- MeasureLong.create("my.org/measure/video_size", "size of processed videos", "MBy");
+ MeasureLong.create("my.org/measure/video_size", "size of processed videos", "By");
+
+ private static final long MiB = 1 << 20;
// Create view to see the processed video size distribution broken down by frontend.
// The view has bucket boundaries (0, 256, 65536) that will group measure values into
@@ -69,7 +71,7 @@ public final class QuickStart {
"processed video size over time",
VIDEO_SIZE,
Aggregation.Distribution.create(
- BucketBoundaries.create(Arrays.asList(0.0, 256.0, 65536.0))),
+ BucketBoundaries.create(Arrays.asList(0.0, 16.0 * MiB, 256.0 * MiB))),
Collections.singletonList(FRONTEND_KEY),
Cumulative.create());
@@ -92,7 +94,7 @@ public final class QuickStart {
tracer.getCurrentSpan().addAnnotation("Start processing video.");
// Sleep for [0,10] milliseconds to fake work.
Thread.sleep(new Random().nextInt(10) + 1);
- statsRecorder.newMeasureMap().put(VIDEO_SIZE, 25648).record();
+ statsRecorder.newMeasureMap().put(VIDEO_SIZE, 25 * MiB).record();
tracer.getCurrentSpan().addAnnotation("Finished processing video.");
} catch (Exception e) {
tracer.getCurrentSpan().addAnnotation("Exception thrown when processing video.");