@Override
  public void endRequest(Exception exception, int httpStatusCode, long retryCount) {
    // multiple endRequest are ignored
    if (this.finished) {
      return;
    }
    this.finished = true;
    long requestTime = milliTime() - this.requestStart;

    TagContext tagContext =
        tagger
            .currentBuilder()
            .putLocal(OpenCensusMetrics.Tags.REQUEST_NAME, TagValue.create(requestName))
            .putLocal(
                OpenCensusMetrics.Tags.HTTP_CODE, TagValue.create(Integer.toString(httpStatusCode)))
            .putLocal(OpenCensusMetrics.Tags.API_STATUS, TagValue.create(exceptionName(exception)))
            .build();
    statsRecorder
        .newMeasureMap()
        .put(OpenCensusMetrics.Measures.LATENCY, requestTime)
        .put(OpenCensusMetrics.Measures.NETWORK_LATENCY, this.networkTime)
        .put(OpenCensusMetrics.Measures.RETRY_COUNT, retryCount)
        .record(tagContext);
  }
An OpenCensus logger that generates success and latency metrics.
src/main/java/com/google/maps/metrics/OpenCensusRequestMetrics.java