docs: public static void main(String[] args) throws InterruptedException {
      TagContextBuilder tagContextBuilder =
          tagger.currentBuilder().put(FRONTEND_KEY, TagValue.create("mobile-ios9.3.5"));
      SpanBuilder spanBuilder =
          tracer
              .spanBuilder("my.org/ProcessVideo")
              .setRecordEvents(true)
              .setSampler(Samplers.alwaysSample());
      viewManager.registerView(VIDEO_SIZE_VIEW);
      LoggingTraceExporter.register();
  
      // Process video.
      // Record the processed video size.
      try (Scope scopedTags = tagContextBuilder.buildScoped();
          Scope scopedSpan = spanBuilder.startScopedSpan()) {
        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, 25 * MiB).record();
        tracer.getCurrentSpan().addAnnotation("Finished processing video.");
      } catch (Exception e) {
        tracer.getCurrentSpan().addAnnotation("Exception thrown when processing video.");
        tracer.getCurrentSpan().setStatus(Status.UNKNOWN);
        logger.severe(e.getMessage());
      }
  
      logger.info("Wait longer than the reporting duration...");
      // Wait for a duration longer than reporting duration (5s) to ensure spans are exported.
      // TODO(songya): remove the gap once we add a shutdown hook for exporting unflushed spans.
      Thread.sleep(5100);
      ViewData viewData = viewManager.getView(VIDEO_SIZE_VIEW_NAME);
      logger.info(
          String.format("Recorded stats for %s:\n %s", VIDEO_SIZE_VIEW_NAME.asString(), viewData));
    }